[Lldb-commits] [lldb] 779bbbf - [lldb] Replace asserts on .Success() with assertSuccess()
Dave Lee via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 14 08:31:32 PST 2022
Author: Dave Lee
Date: 2022-02-14T08:31:17-08:00
New Revision: 779bbbf27fe631154bdfaac7a443f198d4654688
URL: https://github.com/llvm/llvm-project/commit/779bbbf27fe631154bdfaac7a443f198d4654688
DIFF: https://github.com/llvm/llvm-project/commit/779bbbf27fe631154bdfaac7a443f198d4654688.diff
LOG: [lldb] Replace asserts on .Success() with assertSuccess()
Replace forms of `assertTrue(err.Success())` with `assertSuccess(err)` (added in D82759).
* `assertSuccess` prints out the error's message
* `assertSuccess` expresses explicit higher level semantics, both to the reader and for test failure output
* `assertSuccess` seems not to be well known, using it where possible will help spread knowledge
* `assertSuccess` statements are more succinct
Differential Revision: https://reviews.llvm.org/D119616
Added:
Modified:
lldb/test/API/commands/expression/context-object-objc/TestContextObjectObjc.py
lldb/test/API/commands/platform/basic/TestPlatformPython.py
lldb/test/API/commands/watchpoints/multiple_hits/TestMultipleHits.py
lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py
lldb/test/API/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py
lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
lldb/test/API/functionalities/dlopen_other_executable/TestDlopenOtherExecutable.py
lldb/test/API/functionalities/dyld-launch-linux/TestDyldLaunchLinux.py
lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
lldb/test/API/functionalities/gdb_remote_client/TestMemoryRegionDirtyPages.py
lldb/test/API/functionalities/launch_stop_at_entry/TestStopAtEntry.py
lldb/test/API/functionalities/load_using_paths/TestLoadUsingPaths.py
lldb/test/API/functionalities/paths/TestPaths.py
lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py
lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py
lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
lldb/test/API/functionalities/return-value/TestReturnValue.py
lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
lldb/test/API/functionalities/step_scripted/TestStepScripted.py
lldb/test/API/functionalities/thread/exit_during_expression/TestExitDuringExpression.py
lldb/test/API/functionalities/thread/state_after_expression/TestStateAfterExpression.py
lldb/test/API/functionalities/var_path/TestVarPath.py
lldb/test/API/lang/c/local_types/TestUseClosestType.py
lldb/test/API/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
lldb/test/API/lang/cpp/trivial_abi/TestTrivialABI.py
lldb/test/API/lang/cpp/type_lookup/TestCppTypeLookup.py
lldb/test/API/lang/objc/blocks/TestObjCIvarsInBlocks.py
lldb/test/API/lang/objc/global_ptrs/TestGlobalObjects.py
lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py
lldb/test/API/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
lldb/test/API/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py
lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
lldb/test/API/linux/aarch64/unwind_signal/TestUnwindSignal.py
lldb/test/API/macosx/function-starts/TestFunctionStarts.py
lldb/test/API/macosx/profile_vrs_detach/TestDetachVrsProfile.py
lldb/test/API/macosx/thread_suspend/TestInternalThreadSuspension.py
lldb/test/API/macosx/universal/TestUniversal.py
lldb/test/API/python_api/debugger/TestDebuggerAPI.py
lldb/test/API/python_api/file_handle/TestFileHandle.py
lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
lldb/test/API/python_api/sbdata/TestSBData.py
lldb/test/API/python_api/sbmodule/TestSBModule.py
lldb/test/API/python_api/sbplatform/TestSBPlatform.py
lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py
lldb/test/API/python_api/target/TestTargetAPI.py
lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
lldb/test/API/sample_test/TestSampleTest.py
lldb/test/API/sample_test/main.c
Removed:
################################################################################
diff --git a/lldb/test/API/commands/expression/context-object-objc/TestContextObjectObjc.py b/lldb/test/API/commands/expression/context-object-objc/TestContextObjectObjc.py
index 51ee0b51f3be2..eb43a59667cb4 100644
--- a/lldb/test/API/commands/expression/context-object-objc/TestContextObjectObjc.py
+++ b/lldb/test/API/commands/expression/context-object-objc/TestContextObjectObjc.py
@@ -36,7 +36,7 @@ def test_context_object_objc(self):
# Test retrieving of a field (not a local with the same name)
value = obj_val.EvaluateExpression("field")
self.assertTrue(value.IsValid())
- self.assertTrue(value.GetError().Success())
+ self.assertSuccess(value.GetError())
self.assertEqual(value.GetValueAsSigned(), 1111)
# Test if the self pointer is properly evaluated
diff --git a/lldb/test/API/commands/platform/basic/TestPlatformPython.py b/lldb/test/API/commands/platform/basic/TestPlatformPython.py
index 0063621e58007..1a6f6f33e1df9 100644
--- a/lldb/test/API/commands/platform/basic/TestPlatformPython.py
+++ b/lldb/test/API/commands/platform/basic/TestPlatformPython.py
@@ -94,5 +94,5 @@ def test_shell_interpreter(self):
self.build()
sh_cmd.SetShell(self.getBuildArtifact('a.out'))
err = platform.Run(sh_cmd)
- self.assertTrue(err.Success())
+ self.assertSuccess(err)
self.assertIn("SUCCESS", sh_cmd.GetOutput())
diff --git a/lldb/test/API/commands/watchpoints/multiple_hits/TestMultipleHits.py b/lldb/test/API/commands/watchpoints/multiple_hits/TestMultipleHits.py
index 7232070f6dd45..c0633360137a0 100644
--- a/lldb/test/API/commands/watchpoints/multiple_hits/TestMultipleHits.py
+++ b/lldb/test/API/commands/watchpoints/multiple_hits/TestMultipleHits.py
@@ -43,7 +43,7 @@ def test(self):
error = lldb.SBError()
watch = member.Watch(True, True, True, error)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
process.Continue();
self.assertEqual(process.GetState(), lldb.eStateStopped)
diff --git a/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py b/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py
index d5240d5db68ad..1d2812e15f60a 100644
--- a/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py
+++ b/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py
@@ -54,9 +54,7 @@ def test(self):
# resolve_location=True, read=True, write=False
read_watchpoint = read_value.Watch(True, True, False, error)
- self.assertTrue(error.Success(),
- "Error while setting watchpoint: %s" %
- error.GetCString())
+ self.assertSuccess(error, "Error while setting watchpoint")
self.assertTrue(read_watchpoint, "Failed to set read watchpoint.")
thread.StepOver()
@@ -84,9 +82,7 @@ def test(self):
# resolve_location=True, read=False, write=True
write_watchpoint = write_value.Watch(True, False, True, error)
self.assertTrue(write_watchpoint, "Failed to set write watchpoint.")
- self.assertTrue(error.Success(),
- "Error while setting watchpoint: %s" %
- error.GetCString())
+ self.assertSuccess(error, "Error while setting watchpoint")
thread.StepOver()
self.assertEquals(thread.GetStopReason(), lldb.eStopReasonWatchpoint,
diff --git a/lldb/test/API/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py b/lldb/test/API/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py
index 797708a15a57a..262f718f2ade9 100644
--- a/lldb/test/API/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py
+++ b/lldb/test/API/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py
@@ -48,7 +48,7 @@ def launch_it (self, expected_state):
launch_info.SetWorkingDirectory(self.get_process_working_directory())
process = self.target.Launch(launch_info, error)
- self.assertTrue(error.Success(), "Launch failed.")
+ self.assertSuccess(error, "Launch failed.")
state = process.GetState()
self.assertEqual(state, expected_state, "Didn't get expected state")
diff --git a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
index 35e19c888355f..f9c9554c63c6a 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
@@ -110,7 +110,7 @@ def do_set_python_command_from_python(self):
stream.Print('{"side_effect" : "I am fancy"}')
extra_args.SetFromJSON(stream)
error = fancy_bkpt.SetScriptCallbackFunction("bktptcmd.another_function", extra_args)
- self.assertTrue(error.Success(), "Failed to add callback %s"%(error.GetCString()))
+ self.assertSuccess(error, "Failed to add callback")
stream.Clear()
stream.Print('{"side_effect" : "I am so much fancier"}')
@@ -123,14 +123,14 @@ def do_set_python_command_from_python(self):
# Not so fancy gets an empty extra_args:
empty_args = lldb.SBStructuredData()
error = not_so_fancy_bkpt.SetScriptCallbackFunction("bktptcmd.empty_extra_args", empty_args)
- self.assertTrue(error.Success(), "Failed to add callback %s"%(error.GetCString()))
+ self.assertSuccess(error, "Failed to add callback")
# Do list breakpoint like fancy:
stream.Clear()
stream.Print('{"side_effect" : "I come from list input"}')
extra_args.SetFromJSON(stream)
error = list_bkpt.SetScriptCallbackFunction("bktptcmd.a_list_function", extra_args)
- self.assertTrue(error.Success(), "Failed to add callback %s"%(error.GetCString()))
+ self.assertSuccess(error, "Failed to add callback")
# Clear out canary variables
side_effect.bktptcmd = None
diff --git a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
index 02c0aab9149e9..533054db53555 100644
--- a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
+++ b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
@@ -71,7 +71,7 @@ def make_extra_args(self):
json_stream.Print(json_string)
extra_args = lldb.SBStructuredData()
error = extra_args.SetFromJSON(json_stream)
- self.assertTrue(error.Success(), "Error making SBStructuredData: %s"%(error.GetCString()))
+ self.assertSuccess(error, "Error making SBStructuredData")
return extra_args
def do_test(self):
diff --git a/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py b/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
index f209dbedcf1cc..3493d40f7ad6a 100644
--- a/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
+++ b/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
@@ -119,11 +119,11 @@ def check_equivalence(self, source_bps, do_write = True):
if (do_write):
error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, source_bps)
- self.assertTrue(error.Success(), "Failed writing breakpoints to file: %s."%(error.GetCString()))
+ self.assertSuccess(error, "Failed writing breakpoints to file")
copy_bps = lldb.SBBreakpointList(self.copy_target)
error = self.copy_target.BreakpointsCreateFromFile(self.bkpts_file_spec, copy_bps)
- self.assertTrue(error.Success(), "Failed reading breakpoints from file: %s"%(error.GetCString()))
+ self.assertSuccess(error, "Failed reading breakpoints from file")
num_source_bps = source_bps.GetSize()
num_copy_bps = copy_bps.GetSize()
@@ -279,7 +279,7 @@ def do_check_appending(self):
error = lldb.SBError()
error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, source_bps)
- self.assertTrue(error.Success(), "Failed writing breakpoints to file: %s."%(error.GetCString()))
+ self.assertSuccess(error, "Failed writing breakpoints to file")
source_bps.Clear()
@@ -299,7 +299,7 @@ def do_check_appending(self):
all_bps.Append(bkpt)
error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, source_bps, True)
- self.assertTrue(error.Success(), "Failed appending breakpoints to file: %s."%(error.GetCString()))
+ self.assertSuccess(error, "Failed appending breakpoints to file")
self.check_equivalence(all_bps)
@@ -313,19 +313,19 @@ def do_check_names(self):
error = lldb.SBError()
error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, write_bps)
- self.assertTrue(error.Success(), "Failed writing breakpoints to file: %s."%(error.GetCString()))
+ self.assertSuccess(error, "Failed writing breakpoints to file")
copy_bps = lldb.SBBreakpointList(self.copy_target)
names_list = lldb.SBStringList()
names_list.AppendString("NoSuchName")
error = self.copy_target.BreakpointsCreateFromFile(self.bkpts_file_spec, names_list, copy_bps)
- self.assertTrue(error.Success(), "Failed reading breakpoints from file: %s"%(error.GetCString()))
+ self.assertSuccess(error, "Failed reading breakpoints from file")
self.assertEqual(copy_bps.GetSize(), 0, "Found breakpoints with a nonexistent name.")
names_list.AppendString(good_bkpt_name)
error = self.copy_target.BreakpointsCreateFromFile(self.bkpts_file_spec, names_list, copy_bps)
- self.assertTrue(error.Success(), "Failed reading breakpoints from file: %s"%(error.GetCString()))
+ self.assertSuccess(error, "Failed reading breakpoints from file")
self.assertEqual(copy_bps.GetSize(), 1, "Found the matching breakpoint.")
def do_check_extra_args(self):
@@ -348,12 +348,12 @@ def do_check_extra_args(self):
write_bps = lldb.SBBreakpointList(self.orig_target)
error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, write_bps)
- self.assertTrue(error.Success(), "Failed writing breakpoints: %s"%(error.GetCString()))
+ self.assertSuccess(error, "Failed writing breakpoints")
side_effect.g_extra_args = None
copy_bps = lldb.SBBreakpointList(self.copy_target)
error = self.copy_target.BreakpointsCreateFromFile(self.bkpts_file_spec, copy_bps)
- self.assertTrue(error.Success(), "Failed reading breakpoints: %s"%(error.GetCString()))
+ self.assertSuccess(error, "Failed reading breakpoints")
self.assertEqual(copy_bps.GetSize(), 1, "Got one breakpoint from file.")
no_keys = lldb.SBStringList()
@@ -377,7 +377,7 @@ def do_check_extra_args(self):
write_bps = lldb.SBBreakpointList(self.orig_target)
error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, write_bps)
- self.assertTrue(error.Success(), "Failed writing breakpoints: %s"%(error.GetCString()))
+ self.assertSuccess(error, "Failed writing breakpoints")
orig_extra_args = side_effect.g_extra_args
self.assertTrue(orig_extra_args.IsValid(), "Extra args originally valid")
@@ -390,7 +390,7 @@ def do_check_extra_args(self):
copy_bps = lldb.SBBreakpointList(self.copy_target)
error = self.copy_target.BreakpointsCreateFromFile(self.bkpts_file_spec, copy_bps)
- self.assertTrue(error.Success(), "Failed reading breakpoints: %s"%(error.GetCString()))
+ self.assertSuccess(error, "Failed reading breakpoints")
self.assertEqual(copy_bps.GetSize(), 1, "Got one breakpoint from file.")
diff --git a/lldb/test/API/functionalities/dlopen_other_executable/TestDlopenOtherExecutable.py b/lldb/test/API/functionalities/dlopen_other_executable/TestDlopenOtherExecutable.py
index cc0754fb92b7b..1b9135aa6be2e 100644
--- a/lldb/test/API/functionalities/dlopen_other_executable/TestDlopenOtherExecutable.py
+++ b/lldb/test/API/functionalities/dlopen_other_executable/TestDlopenOtherExecutable.py
@@ -39,7 +39,7 @@ def test(self):
# Kill the process and run the program again.
err = self.process().Kill()
- self.assertTrue(err.Success(), str(err))
+ self.assertSuccess(err)
# Test that we hit the breakpoint after dlopen.
lldbutil.run_to_breakpoint_do_run(self, self.target(), breakpoint)
diff --git a/lldb/test/API/functionalities/dyld-launch-linux/TestDyldLaunchLinux.py b/lldb/test/API/functionalities/dyld-launch-linux/TestDyldLaunchLinux.py
index 9abe7f9e5e6bd..7782f9739e71e 100644
--- a/lldb/test/API/functionalities/dyld-launch-linux/TestDyldLaunchLinux.py
+++ b/lldb/test/API/functionalities/dyld-launch-linux/TestDyldLaunchLinux.py
@@ -40,7 +40,7 @@ def test(self):
launch_info.SetWorkingDirectory(self.get_process_working_directory())
error = lldb.SBError()
process = target.Launch(launch_info, error)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
# Stopped on main here.
self.assertEqual(process.GetState(), lldb.eStateStopped)
diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
index 8d12bd7247b60..8412215a140dc 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
@@ -515,7 +515,7 @@ def cont(self):
process = self.connect(target)
siginfo = process.threads[0].GetSiginfo()
- self.assertTrue(siginfo.GetError().Success(), siginfo.GetError())
+ self.assertSuccess(siginfo.GetError())
for key, value in expected.items():
self.assertEqual(siginfo.GetValueForExpressionPath("." + key)
diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py b/lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
index 3b7488933ba59..e1998fbdbe1e0 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
@@ -192,7 +192,7 @@ def QListThreadsInStopReply(self):
data = lldb.SBData()
data.SetData(error, val, lldb.eByteOrderBig, 4)
self.assertEqual(r1_valobj.SetData(data, error), True)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
r1_valobj = process.GetThreadAtIndex(0).GetFrameAtIndex(0).FindRegister("r1")
self.assertEqual(r1_valobj.GetValueAsUnsigned(), 0x11223344)
diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestMemoryRegionDirtyPages.py b/lldb/test/API/functionalities/gdb_remote_client/TestMemoryRegionDirtyPages.py
index 81cc8f5f8364b..88bc300fb772e 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestMemoryRegionDirtyPages.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestMemoryRegionDirtyPages.py
@@ -37,14 +37,14 @@ def qMemoryRegionInfo(self, addr):
# A memory region where we don't know anything about dirty pages
region = lldb.SBMemoryRegionInfo()
err = process.GetMemoryRegionInfo(0, region)
- self.assertTrue(err.Success())
+ self.assertSuccess(err)
self.assertFalse(region.HasDirtyMemoryPageList())
self.assertEqual(region.GetNumDirtyPages(), 0)
region.Clear()
# A memory region with dirty page information -- and zero dirty pages
err = process.GetMemoryRegionInfo(0x100000000, region)
- self.assertTrue(err.Success())
+ self.assertSuccess(err)
self.assertTrue(region.HasDirtyMemoryPageList())
self.assertEqual(region.GetNumDirtyPages(), 0)
self.assertEqual(region.GetPageSize(), 4096)
@@ -52,7 +52,7 @@ def qMemoryRegionInfo(self, addr):
# A memory region with one dirty page
err = process.GetMemoryRegionInfo(0x100004000, region)
- self.assertTrue(err.Success())
+ self.assertSuccess(err)
self.assertTrue(region.HasDirtyMemoryPageList())
self.assertEqual(region.GetNumDirtyPages(), 1)
self.assertEqual(region.GetDirtyPageAddressAtIndex(0), 0x100004000)
@@ -60,7 +60,7 @@ def qMemoryRegionInfo(self, addr):
# A memory region with multple dirty pages
err = process.GetMemoryRegionInfo(0x1000a2000, region)
- self.assertTrue(err.Success())
+ self.assertSuccess(err)
self.assertTrue(region.HasDirtyMemoryPageList())
self.assertEqual(region.GetNumDirtyPages(), 5)
self.assertEqual(region.GetDirtyPageAddressAtIndex(4), 0x1000a6000)
diff --git a/lldb/test/API/functionalities/launch_stop_at_entry/TestStopAtEntry.py b/lldb/test/API/functionalities/launch_stop_at_entry/TestStopAtEntry.py
index 4fbe7199267ef..32b78391aa22d 100644
--- a/lldb/test/API/functionalities/launch_stop_at_entry/TestStopAtEntry.py
+++ b/lldb/test/API/functionalities/launch_stop_at_entry/TestStopAtEntry.py
@@ -86,7 +86,7 @@ def cleanup ():
error = lldb.SBError()
process = target.Launch(launch_info, error)
- self.assertTrue(error.Success(), "Launch failed: {0}".format(error.description))
+ self.assertSuccess(error, "Launch failed")
# If we are asynchronous, we have to wait for the events:
if not synchronous:
listener = launch_info.GetListener()
@@ -106,7 +106,7 @@ def cleanup ():
# Now make sure that we can resume the process and have it exit.
error = process.Continue()
- self.assertTrue(error.Success(), "Error continuing: {0}".format(error.description))
+ self.assertSuccess(error, "Error continuing")
# Fetch events till we get eStateExited:
if not synchronous:
# Get events till exited.
diff --git a/lldb/test/API/functionalities/load_using_paths/TestLoadUsingPaths.py b/lldb/test/API/functionalities/load_using_paths/TestLoadUsingPaths.py
index ca7808c212795..f0c944146b214 100644
--- a/lldb/test/API/functionalities/load_using_paths/TestLoadUsingPaths.py
+++ b/lldb/test/API/functionalities/load_using_paths/TestLoadUsingPaths.py
@@ -85,7 +85,7 @@ def test_load_using_paths(self):
# Now see that we can call a function in the loaded module.
value = thread.frames[0].EvaluateExpression("d_function()", lldb.SBExpressionOptions())
- self.assertTrue(value.GetError().Success(), "Got a value from the expression")
+ self.assertSuccess(value.GetError(), "Got a value from the expression")
ret_val = value.GetValueAsSigned()
self.assertEqual(ret_val, 12345, "Got the right value")
diff --git a/lldb/test/API/functionalities/paths/TestPaths.py b/lldb/test/API/functionalities/paths/TestPaths.py
index da26da28a562e..9cc5e75913a21 100644
--- a/lldb/test/API/functionalities/paths/TestPaths.py
+++ b/lldb/test/API/functionalities/paths/TestPaths.py
@@ -49,7 +49,7 @@ def test_interpreter_info(self):
info_sd = self.dbg.GetScriptInterpreterInfo(self.dbg.GetScriptingLanguage("python"))
self.assertTrue(info_sd.IsValid())
stream = lldb.SBStream()
- self.assertTrue(info_sd.GetAsJSON(stream).Success())
+ self.assertSuccess(info_sd.GetAsJSON(stream))
info = json.loads(stream.GetData())
prefix = info['prefix']
self.assertEqual(os.path.realpath(sys.prefix), os.path.realpath(prefix))
diff --git a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
index aadb6f63fb5e8..46ecf2e5faeb8 100644
--- a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -109,7 +109,7 @@ def test_two_cores_same_pid(self):
error = lldb.SBError()
F = altprocess.ReadCStringFromMemory(
altframe.FindVariable("F").GetValueAsUnsigned(), 256, error)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
self.assertEqual(F, "_start")
# without destroying this process, run the test which opens another core file with the
diff --git a/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py b/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
index 1acd2262d9074..7ada036443d17 100644
--- a/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ b/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -65,7 +65,7 @@ def test_loadcore_error_status(self):
error = lldb.SBError()
self.process = self.target.LoadCore(minidump_path, error)
self.assertTrue(self.process, PROCESS_IS_VALID)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
def test_loadcore_error_status_failure(self):
"""Test the SBTarget.LoadCore(core, error) overload."""
diff --git a/lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py b/lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py
index 15031ce563c7f..6fbb59ad210d3 100644
--- a/lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py
+++ b/lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py
@@ -123,7 +123,7 @@ def test_deeper_stack_in_mini_dump(self):
self.assertEqual(process.GetState(), lldb.eStateStopped)
self.assertTrue(process.SaveCore(core))
self.assertTrue(os.path.isfile(core))
- self.assertTrue(process.Kill().Success())
+ self.assertSuccess(process.Kill())
# Launch with the mini dump, and inspect the stack.
target = self.dbg.CreateTarget(None)
@@ -159,7 +159,7 @@ def test_local_variables_in_mini_dump(self):
self.assertEqual(process.GetState(), lldb.eStateStopped)
self.assertTrue(process.SaveCore(core))
self.assertTrue(os.path.isfile(core))
- self.assertTrue(process.Kill().Success())
+ self.assertSuccess(process.Kill())
# Launch with the mini dump, and inspect a local variable.
target = self.dbg.CreateTarget(None)
diff --git a/lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py b/lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py
index 13579628ca8e9..0681a3f8c969e 100644
--- a/lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py
+++ b/lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py
@@ -63,7 +63,7 @@ def test_api(self):
error = crash_info.GetAsJSON(stream)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
self.assertTrue(crash_info.IsValid())
diff --git a/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py b/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
index 42955975a71b8..c7111db5d78b6 100644
--- a/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
+++ b/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
@@ -43,7 +43,7 @@ def test_save_windows_mini_dump(self):
self.assertEqual(process.GetState(), lldb.eStateStopped)
self.assertTrue(process.SaveCore(core))
self.assertTrue(os.path.isfile(core))
- self.assertTrue(process.Kill().Success())
+ self.assertSuccess(process.Kill())
# To verify, we'll launch with the mini dump, and ensure that we see
# the executable in the module list.
@@ -77,7 +77,7 @@ def test_save_core_via_process_plugin(self):
self.assertEqual(process.GetState(), lldb.eStateStopped)
self.assertTrue(process.SaveCore(core))
self.assertTrue(os.path.isfile(core))
- self.assertTrue(process.Kill().Success())
+ self.assertSuccess(process.Kill())
pid = process.GetProcessID()
target = self.dbg.CreateTarget(None)
diff --git a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
index 8d9c12c7ffe61..a7d2a05964a4b 100644
--- a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
+++ b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
@@ -43,7 +43,7 @@ def test_save_linux_mini_dump(self):
# save core and, kill process and verify corefile existence
self.runCmd("process save-core --plugin-name=minidump --style=stack " + core)
self.assertTrue(os.path.isfile(core))
- self.assertTrue(process.Kill().Success())
+ self.assertSuccess(process.Kill())
# To verify, we'll launch with the mini dump
target = self.dbg.CreateTarget(None)
diff --git a/lldb/test/API/functionalities/return-value/TestReturnValue.py b/lldb/test/API/functionalities/return-value/TestReturnValue.py
index 54abfe46c5607..002f7fb50d10c 100644
--- a/lldb/test/API/functionalities/return-value/TestReturnValue.py
+++ b/lldb/test/API/functionalities/return-value/TestReturnValue.py
@@ -50,7 +50,7 @@ def test_with_python(self):
# inner_sint returns the variable value, so capture that here:
in_int = thread.GetFrameAtIndex(0).FindVariable(
"value").GetValueAsSigned(error)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
thread.StepOut()
@@ -65,7 +65,7 @@ def test_with_python(self):
self.assertTrue(return_value.IsValid())
ret_int = return_value.GetValueAsSigned(error)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
self.assertEquals(in_int, ret_int)
# Run again and we will stop in inner_sint the second time outer_sint is called.
@@ -82,7 +82,7 @@ def test_with_python(self):
fun_name = frame.GetFunctionName()
self.assertEquals(fun_name, "outer_sint(int)")
in_int = frame.FindVariable("value").GetValueAsSigned(error)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
thread.StepOutOfFrame(frame)
@@ -95,7 +95,7 @@ def test_with_python(self):
ret_value = thread.GetStopReturnValue()
self.assertTrue(return_value.IsValid())
ret_int = ret_value.GetValueAsSigned(error)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
self.assertEquals(2 * in_int, ret_int)
# Now try some simple returns that have
diff erent types:
diff --git a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
index 4f0981d8f3ac4..d21326321ef0e 100644
--- a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
+++ b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
@@ -70,7 +70,7 @@ def cleanup():
process = target.Launch(launch_info, error)
- self.assertTrue(error.Success(), error.GetCString())
+ self.assertSuccess(error)
self.assertTrue(process, PROCESS_IS_VALID)
self.assertEqual(process.GetProcessID(), 666)
self.assertEqual(process.GetNumThreads(), 0)
diff --git a/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py b/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
index 61b0c4fd16b1a..3f4222fe3b79c 100644
--- a/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
+++ b/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
@@ -48,7 +48,7 @@ def test_launch_scripted_process_stack_frames(self):
self.assertTrue(main_module, "Invalid main module.")
error = target.SetModuleLoadAddress(main_module, 0)
- self.assertTrue(error.Success(), "Reloading main module at offset 0 failed.")
+ self.assertSuccess(error, "Reloading main module at offset 0 failed.")
os.environ['SKIP_SCRIPTED_PROCESS_LAUNCH'] = '1'
def cleanup():
@@ -77,7 +77,7 @@ def cleanup():
error = lldb.SBError()
process = target.Launch(launch_info, error)
- self.assertTrue(error.Success(), error.GetCString())
+ self.assertSuccess(error)
self.assertTrue(process, PROCESS_IS_VALID)
self.assertEqual(process.GetProcessID(), 42)
diff --git a/lldb/test/API/functionalities/step_scripted/TestStepScripted.py b/lldb/test/API/functionalities/step_scripted/TestStepScripted.py
index 419e46f05a254..dc4e83fd57a38 100644
--- a/lldb/test/API/functionalities/step_scripted/TestStepScripted.py
+++ b/lldb/test/API/functionalities/step_scripted/TestStepScripted.py
@@ -39,7 +39,7 @@ def step_out_with_scripted_plan(self, name):
self.assertEqual("foo", frame.GetFunctionName())
err = thread.StepUsingScriptedThreadPlan(name)
- self.assertTrue(err.Success(), err.GetCString())
+ self.assertSuccess(err)
frame = thread.GetFrameAtIndex(0)
self.assertEqual("main", frame.GetFunctionName())
@@ -80,7 +80,7 @@ def do_test_checking_variable(self, use_cli):
frame = thread.GetFrameAtIndex(0)
self.assertEqual("foo", frame.GetFunctionName())
foo_val = frame.FindVariable("foo")
- self.assertTrue(foo_val.GetError().Success(), "Got the foo variable")
+ self.assertSuccess(foo_val.GetError(), "Got the foo variable")
self.assertEqual(foo_val.GetValueAsUnsigned(), 10, "foo starts at 10")
if use_cli:
@@ -94,10 +94,10 @@ def do_test_checking_variable(self, use_cli):
data = lldb.SBStream()
data.Print('{"variable_name" : "foo"}')
error = args_data.SetFromJSON(data)
- self.assertTrue(error.Success(), "Made the args_data correctly")
+ self.assertSuccess(error, "Made the args_data correctly")
err = thread.StepUsingScriptedThreadPlan("Steps.StepUntil", args_data, True)
- self.assertTrue(err.Success(), err.GetCString())
+ self.assertSuccess(err)
# We should not have exited:
self.assertEqual(process.GetState(), lldb.eStateStopped, "We are stopped")
diff --git a/lldb/test/API/functionalities/thread/exit_during_expression/TestExitDuringExpression.py b/lldb/test/API/functionalities/thread/exit_during_expression/TestExitDuringExpression.py
index 63b11f9e8fe1e..031ba14ba1837 100644
--- a/lldb/test/API/functionalities/thread/exit_during_expression/TestExitDuringExpression.py
+++ b/lldb/test/API/functionalities/thread/exit_during_expression/TestExitDuringExpression.py
@@ -72,7 +72,7 @@ def exiting_expression_test(self, before_one_thread_timeout , unwind):
error = lldb.SBError()
timeout_value = g_timeout.GetValueAsUnsigned(error)
- self.assertTrue(error.Success(), "Couldn't get timeout value: %s"%(error.GetCString()))
+ self.assertSuccess(error, "Couldn't get timeout value")
one_thread_timeout = 0
if (before_one_thread_timeout):
@@ -105,7 +105,7 @@ def exiting_expression_test(self, before_one_thread_timeout , unwind):
# Now get the return value, if we successfully caused the thread to exit
# it should be 10, not 20.
ret_val = frame.FindVariable("ret_val")
- self.assertTrue(ret_val.GetError().Success(), "Found ret_val")
+ self.assertSuccess(ret_val.GetError(), "Found ret_val")
ret_val_value = ret_val.GetValueAsSigned(error)
- self.assertTrue(error.Success(), "Got ret_val's value")
+ self.assertSuccess(error, "Got ret_val's value")
self.assertEqual(ret_val_value, 10, "We put the right value in ret_val")
diff --git a/lldb/test/API/functionalities/thread/state_after_expression/TestStateAfterExpression.py b/lldb/test/API/functionalities/thread/state_after_expression/TestStateAfterExpression.py
index b998917f3baa0..a24058ba8f1f0 100644
--- a/lldb/test/API/functionalities/thread/state_after_expression/TestStateAfterExpression.py
+++ b/lldb/test/API/functionalities/thread/state_after_expression/TestStateAfterExpression.py
@@ -43,8 +43,7 @@ def do_test(self):
options.SetStopOthers(True)
result = thread.frames[0].EvaluateExpression('(int) printf("Hello\\n")', options)
- self.assertTrue(result.GetError().Success(),
- "Expression failed: '%s'"%(result.GetError().GetCString()))
+ self.assertSuccess(result.GetError(), "Expression failed")
stop_reason = other_thread.GetStopReason()
diff --git a/lldb/test/API/functionalities/var_path/TestVarPath.py b/lldb/test/API/functionalities/var_path/TestVarPath.py
index e155c25f1dfea..ca05e4a7d006a 100644
--- a/lldb/test/API/functionalities/var_path/TestVarPath.py
+++ b/lldb/test/API/functionalities/var_path/TestVarPath.py
@@ -24,7 +24,7 @@ def test_frame_var(self):
def verify_point(self, frame, var_name, var_typename, x_value, y_value):
v = frame.GetValueForVariablePath(var_name)
- self.assertTrue(v.GetError().Success(), "Make sure we find '%s'" % (var_name))
+ self.assertSuccess(v.GetError(), "Make sure we find '%s'" % (var_name))
self.assertEquals(v.GetType().GetName(), var_typename,
"Make sure '%s' has type '%s'" % (var_name, var_typename))
@@ -42,14 +42,14 @@ def verify_point(self, frame, var_name, var_typename, x_value, y_value):
invalid_m_path = invalid_prefix + 'm'
v = frame.GetValueForVariablePath(valid_x_path)
- self.assertTrue(v.GetError().Success(), "Make sure we find '%s'" % (valid_x_path))
+ self.assertSuccess(v.GetError(), "Make sure we find '%s'" % (valid_x_path))
self.assertEquals(v.GetValue(), str(x_value), "Make sure '%s' has a value of %i" % (valid_x_path, x_value))
self.assertEquals(v.GetType().GetName(), "int", "Make sure '%s' has type 'int'" % (valid_x_path))
v = frame.GetValueForVariablePath(invalid_x_path)
self.assertTrue(v.GetError().Fail(), "Make sure we don't find '%s'" % (invalid_x_path))
v = frame.GetValueForVariablePath(valid_y_path)
- self.assertTrue(v.GetError().Success(), "Make sure we find '%s'" % (valid_y_path))
+ self.assertSuccess(v.GetError(), "Make sure we find '%s'" % (valid_y_path))
self.assertEquals(v.GetValue(), str(y_value), "Make sure '%s' has a value of %i" % (valid_y_path, y_value))
self.assertEquals(v.GetType().GetName(), "int", "Make sure '%s' has type 'int'" % (valid_y_path))
v = frame.GetValueForVariablePath(invalid_y_path)
@@ -76,8 +76,7 @@ def do_test(self):
self.verify_point(frame, 'pt_ptr[1]', 'Point', 5050, 6060)
# Test arrays
v = frame.GetValueForVariablePath('points')
- self.assertTrue(v.GetError().Success(),
- "Make sure we find 'points'")
+ self.assertSuccess(v.GetError(), "Make sure we find 'points'")
self.verify_point(frame, 'points[0]', 'Point', 1010, 2020)
self.verify_point(frame, 'points[1]', 'Point', 3030, 4040)
self.verify_point(frame, 'points[2]', 'Point', 5050, 6060)
@@ -87,7 +86,7 @@ def do_test(self):
# Test a reference
self.verify_point(frame, 'pt_ref', 'Point &', 1, 2)
v = frame.GetValueForVariablePath('pt_sp')
- self.assertTrue(v.GetError().Success(), "Make sure we find 'pt_sp'")
+ self.assertSuccess(v.GetError(), "Make sure we find 'pt_sp'")
# Make sure we don't crash when looking for non existant child
# in type with synthetic children. This used to cause a crash.
v = frame.GetValueForVariablePath('pt_sp->not_valid_child')
diff --git a/lldb/test/API/lang/c/local_types/TestUseClosestType.py b/lldb/test/API/lang/c/local_types/TestUseClosestType.py
index 2b8307ace0fbc..13a69a30aeafc 100644
--- a/lldb/test/API/lang/c/local_types/TestUseClosestType.py
+++ b/lldb/test/API/lang/c/local_types/TestUseClosestType.py
@@ -29,7 +29,7 @@ def test_use_in_expr(self):
def run_and_check_expr(self, num_children, child_type):
frame = self.thread.GetFrameAtIndex(0)
result = frame.EvaluateExpression("struct Foo *$mine = (struct Foo *) malloc(sizeof(struct Foo)); $mine")
- self.assertTrue(result.GetError().Success(), "Failed to parse an expression using a multiply defined type: %s"%(result.GetError().GetCString()), )
+ self.assertSuccess(result.GetError(), "Failed to parse an expression using a multiply defined type")
self.assertEqual(result.GetTypeName(), "struct Foo *", "The result has the right typename.")
self.assertEqual(result.GetNumChildren(), num_children, "Got the right number of children")
self.assertEqual(result.GetChildAtIndex(0).GetTypeName(), child_type, "Got the right type.")
diff --git a/lldb/test/API/lang/cpp/incomplete-types/TestCppIncompleteTypes.py b/lldb/test/API/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
index 7ce2e343b88fa..6ebd67d26968d 100644
--- a/lldb/test/API/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
+++ b/lldb/test/API/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
@@ -17,13 +17,13 @@ def test_limit_debug_info(self):
self.assertTrue(
value_f.IsValid(),
"'expr f' results in a valid SBValue object")
- self.assertTrue(value_f.GetError().Success(), "'expr f' is successful")
+ self.assertSuccess(value_f.GetError(), "'expr f' is successful")
value_a = frame.EvaluateExpression("a")
self.assertTrue(
value_a.IsValid(),
"'expr a' results in a valid SBValue object")
- self.assertTrue(value_a.GetError().Success(), "'expr a' is successful")
+ self.assertSuccess(value_a.GetError(), "'expr a' is successful")
@skipIf(compiler="gcc")
# Clang on Windows asserts in external record layout in this case.
@@ -36,13 +36,13 @@ def test_partial_limit_debug_info(self):
self.assertTrue(
value_f.IsValid(),
"'expr f' results in a valid SBValue object")
- self.assertTrue(value_f.GetError().Success(), "'expr f' is successful")
+ self.assertSuccess(value_f.GetError(), "'expr f' is successful")
value_a = frame.EvaluateExpression("a")
self.assertTrue(
value_a.IsValid(),
"'expr a' results in a valid SBValue object")
- self.assertTrue(value_a.GetError().Success(), "'expr a' is successful")
+ self.assertSuccess(value_a.GetError(), "'expr a' is successful")
def get_test_frame(self, exe):
# Get main source file
diff --git a/lldb/test/API/lang/cpp/trivial_abi/TestTrivialABI.py b/lldb/test/API/lang/cpp/trivial_abi/TestTrivialABI.py
index 157a9e183a6a0..16e078ebe2801 100644
--- a/lldb/test/API/lang/cpp/trivial_abi/TestTrivialABI.py
+++ b/lldb/test/API/lang/cpp/trivial_abi/TestTrivialABI.py
@@ -38,9 +38,9 @@ def test_call_nontrivial(self):
self.expr_test(False)
def check_value(self, test_var, ivar_value):
- self.assertTrue(test_var.GetError().Success(), "Invalid valobj: %s"%(test_var.GetError().GetCString()))
+ self.assertSuccess(test_var.GetError(), "Invalid valobj")
ivar = test_var.GetChildMemberWithName("ivar")
- self.assertTrue(test_var.GetError().Success(), "Failed to fetch ivar")
+ self.assertSuccess(test_var.GetError(), "Failed to fetch ivar")
self.assertEqual(ivar_value, ivar.GetValueAsSigned(), "Got the right value for ivar")
def check_frame(self, thread):
diff --git a/lldb/test/API/lang/cpp/type_lookup/TestCppTypeLookup.py b/lldb/test/API/lang/cpp/type_lookup/TestCppTypeLookup.py
index 45be73118f8f3..acbc8bee33673 100644
--- a/lldb/test/API/lang/cpp/type_lookup/TestCppTypeLookup.py
+++ b/lldb/test/API/lang/cpp/type_lookup/TestCppTypeLookup.py
@@ -14,12 +14,10 @@ class TestCppTypeLookup(TestBase):
mydir = TestBase.compute_mydir(__file__)
def check_value(self, value, ivar_name, ivar_value):
- self.assertTrue(value.GetError().Success(),
- "Invalid valobj: %s" % (
- value.GetError().GetCString()))
+ self.assertSuccess(value.GetError(), "Invalid valobj")
ivar = value.GetChildMemberWithName(ivar_name)
- self.assertTrue(ivar.GetError().Success(),
- "Failed to fetch ivar named '%s'" % (ivar_name))
+ self.assertSuccess(ivar.GetError(),
+ "Failed to fetch ivar named '%s'" % (ivar_name))
self.assertEqual(ivar_value,
ivar.GetValueAsSigned(),
"Got the right value for ivar")
diff --git a/lldb/test/API/lang/objc/blocks/TestObjCIvarsInBlocks.py b/lldb/test/API/lang/objc/blocks/TestObjCIvarsInBlocks.py
index f1dbb95dea33d..fcefdf0e8341e 100644
--- a/lldb/test/API/lang/objc/blocks/TestObjCIvarsInBlocks.py
+++ b/lldb/test/API/lang/objc/blocks/TestObjCIvarsInBlocks.py
@@ -68,10 +68,10 @@ def test_with_python_api(self):
error = lldb.SBError()
direct_value = direct_blocky.GetValueAsSigned(error)
- self.assertTrue(error.Success(), "Got direct value for blocky_ivar")
+ self.assertSuccess(error, "Got direct value for blocky_ivar")
indirect_value = indirect_blocky.GetValueAsSigned(error)
- self.assertTrue(error.Success(), "Got indirect value for blocky_ivar")
+ self.assertSuccess(error, "Got indirect value for blocky_ivar")
self.assertEqual(
direct_value, indirect_value,
diff --git a/lldb/test/API/lang/objc/global_ptrs/TestGlobalObjects.py b/lldb/test/API/lang/objc/global_ptrs/TestGlobalObjects.py
index 418c7653c3d84..1f88884ce6f8c 100644
--- a/lldb/test/API/lang/objc/global_ptrs/TestGlobalObjects.py
+++ b/lldb/test/API/lang/objc/global_ptrs/TestGlobalObjects.py
@@ -31,7 +31,7 @@ def test_with_python_api(self):
# Before we launch, make an SBValue for our global object pointer:
g_obj_ptr = target.FindFirstGlobalVariable("g_obj_ptr")
- self.assertTrue(g_obj_ptr.GetError().Success(), "Made the g_obj_ptr")
+ self.assertSuccess(g_obj_ptr.GetError(), "Made the g_obj_ptr")
self.assertEqual(
g_obj_ptr.GetValueAsUnsigned(10), 0,
"g_obj_ptr is initially null")
diff --git a/lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py b/lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py
index 054b4d7cfa5ec..090210d447c35 100644
--- a/lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py
+++ b/lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py
@@ -85,5 +85,5 @@ def test_objc_checker(self):
expr_value = frame.EvaluateExpression("[my_simple getBigStruct]", False)
expr_error = expr_value.GetError()
- self.assertTrue(expr_error.Success())
+ self.assertSuccess(expr_error)
diff --git a/lldb/test/API/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py b/lldb/test/API/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
index f0691b66ce63a..9f9e5d12aa701 100644
--- a/lldb/test/API/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
+++ b/lldb/test/API/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
@@ -60,7 +60,7 @@ def test_with_python_api(self):
mine_backed_int,
"Found mine->backed_int local variable.")
backed_value = mine_backed_int.GetValueAsSigned(error)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
self.assertEquals(backed_value, 1111)
# Test the value object value for DerivedClass->_derived_backed_int
@@ -70,7 +70,7 @@ def test_with_python_api(self):
self.assertTrue(mine_derived_backed_int,
"Found mine->derived_backed_int local variable.")
derived_backed_value = mine_derived_backed_int.GetValueAsSigned(error)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
self.assertEquals(derived_backed_value, 3333)
# Make sure we also get bit-field offsets correct:
@@ -78,5 +78,5 @@ def test_with_python_api(self):
mine_flag2 = mine.GetChildMemberWithName("flag2")
self.assertTrue(mine_flag2, "Found mine->flag2 local variable.")
flag2_value = mine_flag2.GetValueAsUnsigned(error)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
self.assertEquals(flag2_value, 7)
diff --git a/lldb/test/API/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py b/lldb/test/API/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py
index 41f21f95fbec1..bc14acc2b6fe0 100644
--- a/lldb/test/API/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py
+++ b/lldb/test/API/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py
@@ -62,5 +62,5 @@ def test_with_python_api(self):
ivar = frame.EvaluateExpression("(mc->_foo)")
self.assertTrue(ivar, "Got result for mc->_foo")
ivar_value = ivar.GetValueAsSigned(error)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
self.assertEquals(ivar_value, 3)
diff --git a/lldb/test/API/lang/objc/objc-property/TestObjCProperty.py b/lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
index 25158a58a786b..13e3fc7e91d4d 100644
--- a/lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
+++ b/lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
@@ -71,7 +71,7 @@ def test_objc_properties(self):
nonexistant_value = frame.EvaluateExpression(
"mine.nonexistantInt", False)
nonexistant_error = nonexistant_value.GetError()
- self.assertTrue(nonexistant_error.Success())
+ self.assertSuccess(nonexistant_error)
nonexistant_int = nonexistant_value.GetValueAsUnsigned(123456)
self.assertEquals(nonexistant_int, 6)
@@ -87,7 +87,7 @@ def test_objc_properties(self):
nonexistant_change = frame.EvaluateExpression(
"mine.nonexistantInt = 10", False)
nonexistant_error = nonexistant_change.GetError()
- self.assertTrue(nonexistant_error.Success())
+ self.assertSuccess(nonexistant_error)
# Calling the setter function would up the access count, so make sure
# that happened.
@@ -103,39 +103,39 @@ def test_objc_properties(self):
backed_value = frame.EvaluateExpression("mine.backedInt", False)
backed_error = backed_value.GetError()
- self.assertTrue(backed_error.Success())
+ self.assertSuccess(backed_error)
backing_value = mine.GetChildMemberWithName("_backedInt")
self.assertTrue(backing_value.IsValid())
self.assertTrue(backed_value.GetValueAsUnsigned(12345)
== backing_value.GetValueAsUnsigned(23456))
value_from_typedef = frame.EvaluateExpression("typedefd.backedInt", False)
- self.assertTrue(value_from_typedef.GetError().Success())
+ self.assertSuccess(value_from_typedef.GetError())
self.assertEqual(value_from_typedef.GetValueAsUnsigned(12345),
backing_value.GetValueAsUnsigned(23456))
unbacked_value = frame.EvaluateExpression("mine.unbackedInt", False)
unbacked_error = unbacked_value.GetError()
- self.assertTrue(unbacked_error.Success())
+ self.assertSuccess(unbacked_error)
idWithProtocol_value = frame.EvaluateExpression(
"mine.idWithProtocol", False)
idWithProtocol_error = idWithProtocol_value.GetError()
- self.assertTrue(idWithProtocol_error.Success())
+ self.assertSuccess(idWithProtocol_error)
self.assertEquals(idWithProtocol_value.GetTypeName(), "id")
# Make sure that class property getter works as expected
value = frame.EvaluateExpression("BaseClass.classInt", False)
- self.assertTrue(value.GetError().Success())
+ self.assertSuccess(value.GetError())
self.assertEquals(value.GetValueAsUnsigned(11111), 123)
# Make sure that class property setter works as expected
value = frame.EvaluateExpression("BaseClass.classInt = 234", False)
- self.assertTrue(value.GetError().Success())
+ self.assertSuccess(value.GetError())
# Verify that setter above actually worked
value = frame.EvaluateExpression("BaseClass.classInt", False)
- self.assertTrue(value.GetError().Success())
+ self.assertSuccess(value.GetError())
self.assertEquals(value.GetValueAsUnsigned(11111), 234)
# Test that accessing two distinct class and instance properties that
diff --git a/lldb/test/API/linux/aarch64/unwind_signal/TestUnwindSignal.py b/lldb/test/API/linux/aarch64/unwind_signal/TestUnwindSignal.py
index 7f7b079543629..8104428c54d07 100644
--- a/lldb/test/API/linux/aarch64/unwind_signal/TestUnwindSignal.py
+++ b/lldb/test/API/linux/aarch64/unwind_signal/TestUnwindSignal.py
@@ -64,8 +64,7 @@ def test_unwind_signal(self):
for i in range(31):
name = 'x{}'.format(i)
value = regs.GetChildMemberWithName(name).GetValueAsUnsigned(err)
- self.assertTrue(err.Success(), "Failed to get register {}: {}".format(
- name, err))
+ self.assertSuccess(err, "Failed to get register {}".format(name))
self.assertEqual(value, i, "Unexpected value for register {}".format(
name))
diff --git a/lldb/test/API/macosx/function-starts/TestFunctionStarts.py b/lldb/test/API/macosx/function-starts/TestFunctionStarts.py
index ce599851293c7..72688d80e7cd4 100644
--- a/lldb/test/API/macosx/function-starts/TestFunctionStarts.py
+++ b/lldb/test/API/macosx/function-starts/TestFunctionStarts.py
@@ -62,7 +62,7 @@ def do_function_starts(self, in_memory):
attach_info.SetProcessID(popen.pid)
attach_info.SetIgnoreExisting(False)
process = target.Attach(attach_info, error)
- self.assertTrue(error.Success(), "Didn't attach successfully to %d: %s"%(popen.pid, error.GetCString()))
+ self.assertSuccess(error, "Didn't attach successfully to %d"%(popen.pid))
bkpt = target.BreakpointCreateByName("dont_strip_me", exe)
self.assertTrue(bkpt.GetNumLocations() > 0, "Didn't set the dont_strip_me bkpt.")
diff --git a/lldb/test/API/macosx/profile_vrs_detach/TestDetachVrsProfile.py b/lldb/test/API/macosx/profile_vrs_detach/TestDetachVrsProfile.py
index 95d73de9d6577..c89fbccb1e39f 100644
--- a/lldb/test/API/macosx/profile_vrs_detach/TestDetachVrsProfile.py
+++ b/lldb/test/API/macosx/profile_vrs_detach/TestDetachVrsProfile.py
@@ -73,4 +73,4 @@ def cleanup():
# Now detach:
error = process.Detach()
- self.assertTrue(error.Success(), "Detached successfully")
+ self.assertSuccess(error, "Detached successfully")
diff --git a/lldb/test/API/macosx/thread_suspend/TestInternalThreadSuspension.py b/lldb/test/API/macosx/thread_suspend/TestInternalThreadSuspension.py
index 301b80058d3d8..66128585ceb3a 100644
--- a/lldb/test/API/macosx/thread_suspend/TestInternalThreadSuspension.py
+++ b/lldb/test/API/macosx/thread_suspend/TestInternalThreadSuspension.py
@@ -34,7 +34,7 @@ def try_an_expression(self, thread, correct_value, test_bp):
frame = thread.frames[0]
value = frame.EvaluateExpression('function_to_call()')
- self.assertTrue(value.GetError().Success(), "Successfully called the function")
+ self.assertSuccess(value.GetError(), "Successfully called the function")
self.assertEqual(value.GetValueAsSigned(), correct_value, "Got expected value for expression")
# Again, make sure we didn't let the suspend thread breakpoint run:
diff --git a/lldb/test/API/macosx/universal/TestUniversal.py b/lldb/test/API/macosx/universal/TestUniversal.py
index 94e6ac97c4f65..cb7a5c44da908 100644
--- a/lldb/test/API/macosx/universal/TestUniversal.py
+++ b/lldb/test/API/macosx/universal/TestUniversal.py
@@ -142,7 +142,7 @@ def test_process_attach_with_wrong_arch(self):
empty_listener = lldb.SBListener()
process = target.AttachToProcessWithID(
empty_listener, popen.pid, error)
- self.assertTrue(error.Success(), "Attached to process.")
+ self.assertSuccess(error, "Attached to process.")
self.expect("image list -A -b", substrs=["x86_64h testit"])
diff --git a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
index f9fe64d3a4d0d..0a19945af1097 100644
--- a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
+++ b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
@@ -81,8 +81,8 @@ def get_cache_line_size():
error = self.dbg.SetInternalVariable(property_name,
str(new_cache_line_size),
self.dbg.GetInstanceName())
- self.assertTrue(error.Success(),
- property_name + " value was changed successfully")
+ self.assertSuccess(error,
+ property_name + " value was changed successfully")
# Check that it was set actually.
self.assertEqual(get_cache_line_size(), new_cache_line_size)
diff --git a/lldb/test/API/python_api/file_handle/TestFileHandle.py b/lldb/test/API/python_api/file_handle/TestFileHandle.py
index b9aee7a375608..023c1e99c6cef 100644
--- a/lldb/test/API/python_api/file_handle/TestFileHandle.py
+++ b/lldb/test/API/python_api/file_handle/TestFileHandle.py
@@ -183,7 +183,7 @@ def test_sbfile_write_fileno(self):
sbf = lldb.SBFile(f.fileno(), "w", False)
self.assertTrue(sbf.IsValid())
e, n = sbf.Write(b'FOO\nBAR')
- self.assertTrue(e.Success())
+ self.assertSuccess(e)
self.assertEqual(n, 7)
sbf.Close()
self.assertFalse(sbf.IsValid())
@@ -195,7 +195,7 @@ def test_sbfile_write(self):
with open(self.out_filename, 'w') as f:
sbf = lldb.SBFile(f)
e, n = sbf.Write(b'FOO\n')
- self.assertTrue(e.Success())
+ self.assertSuccess(e)
self.assertEqual(n, 4)
sbf.Close()
self.assertTrue(f.closed)
@@ -211,7 +211,7 @@ def test_sbfile_read_fileno(self):
self.assertTrue(sbf.IsValid())
buffer = bytearray(100)
e, n = sbf.Read(buffer)
- self.assertTrue(e.Success())
+ self.assertSuccess(e)
self.assertEqual(buffer[:n], b'FOO')
@@ -222,7 +222,7 @@ def test_sbfile_read(self):
sbf = lldb.SBFile(f)
buf = bytearray(100)
e, n = sbf.Read(buf)
- self.assertTrue(e.Success())
+ self.assertSuccess(e)
self.assertEqual(n, 3)
self.assertEqual(buf[:n], b'foo')
sbf.Close()
@@ -233,7 +233,7 @@ def test_fileno_out(self):
with open(self.out_filename, 'w') as f:
sbf = lldb.SBFile(f.fileno(), "w", False)
status = self.dbg.SetOutputFile(sbf)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.handleCmd('script 1+2')
self.dbg.GetOutputFile().Write(b'quux')
self.dbg.GetOutputFile().Flush()
@@ -246,7 +246,7 @@ def test_fileno_help(self):
with open(self.out_filename, 'w') as f:
sbf = lldb.SBFile(f.fileno(), "w", False)
status = self.dbg.SetOutputFile(sbf)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.handleCmd("help help", collect_result=False, check=False)
with open(self.out_filename, 'r') as f:
self.assertTrue(re.search(r'Show a list of all debugger commands', f.read()))
@@ -255,7 +255,7 @@ def test_fileno_help(self):
def test_help(self):
with open(self.out_filename, 'w') as f:
status = self.dbg.SetOutputFile(lldb.SBFile(f))
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.handleCmd("help help", check=False, collect_result=False)
with open(self.out_filename, 'r') as f:
self.assertIn('Show a list of all debugger commands', f.read())
@@ -313,11 +313,11 @@ def test_fileno_inout(self):
outsbf = lldb.SBFile(outf.fileno(), "w", False)
status = self.dbg.SetOutputFile(outsbf)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
insbf = lldb.SBFile(inf.fileno(), "r", False)
status = self.dbg.SetInputFile(insbf)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
opts = lldb.SBCommandInterpreterRunOptions()
self.dbg.RunCommandInterpreter(True, False, opts, 0, False, False)
@@ -333,9 +333,9 @@ def test_inout(self):
with open(self.out_filename, 'w') as outf, \
open(self.in_filename, 'r') as inf:
status = self.dbg.SetOutputFile(lldb.SBFile(outf))
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
status = self.dbg.SetInputFile(lldb.SBFile(inf))
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
opts = lldb.SBCommandInterpreterRunOptions()
self.dbg.RunCommandInterpreter(True, False, opts, 0, False, False)
self.dbg.GetOutputFile().Flush()
@@ -350,9 +350,9 @@ def test_binary_inout(self):
with open(self.out_filename, 'wb') as outf, \
open(self.in_filename, 'rb') as inf:
status = self.dbg.SetOutputFile(lldb.SBFile(outf))
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
status = self.dbg.SetInputFile(lldb.SBFile(inf))
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
opts = lldb.SBCommandInterpreterRunOptions()
self.dbg.RunCommandInterpreter(True, False, opts, 0, False, False)
self.dbg.GetOutputFile().Flush()
@@ -366,9 +366,9 @@ def test_string_inout(self):
inf = io.StringIO("help help\np/x ~0\n")
outf = io.StringIO()
status = self.dbg.SetOutputFile(lldb.SBFile(outf))
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
status = self.dbg.SetInputFile(lldb.SBFile(inf))
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
opts = lldb.SBCommandInterpreterRunOptions()
self.dbg.RunCommandInterpreter(True, False, opts, 0, False, False)
self.dbg.GetOutputFile().Flush()
@@ -382,9 +382,9 @@ def test_bytes_inout(self):
inf = io.BytesIO(b"help help\nhelp b\n")
outf = io.BytesIO()
status = self.dbg.SetOutputFile(lldb.SBFile(outf))
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
status = self.dbg.SetInputFile(lldb.SBFile(inf))
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
opts = lldb.SBCommandInterpreterRunOptions()
self.dbg.RunCommandInterpreter(True, False, opts, 0, False, False)
self.dbg.GetOutputFile().Flush()
@@ -398,7 +398,7 @@ def test_fileno_error(self):
sbf = lldb.SBFile(f.fileno(), 'w', False)
status = self.dbg.SetErrorFile(sbf)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.handleCmd('lolwut', check=False, collect_result=False)
@@ -437,7 +437,7 @@ def test_sbfile_write_borrowed(self):
with open(self.out_filename, 'w') as f:
sbf = lldb.SBFile.Create(f, borrow=True)
e, n = sbf.Write(b'FOO')
- self.assertTrue(e.Success())
+ self.assertSuccess(e)
self.assertEqual(n, 3)
sbf.Close()
self.assertFalse(f.closed)
@@ -459,7 +459,7 @@ def mywrite(x):
sbf = lldb.SBFile.Create(f, force_io_methods=True)
e, n = sbf.Write(b'FOO')
self.assertTrue(written)
- self.assertTrue(e.Success())
+ self.assertSuccess(e)
self.assertEqual(n, 3)
sbf.Close()
self.assertTrue(f.closed)
@@ -479,7 +479,7 @@ def mywrite(x):
sbf = lldb.SBFile.Create(f, borrow=True, force_io_methods=True)
e, n = sbf.Write(b'FOO')
self.assertTrue(written)
- self.assertTrue(e.Success())
+ self.assertSuccess(e)
self.assertEqual(n, 3)
sbf.Close()
self.assertFalse(f.closed)
@@ -493,7 +493,7 @@ def test_sbfile_write_string(self):
sbf = lldb.SBFile(f)
e, n = sbf.Write(b'FOO')
self.assertEqual(f.getvalue().strip(), "FOO")
- self.assertTrue(e.Success())
+ self.assertSuccess(e)
self.assertEqual(n, 3)
sbf.Close()
self.assertTrue(f.closed)
@@ -503,7 +503,7 @@ def test_sbfile_write_string(self):
def test_string_out(self):
f = io.StringIO()
status = self.dbg.SetOutputFile(f)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.handleCmd("script 'foobar'")
self.assertEqual(f.getvalue().strip(), "'foobar'")
@@ -512,7 +512,7 @@ def test_string_out(self):
def test_string_error(self):
f = io.StringIO()
status = self.dbg.SetErrorFile(f)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.handleCmd('lolwut', check=False, collect_result=False)
errors = f.getvalue()
self.assertTrue(re.search(r'error:.*lolwut', errors))
@@ -524,7 +524,7 @@ def test_sbfile_write_bytes(self):
sbf = lldb.SBFile(f)
e, n = sbf.Write(b'FOO')
self.assertEqual(f.getvalue().strip(), b"FOO")
- self.assertTrue(e.Success())
+ self.assertSuccess(e)
self.assertEqual(n, 3)
sbf.Close()
self.assertTrue(f.closed)
@@ -535,7 +535,7 @@ def test_sbfile_read_string(self):
sbf = lldb.SBFile(f)
buf = bytearray(100)
e, n = sbf.Read(buf)
- self.assertTrue(e.Success())
+ self.assertSuccess(e)
self.assertEqual(buf[:n], b'zork')
@@ -556,7 +556,7 @@ def test_sbfile_read_bytes(self):
sbf = lldb.SBFile(f)
buf = bytearray(100)
e, n = sbf.Read(buf)
- self.assertTrue(e.Success())
+ self.assertSuccess(e)
self.assertEqual(buf[:n], b'zork')
@@ -565,7 +565,7 @@ def test_sbfile_out(self):
with open(self.out_filename, 'w') as f:
sbf = lldb.SBFile(f)
status = self.dbg.SetOutputFile(sbf)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.handleCmd('script 2+2')
with open(self.out_filename, 'r') as f:
self.assertEqual(f.read().strip(), '4')
@@ -575,7 +575,7 @@ def test_sbfile_out(self):
def test_file_out(self):
with open(self.out_filename, 'w') as f:
status = self.dbg.SetOutputFile(f)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.handleCmd('script 2+2')
with open(self.out_filename, 'r') as f:
self.assertEqual(f.read().strip(), '4')
@@ -585,7 +585,7 @@ def test_sbfile_error(self):
with open(self.out_filename, 'w') as f:
sbf = lldb.SBFile(f)
status = self.dbg.SetErrorFile(sbf)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.handleCmd('lolwut', check=False, collect_result=False)
with open(self.out_filename, 'r') as f:
errors = f.read()
@@ -595,7 +595,7 @@ def test_sbfile_error(self):
def test_file_error(self):
with open(self.out_filename, 'w') as f:
status = self.dbg.SetErrorFile(f)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.handleCmd('lolwut', check=False, collect_result=False)
with open(self.out_filename, 'r') as f:
errors = f.read()
@@ -681,7 +681,7 @@ def test_fileno_flush(self):
def test_close(self):
with open(self.out_filename, 'w') as f:
status = self.dbg.SetOutputFile(f)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.handleCmd("help help", check=False, collect_result=False)
# make sure the file wasn't closed early.
f.write("\nZAP\n")
@@ -699,7 +699,7 @@ def test_close(self):
def test_stdout(self):
f = io.StringIO()
status = self.dbg.SetOutputFile(f)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.handleCmd(r"script sys.stdout.write('foobar\n')")
self.assertEqual(f.getvalue().strip().split(), ["foobar", "7"])
@@ -707,7 +707,7 @@ def test_stdout(self):
def test_stdout_file(self):
with open(self.out_filename, 'w') as f:
status = self.dbg.SetOutputFile(f)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.handleCmd(r"script sys.stdout.write('foobar\n')")
with open(self.out_filename, 'r') as f:
# In python2 sys.stdout.write() returns None, which
@@ -804,9 +804,9 @@ def test_set_filehandle_none(self):
with open(self.out_filename, 'w') as f:
status = self.dbg.SetOutputFile(f)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
status = self.dbg.SetErrorFile(f)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.dbg.SetOutputFileHandle(None, False)
self.dbg.SetErrorFileHandle(None, False)
sbf = self.dbg.GetOutputFile()
@@ -821,7 +821,7 @@ def test_set_filehandle_none(self):
self.assertEqual(sbf.GetFile().fileno(), 2)
with open(self.out_filename, 'r') as f:
status = self.dbg.SetInputFile(f)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.dbg.SetInputFileHandle(None, False)
sbf = self.dbg.GetInputFile()
if sys.version_info.major >= 3:
@@ -857,7 +857,7 @@ def test_set_sbstream(self):
with open(self.out_filename, 'w') as outf:
outsbf = lldb.SBFile(outf.fileno(), "w", False)
status = self.dbg.SetOutputFile(outsbf)
- self.assertTrue(status.Success())
+ self.assertSuccess(status)
self.dbg.SetInputString("help apropos\nhelp help\n")
opts = lldb.SBCommandInterpreterRunOptions()
diff --git a/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py b/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
index 484baf5d75d1d..df92849e9198f 100644
--- a/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
+++ b/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
@@ -32,25 +32,25 @@ def test_read_memory_c_string(self):
err = lldb.SBError()
empty_str_addr = frame.FindVariable("empty_string").GetValueAsUnsigned(err)
- self.assertTrue(err.Success())
+ self.assertSuccess(err)
self.assertTrue(empty_str_addr != lldb.LLDB_INVALID_ADDRESS)
one_letter_str_addr = frame.FindVariable("one_letter_string").GetValueAsUnsigned(err)
- self.assertTrue(err.Success())
+ self.assertSuccess(err)
self.assertTrue(one_letter_str_addr != lldb.LLDB_INVALID_ADDRESS)
invalid_memory_str_addr = frame.FindVariable("invalid_memory_string").GetValueAsUnsigned(err)
- self.assertTrue(err.Success())
+ self.assertSuccess(err)
self.assertTrue(invalid_memory_str_addr != lldb.LLDB_INVALID_ADDRESS)
# Important: An empty (0-length) c-string must come back as a Python string, not a
# None object.
empty_str = process.ReadCStringFromMemory(empty_str_addr, 2048, err)
- self.assertTrue(err.Success())
+ self.assertSuccess(err)
self.assertEqual(empty_str, "")
one_letter_string = process.ReadCStringFromMemory(one_letter_str_addr, 2048, err)
- self.assertTrue(err.Success())
+ self.assertSuccess(err)
self.assertEqual(one_letter_string, "1")
invalid_memory_string = process.ReadCStringFromMemory(invalid_memory_str_addr, 2048, err)
diff --git a/lldb/test/API/python_api/sbdata/TestSBData.py b/lldb/test/API/python_api/sbdata/TestSBData.py
index 1b20cf205e63d..aced0dad0d85f 100644
--- a/lldb/test/API/python_api/sbdata/TestSBData.py
+++ b/lldb/test/API/python_api/sbdata/TestSBData.py
@@ -83,10 +83,10 @@ def test_with_run_command(self):
self.assert_data(data.GetUnsignedInt32, offset, 1)
offset += 4
low = data.GetSignedInt16(error, offset)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
offset += 2
high = data.GetSignedInt16(error, offset)
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
offset += 2
self.assertTrue(
(low == 9 and high == 0) or (
@@ -99,7 +99,7 @@ def test_with_run_command(self):
offset) -
3.14) < 1,
'foo[0].c == 3.14')
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
offset += 4
self.assert_data(data.GetUnsignedInt32, offset, 8)
offset += 4
@@ -172,7 +172,7 @@ def test_with_run_command(self):
offset) -
3.14) < 1,
'foo[1].c == 3.14')
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
data = new_foobar.GetData()
@@ -188,7 +188,7 @@ def test_with_run_command(self):
offset) -
6.28) < 1,
'foo[1].c == 6.28')
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
self.runCmd("n")
@@ -207,7 +207,7 @@ def test_with_run_command(self):
offset) -
3) < 1,
'barfoo[0].c == 3')
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
offset += 4
self.assert_data(data.GetUnsignedInt32, offset, 4)
offset += 4
@@ -220,7 +220,7 @@ def test_with_run_command(self):
offset) -
6) < 1,
'barfoo[1].c == 6')
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
new_object = barfoo.CreateValueFromData(
"new_object", data, barfoo.GetType().GetBasicType(
@@ -239,7 +239,7 @@ def test_with_run_command(self):
'A\0\0\0',
data.GetByteOrder(),
data.GetAddressByteSize())
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
data2 = lldb.SBData()
data2.SetData(
@@ -247,7 +247,7 @@ def test_with_run_command(self):
'BCD',
data.GetByteOrder(),
data.GetAddressByteSize())
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
data.Append(data2)
@@ -401,7 +401,7 @@ def test_with_run_command(self):
0) -
3.14) < 0.5,
'double data2[0] = 3.14')
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
self.assertTrue(
fabs(
data2.GetDouble(
@@ -409,7 +409,7 @@ def test_with_run_command(self):
8) -
6.28) < 0.5,
'double data2[1] = 6.28')
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
self.assertTrue(
fabs(
data2.GetDouble(
@@ -417,7 +417,7 @@ def test_with_run_command(self):
16) -
2.71) < 0.5,
'double data2[2] = 2.71')
- self.assertTrue(error.Success())
+ self.assertSuccess(error)
data2 = lldb.SBData()
diff --git a/lldb/test/API/python_api/sbmodule/TestSBModule.py b/lldb/test/API/python_api/sbmodule/TestSBModule.py
index dfb7711501e94..6200ba693d337 100644
--- a/lldb/test/API/python_api/sbmodule/TestSBModule.py
+++ b/lldb/test/API/python_api/sbmodule/TestSBModule.py
@@ -54,5 +54,5 @@ def test_module_is_file_backed(self):
"The module should not be backed by a file on disk.")
error = process.Destroy()
- self.assertTrue(error.Success(), "couldn't destroy process %s" % background_process.pid)
+ self.assertSuccess(error, "couldn't destroy process %s" % background_process.pid)
diff --git a/lldb/test/API/python_api/sbplatform/TestSBPlatform.py b/lldb/test/API/python_api/sbplatform/TestSBPlatform.py
index f47e0b2660a47..002d9a68490f6 100644
--- a/lldb/test/API/python_api/sbplatform/TestSBPlatform.py
+++ b/lldb/test/API/python_api/sbplatform/TestSBPlatform.py
@@ -18,7 +18,7 @@ def cleanup():
del os.environ["MY_TEST_ENV_VAR"]
self.addTearDownHook(cleanup)
cmd = lldb.SBPlatformShellCommand(self.getBuildArtifact("a.out"))
- self.assertTrue(plat.Run(cmd).Success())
+ self.assertSuccess(plat.Run(cmd))
self.assertIn("MY_TEST_ENV_VAR=SBPlatformAPICase.test_run", cmd.GetOutput())
def test_SetSDKRoot(self):
diff --git a/lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py b/lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py
index 26f179116d278..c15f0f3586275 100644
--- a/lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py
+++ b/lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py
@@ -37,7 +37,7 @@ def structured_data_api_test(self):
# Test that GetDescription works:
s.Clear()
error = example.GetDescription(s)
- self.assertTrue(error.Success(), "GetDescription works")
+ self.assertSuccess(error, "GetDescription works")
if not "key_float" in s.GetData():
self.fail("FAILED: could not find key_float in description output")
diff --git a/lldb/test/API/python_api/target/TestTargetAPI.py b/lldb/test/API/python_api/target/TestTargetAPI.py
index 0503aa8e43697..5b80081315561 100644
--- a/lldb/test/API/python_api/target/TestTargetAPI.py
+++ b/lldb/test/API/python_api/target/TestTargetAPI.py
@@ -136,7 +136,7 @@ def test_read_memory(self):
sb_addr = lldb.SBAddress(data_section, 0)
error = lldb.SBError()
content = target.ReadMemory(sb_addr, 1, error)
- self.assertTrue(error.Success(), "Make sure memory read succeeded")
+ self.assertSuccess(error, "Make sure memory read succeeded")
self.assertEqual(len(content), 1)
diff --git a/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py b/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
index 3ffa5bfb67fab..d8b490b780d63 100644
--- a/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
+++ b/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
@@ -74,13 +74,13 @@ def test_change_value(self):
val_value = frame0.FindVariable("val")
self.assertTrue(val_value.IsValid(), "Got the SBValue for val")
actual_value = val_value.GetValueAsSigned(error, 0)
- self.assertTrue(error.Success(), "Got a value from val")
+ self.assertSuccess(error, "Got a value from val")
self.assertEquals(actual_value, 100, "Got the right value from val")
result = val_value.SetValueFromCString("12345")
self.assertTrue(result, "Setting val returned True.")
actual_value = val_value.GetValueAsSigned(error, 0)
- self.assertTrue(error.Success(), "Got a changed value from val")
+ self.assertSuccess(error, "Got a changed value from val")
self.assertEqual(
actual_value, 12345,
"Got the right changed value from val")
@@ -158,7 +158,7 @@ def test_change_value(self):
result = sp_value.SetValueFromCString("1")
self.assertTrue(result, "Setting sp returned true.")
actual_value = sp_value.GetValueAsUnsigned(error, 0)
- self.assertTrue(error.Success(), "Got a changed value for sp")
+ self.assertSuccess(error, "Got a changed value for sp")
self.assertEqual(
actual_value, 1,
"Got the right changed value for sp.")
diff --git a/lldb/test/API/sample_test/TestSampleTest.py b/lldb/test/API/sample_test/TestSampleTest.py
index 446f4b9f4d3e9..ca361961f64de 100644
--- a/lldb/test/API/sample_test/TestSampleTest.py
+++ b/lldb/test/API/sample_test/TestSampleTest.py
@@ -42,7 +42,7 @@ def sample_test(self):
frame = thread.GetFrameAtIndex(0)
test_var = frame.FindVariable("test_var")
- self.assertTrue(test_var.GetError().Success(), "Failed to fetch test_var")
+ self.assertSuccess(test_var.GetError(), "Failed to fetch test_var")
test_value = test_var.GetValueAsUnsigned()
self.assertEqual(test_value, 10, "Got the right value for test_var")
diff --git a/lldb/test/API/sample_test/main.c b/lldb/test/API/sample_test/main.c
index 7f53fd41dc7d5..df22f570bf33a 100644
--- a/lldb/test/API/sample_test/main.c
+++ b/lldb/test/API/sample_test/main.c
@@ -9,7 +9,7 @@ main()
printf ("Set a breakpoint here: %d.\n", test_var);
//% test_var = self.frame().FindVariable("test_var")
//% test_value = test_var.GetValueAsUnsigned()
- //% self.assertTrue(test_var.GetError().Success(), "Failed to fetch test_var")
+ //% self.assertSuccess(test_var.GetError(), "Failed to fetch test_var")
//% self.assertEqual(test_value, 10, "Failed to get the right value for test_var")
return global_test_var;
}
More information about the lldb-commits
mailing list