[Lldb-commits] [lldb] 0f82133 - [lldb] Add assertStopReason helper function
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 3 11:44:18 PDT 2022
Author: Jonas Devlieghere
Date: 2022-08-03T11:44:13-07:00
New Revision: 0f821339dad1bf45dd71a1cac32b6352ba251ecb
URL: https://github.com/llvm/llvm-project/commit/0f821339dad1bf45dd71a1cac32b6352ba251ecb
DIFF: https://github.com/llvm/llvm-project/commit/0f821339dad1bf45dd71a1cac32b6352ba251ecb.diff
LOG: [lldb] Add assertStopReason helper function
Add a function to make it easier to debug a test failure caused by an
unexpected stop reason. This is similar to the assertState helper that
was added in ce825e46743b.
Before:
self.assertEqual(stop_reason, lldb.eStopReasonInstrumentation)
AssertionError: 5 != 10
After:
self.assertStopReason(stop_reason, lldb.eStopReasonInstrumentation)
AssertionError: signal (5) != instrumentation (10)
Differential revision: https://reviews.llvm.org/D131083
Added:
Modified:
lldb/docs/resources/test.rst
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/packages/Python/lldbsuite/test/lldbutil.py
lldb/test/API/commands/process/continue_to_bkpt/TestContinueToBkpts.py
lldb/test/API/commands/watchpoints/multiple_hits/TestMultipleHits.py
lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py
lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
lldb/test/API/commands/watchpoints/watchpoint_disable/TestWatchpointDisable.py
lldb/test/API/functionalities/breakpoint/breakpoint_on_lambda_capture/TestBreakOnLambdaCapture.py
lldb/test/API/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
lldb/test/API/functionalities/breakpoint/two_hits_one_actual/TestTwoHitsOneActual.py
lldb/test/API/functionalities/gdb_remote_client/TestRecognizeBreakpoint.py
lldb/test/API/functionalities/mtc/simple/TestMTCSimple.py
lldb/test/API/functionalities/postmortem/elf-core/gcore/TestGCore.py
lldb/test/API/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py
lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
lldb/test/API/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py
lldb/test/API/functionalities/process_group/TestChangeProcessGroup.py
lldb/test/API/functionalities/return-value/TestReturnValue.py
lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
lldb/test/API/functionalities/stop-on-sharedlibrary-load/TestStopOnSharedlibraryEvents.py
lldb/test/API/functionalities/thread/create_during_step/TestCreateDuringStep.py
lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py
lldb/test/API/functionalities/thread/state/TestThreadStates.py
lldb/test/API/functionalities/thread/state_after_expression/TestStateAfterExpression.py
lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py
lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py
lldb/test/API/macosx/ignore_exceptions/TestIgnoredExceptions.py
lldb/test/API/python_api/thread/TestThreadAPI.py
Removed:
################################################################################
diff --git a/lldb/docs/resources/test.rst b/lldb/docs/resources/test.rst
index 001803dc5d284..d0e94fbe1f9dc 100644
--- a/lldb/docs/resources/test.rst
+++ b/lldb/docs/resources/test.rst
@@ -323,13 +323,15 @@ A better way to write the test above would be using LLDB's testing function
asserts are available. LLDB also has a few custom asserts that are tailored
to our own data types.
-+-----------------------------------------------+---------------------------------------------------------------+
++-----------------------------------------------+-----------------------------------------------------------------+
| **Assert** | **Description** |
-+-----------------------------------------------+---------------------------------------------------------------+
++-----------------------------------------------+-----------------------------------------------------------------+
| ``assertSuccess`` | Assert that an ``lldb.SBError`` is in the "success" state. |
-+-----------------------------------------------+---------------------------------------------------------------+
++-----------------------------------------------+-----------------------------------------------------------------+
| ``assertState`` | Assert that two states (``lldb.eState*``) are equal. |
-+-----------------------------------------------+---------------------------------------------------------------+
++-----------------------------------------------+-----------------------------------------------------------------+
+| ``assertStopReason`` | Assert that two stop reasons (``lldb.eStopReason*``) are equal. |
++-----------------------------------------------+-----------------------------------------------------------------+
If you can't find a specific assert that fits your needs and you fall back
to a generic assert, make sure you put useful information into the assert's
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index d46e54f30bd55..d28e0d294ad3d 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2474,6 +2474,14 @@ def assertState(self, first, second, msg=None):
lldbutil.state_type_to_str(second), second)
self.fail(self._formatMessage(msg, error))
+ """Assert two stop reasons are equal"""
+ def assertStopReason(self, first, second, msg=None):
+ if first != second:
+ error = "{} ({}) != {} ({})".format(
+ lldbutil.stop_reason_to_str(first), first,
+ lldbutil.stop_reason_to_str(second), second)
+ self.fail(self._formatMessage(msg, error))
+
def createTestTarget(self, file_path=None, msg=None,
load_dependent_modules=True):
"""
diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index 7863e64e527f1..f21f4928704ca 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -266,6 +266,10 @@ def stop_reason_to_str(enum):
return "plancomplete"
elif enum == lldb.eStopReasonThreadExiting:
return "threadexiting"
+ elif enum == lldb.eStopReasonInstrumentation:
+ return "instrumentation"
+ elif enum == lldb.eStopReasonProcessorTrace:
+ return "processortrace"
else:
raise Exception("Unknown StopReason enum")
diff --git a/lldb/test/API/commands/process/continue_to_bkpt/TestContinueToBkpts.py b/lldb/test/API/commands/process/continue_to_bkpt/TestContinueToBkpts.py
index c8f6764647a33..eef1a6d762f45 100644
--- a/lldb/test/API/commands/process/continue_to_bkpt/TestContinueToBkpts.py
+++ b/lldb/test/API/commands/process/continue_to_bkpt/TestContinueToBkpts.py
@@ -32,7 +32,7 @@ def continue_and_check(self, stop_list, bkpt_to_hit, loc_to_hit = 0):
for elem in stop_list:
command += " -b {0}".format(elem)
self.expect(command)
- self.assertEqual(self.thread.stop_reason, lldb.eStopReasonBreakpoint, "Hit a breakpoint")
+ self.assertStopReason(self.thread.stop_reason, lldb.eStopReasonBreakpoint, "Hit a breakpoint")
self.assertEqual(self.thread.GetStopReasonDataAtIndex(0), bkpt_to_hit, "Hit the right breakpoint")
if loc_to_hit != 0:
self.assertEqual(self.thread.GetStopReasonDataAtIndex(1), loc_to_hit, "Hit the right location")
diff --git a/lldb/test/API/commands/watchpoints/multiple_hits/TestMultipleHits.py b/lldb/test/API/commands/watchpoints/multiple_hits/TestMultipleHits.py
index 9267637314013..2a37831cf7715 100644
--- a/lldb/test/API/commands/watchpoints/multiple_hits/TestMultipleHits.py
+++ b/lldb/test/API/commands/watchpoints/multiple_hits/TestMultipleHits.py
@@ -45,5 +45,5 @@ def test(self):
process.Continue();
self.assertState(process.GetState(), lldb.eStateStopped)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonWatchpoint)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonWatchpoint)
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 775d80d1713fe..7d54156aebb5b 100644
--- a/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py
+++ b/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py
@@ -56,7 +56,7 @@ def test(self):
self.assertTrue(read_watchpoint, "Failed to set read watchpoint.")
thread.StepOver()
- self.assertEquals(thread.GetStopReason(), lldb.eStopReasonWatchpoint,
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonWatchpoint,
STOPPED_DUE_TO_WATCHPOINT)
self.assertEquals(thread.GetStopDescription(20), 'watchpoint 1')
@@ -83,7 +83,7 @@ def test(self):
self.assertSuccess(error, "Error while setting watchpoint")
thread.StepOver()
- self.assertEquals(thread.GetStopReason(), lldb.eStopReasonWatchpoint,
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonWatchpoint,
STOPPED_DUE_TO_WATCHPOINT)
self.assertEquals(thread.GetStopDescription(20), 'watchpoint 2')
@@ -108,6 +108,6 @@ def step_inst_for_watchpoint(self, wp_id):
"Watchpoint ID didn't match.")
watchpoint_hit = True
else:
- self.assertEquals(stop_reason, lldb.eStopReasonPlanComplete,
+ self.assertStopReason(stop_reason, lldb.eStopReasonPlanComplete,
STOPPED_DUE_TO_STEP_IN)
self.assertTrue(watchpoint_hit, "Watchpoint never hit.")
diff --git a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
index a940e005a2222..9b34a2e83d2a9 100644
--- a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
+++ b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
@@ -33,12 +33,12 @@ def test_watchpoint_count(self):
process.Continue()
stop_reason = thread.GetStopReason()
- self.assertEqual(stop_reason, lldb.eStopReasonWatchpoint, "watchpoint for x1 not hit")
+ self.assertStopReason(stop_reason, lldb.eStopReasonWatchpoint, "watchpoint for x1 not hit")
stop_reason_descr = thread.GetStopDescription(256)
self.assertEqual(stop_reason_descr, "watchpoint 1")
process.Continue()
stop_reason = thread.GetStopReason()
- self.assertEqual(stop_reason, lldb.eStopReasonWatchpoint, "watchpoint for x2 not hit")
+ self.assertStopReason(stop_reason, lldb.eStopReasonWatchpoint, "watchpoint for x2 not hit")
stop_reason_descr = thread.GetStopDescription(256)
self.assertEqual(stop_reason_descr, "watchpoint 2")
diff --git a/lldb/test/API/commands/watchpoints/watchpoint_disable/TestWatchpointDisable.py b/lldb/test/API/commands/watchpoints/watchpoint_disable/TestWatchpointDisable.py
index e582d5467241a..d1a8075409007 100644
--- a/lldb/test/API/commands/watchpoints/watchpoint_disable/TestWatchpointDisable.py
+++ b/lldb/test/API/commands/watchpoints/watchpoint_disable/TestWatchpointDisable.py
@@ -56,12 +56,12 @@ def do_test(self, test_enable):
stop_reason = thread.GetStopReason()
- self.assertEqual(stop_reason, lldb.eStopReasonBreakpoint, "We didn't stop at our breakpoint.")
+ self.assertStopReason(stop_reason, lldb.eStopReasonBreakpoint, "We didn't stop at our breakpoint.")
if test_enable:
wp.SetEnabled(True)
self.assertTrue(wp.IsEnabled(), "The watchpoint thinks it is still disabled.")
process.Continue()
stop_reason = thread.GetStopReason()
- self.assertEqual(stop_reason, lldb.eStopReasonWatchpoint, "We didn't stop at our watchpoint")
+ self.assertStopReason(stop_reason, lldb.eStopReasonWatchpoint, "We didn't stop at our watchpoint")
diff --git a/lldb/test/API/functionalities/breakpoint/breakpoint_on_lambda_capture/TestBreakOnLambdaCapture.py b/lldb/test/API/functionalities/breakpoint/breakpoint_on_lambda_capture/TestBreakOnLambdaCapture.py
index da6af1ea5f60d..a75d8725505a7 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_on_lambda_capture/TestBreakOnLambdaCapture.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_on_lambda_capture/TestBreakOnLambdaCapture.py
@@ -49,6 +49,6 @@ def test_break_on_lambda_capture(self):
process.Continue()
for thread in process.threads:
if thread.id == main_thread.id:
- self.assertEqual(thread.stop_reason, lldb.eStopReasonBreakpoint)
+ self.assertStopReason(thread.stop_reason, lldb.eStopReasonBreakpoint)
else:
- self.assertEqual(thread.stop_reason, lldb.eStopReasonNone)
+ self.assertStopReason(thread.stop_reason, lldb.eStopReasonNone)
diff --git a/lldb/test/API/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py b/lldb/test/API/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
index 0953f0b013e50..921a24df01c32 100644
--- a/lldb/test/API/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
+++ b/lldb/test/API/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
@@ -89,17 +89,17 @@ def test_step_over(self):
self.thread.StepOver()
# We should be stopped at the breakpoint_2 line with stop plan complete reason
self.assertState(self.process.GetState(), lldb.eStateStopped)
- self.assertEquals(self.thread.GetStopReason(), lldb.eStopReasonPlanComplete)
+ self.assertStopReason(self.thread.GetStopReason(), lldb.eStopReasonPlanComplete)
self.thread.StepOver()
# We should be stopped at the breakpoint_3 line with stop plan complete reason
self.assertState(self.process.GetState(), lldb.eStateStopped)
- self.assertEquals(self.thread.GetStopReason(), lldb.eStopReasonPlanComplete)
+ self.assertStopReason(self.thread.GetStopReason(), lldb.eStopReasonPlanComplete)
self.thread.StepOver()
# We should be stopped at the breakpoint_4
self.assertState(self.process.GetState(), lldb.eStateStopped)
- self.assertEquals(self.thread.GetStopReason(), lldb.eStopReasonBreakpoint)
+ self.assertStopReason(self.thread.GetStopReason(), lldb.eStopReasonBreakpoint)
thread1 = lldbutil.get_one_thread_stopped_at_breakpoint(self.process, self.breakpoint4)
self.assertEquals(self.thread, thread1, "Didn't stop at breakpoint 4.")
diff --git a/lldb/test/API/functionalities/breakpoint/two_hits_one_actual/TestTwoHitsOneActual.py b/lldb/test/API/functionalities/breakpoint/two_hits_one_actual/TestTwoHitsOneActual.py
index 6e5c721b69003..65fdf3119a28f 100644
--- a/lldb/test/API/functionalities/breakpoint/two_hits_one_actual/TestTwoHitsOneActual.py
+++ b/lldb/test/API/functionalities/breakpoint/two_hits_one_actual/TestTwoHitsOneActual.py
@@ -57,8 +57,8 @@ def sample_test(self):
process.Continue()
for thread in process.threads:
if thread.id == main_thread.id:
- self.assertEqual(thread.stop_reason, lldb.eStopReasonBreakpoint)
+ self.assertStopReason(thread.stop_reason, lldb.eStopReasonBreakpoint)
else:
- self.assertEqual(thread.stop_reason, lldb.eStopReasonNone)
+ self.assertStopReason(thread.stop_reason, lldb.eStopReasonNone)
diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestRecognizeBreakpoint.py b/lldb/test/API/functionalities/gdb_remote_client/TestRecognizeBreakpoint.py
index 783240b87ce30..7e047bbce9e16 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestRecognizeBreakpoint.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestRecognizeBreakpoint.py
@@ -137,5 +137,5 @@ def other (self, packet):
self.assertEqual(thread_1.GetName(), "three", "Thread_0 is called three")
self.assertTrue(thread_1.IsValid(), "Thread_1 is valid")
- self.assertEqual(thread_1.GetStopReason(), lldb.eStopReasonBreakpoint, "Stopped at breakpoint")
+ self.assertStopReason(thread_1.GetStopReason(), lldb.eStopReasonBreakpoint, "Stopped at breakpoint")
diff --git a/lldb/test/API/functionalities/mtc/simple/TestMTCSimple.py b/lldb/test/API/functionalities/mtc/simple/TestMTCSimple.py
index 863afe14b2fb0..9ecacba71ab49 100644
--- a/lldb/test/API/functionalities/mtc/simple/TestMTCSimple.py
+++ b/lldb/test/API/functionalities/mtc/simple/TestMTCSimple.py
@@ -53,7 +53,7 @@ def mtc_tests(self):
"instrumentation_class",
"selector"
])
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonInstrumentation)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonInstrumentation)
output_lines = self.res.GetOutput().split('\n')
json_line = '\n'.join(output_lines[2:])
data = json.loads(json_line)
diff --git a/lldb/test/API/functionalities/postmortem/elf-core/gcore/TestGCore.py b/lldb/test/API/functionalities/postmortem/elf-core/gcore/TestGCore.py
index 0f3f4845d0c1f..4aafd405d16a0 100644
--- a/lldb/test/API/functionalities/postmortem/elf-core/gcore/TestGCore.py
+++ b/lldb/test/API/functionalities/postmortem/elf-core/gcore/TestGCore.py
@@ -37,7 +37,7 @@ def do_test(self, filename, pid):
for thread in process:
reason = thread.GetStopReason()
- self.assertEqual(reason, lldb.eStopReasonSignal)
+ self.assertStopReason(reason, lldb.eStopReasonSignal)
signal = thread.GetStopReasonDataAtIndex(1)
# Check we got signal 19 (SIGSTOP)
self.assertEqual(signal, 19)
diff --git a/lldb/test/API/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py b/lldb/test/API/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
index 398af86eede83..3eb1eb8563faa 100644
--- a/lldb/test/API/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
+++ b/lldb/test/API/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
@@ -53,7 +53,7 @@ def do_test(self, filename, pid, tid):
self.assertEqual(bytes_read, None)
reason = thread.GetStopReason()
if( thread.GetThreadID() == tid ):
- self.assertEqual(reason, lldb.eStopReasonSignal)
+ self.assertStopReason(reason, lldb.eStopReasonSignal)
signal = thread.GetStopReasonDataAtIndex(1)
# Check we got signal 4 (SIGILL)
self.assertEqual(signal, 4)
diff --git a/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py b/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
index 286ff0730cbb0..7c36675c533f0 100644
--- a/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ b/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -117,7 +117,7 @@ def test_thread_info_in_minidump(self):
# one and only thread.
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
stop_description = thread.GetStopDescription(256)
self.assertIn("SIGSEGV", stop_description)
@@ -153,7 +153,7 @@ def test_snapshot_minidump_dump_requested(self):
self.check_state()
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonNone)
stop_description = thread.GetStopDescription(256)
self.assertEqual(stop_description, "")
@@ -164,7 +164,7 @@ def test_snapshot_minidump_null_exn_code(self):
self.check_state()
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonNone)
stop_description = thread.GetStopDescription(256)
self.assertEqual(stop_description, "")
@@ -191,7 +191,7 @@ def test_arm64_registers(self):
self.check_state()
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonNone)
stop_description = thread.GetStopDescription(256)
self.assertEqual(stop_description, "")
registers = thread.GetFrameAtIndex(0).GetRegisters()
@@ -258,7 +258,7 @@ def verify_arm_registers(self, apple=False):
self.check_state()
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonNone)
stop_description = thread.GetStopDescription(256)
self.assertEqual(stop_description, "")
registers = thread.GetFrameAtIndex(0).GetRegisters()
diff --git a/lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py b/lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py
index 4d08efc9b0538..e0c5600cf1bdd 100644
--- a/lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py
+++ b/lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py
@@ -34,7 +34,7 @@ def test_thread_info_in_mini_dump(self):
# one and only thread.
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonException)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonException)
stop_description = thread.GetStopDescription(256)
self.assertIn("0xc0000005", stop_description)
diff --git a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
index fb0201690f7c7..c22ef5818164a 100644
--- a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
+++ b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
@@ -150,7 +150,7 @@ def check_stack(self, process, pid, filename):
thread = process.GetSelectedThread()
self.assertTrue(thread)
self.assertEqual(thread.GetThreadID(), 1)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
self.assertEqual(thread.GetStopReasonDataCount(), 1)
self.assertEqual(thread.GetStopReasonDataAtIndex(0), signal.SIGSEGV)
backtrace = ["bar", "foo", "main"]
@@ -174,7 +174,7 @@ def check_stack(self, process, pid, filename):
thread = process.GetSelectedThread()
self.assertTrue(thread)
self.assertEqual(thread.GetThreadID(), 2)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
self.assertEqual(thread.GetStopReasonDataCount(), 1)
self.assertEqual(thread.GetStopReasonDataAtIndex(0), signal.SIGSEGV)
backtrace = ["bar", "foo", "lwp_main"]
@@ -182,7 +182,7 @@ def check_stack(self, process, pid, filename):
# thread 1 should have no signal
thread = process.GetThreadByID(1)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
self.assertEqual(thread.GetStopReasonDataCount(), 1)
self.assertEqual(thread.GetStopReasonDataAtIndex(0), 0)
@@ -204,7 +204,7 @@ def check_stack(self, process, pid, filename):
thread = process.GetSelectedThread()
self.assertTrue(thread)
self.assertEqual(thread.GetThreadID(), 2)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
self.assertEqual(thread.GetStopReasonDataCount(), 1)
self.assertEqual(thread.GetStopReasonDataAtIndex(0), signal.SIGSEGV)
backtrace = ["bar", "foo", "lwp_main"]
@@ -212,7 +212,7 @@ def check_stack(self, process, pid, filename):
# thread 1 should have the same signal
thread = process.GetThreadByID(1)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
self.assertEqual(thread.GetStopReasonDataCount(), 1)
self.assertEqual(thread.GetStopReasonDataAtIndex(0), signal.SIGSEGV)
diff --git a/lldb/test/API/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py b/lldb/test/API/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py
index d057856926e12..ef4cf6e30984b 100644
--- a/lldb/test/API/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py
+++ b/lldb/test/API/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py
@@ -42,7 +42,7 @@ def test_thread_info_in_wow64_mini_dump(self):
# In the dump, none of the threads are stopped, so we cannot use
# lldbutil.get_stopped_thread.
thread = process.GetThreadAtIndex(0)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonNone)
def test_stack_info_in_wow64_mini_dump(self):
"""Test that we can see a trivial stack in a VS-generate mini dump."""
diff --git a/lldb/test/API/functionalities/process_group/TestChangeProcessGroup.py b/lldb/test/API/functionalities/process_group/TestChangeProcessGroup.py
index 98f35521cd2f4..6263c1446c340 100644
--- a/lldb/test/API/functionalities/process_group/TestChangeProcessGroup.py
+++ b/lldb/test/API/functionalities/process_group/TestChangeProcessGroup.py
@@ -77,7 +77,7 @@ def cleanupChild():
# step over the setpgid() call
thread.StepOver()
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
# verify that the process group has been set correctly
# this also checks that we are still in full control of the child
diff --git a/lldb/test/API/functionalities/return-value/TestReturnValue.py b/lldb/test/API/functionalities/return-value/TestReturnValue.py
index 67a268aeb8c52..41e0b973d74bf 100644
--- a/lldb/test/API/functionalities/return-value/TestReturnValue.py
+++ b/lldb/test/API/functionalities/return-value/TestReturnValue.py
@@ -61,7 +61,7 @@ def test_with_python(self):
thread.StepOut()
self.assertState(self.process.GetState(), lldb.eStateStopped)
- self.assertEquals(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
frame = thread.GetFrameAtIndex(0)
fun_name = frame.GetFunctionName()
@@ -93,7 +93,7 @@ def test_with_python(self):
thread.StepOutOfFrame(frame)
self.assertState(self.process.GetState(), lldb.eStateStopped)
- self.assertEquals(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
frame = thread.GetFrameAtIndex(0)
fun_name = frame.GetFunctionName()
self.assertEquals(fun_name, "main")
@@ -122,7 +122,7 @@ def test_with_python(self):
thread.StepOut()
self.assertState(self.process.GetState(), lldb.eStateStopped)
- self.assertEquals(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
frame = thread.GetFrameAtIndex(0)
fun_name = frame.GetFunctionName()
@@ -262,7 +262,7 @@ def return_and_test_struct_value(self, func_name):
thread.StepOut()
self.assertState(self.process.GetState(), lldb.eStateStopped)
- self.assertEquals(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
# Assuming all these functions step out to main. Could figure out the caller dynamically
# if that would add something to the test.
diff --git a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
index d1e75cd623864..7c6ce83cc56dd 100644
--- a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
+++ b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
@@ -122,7 +122,7 @@ def cleanup():
self.assertTrue(thread, "Invalid thread.")
self.assertEqual(thread.GetThreadID(), 0x19)
self.assertEqual(thread.GetName(), "DummyScriptedThread.thread-1")
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
self.assertGreater(thread.GetNumFrames(), 0)
diff --git a/lldb/test/API/functionalities/stop-on-sharedlibrary-load/TestStopOnSharedlibraryEvents.py b/lldb/test/API/functionalities/stop-on-sharedlibrary-load/TestStopOnSharedlibraryEvents.py
index b6af63505aff1..f12d6fc428627 100644
--- a/lldb/test/API/functionalities/stop-on-sharedlibrary-load/TestStopOnSharedlibraryEvents.py
+++ b/lldb/test/API/functionalities/stop-on-sharedlibrary-load/TestStopOnSharedlibraryEvents.py
@@ -82,14 +82,14 @@ def do_test(self, bkpt_modifier = None):
process.Continue()
self.assertState(process.GetState(), lldb.eStateStopped, "We didn't stop for the load")
self.assertEqual(backstop_bkpt_2.GetHitCount(), 0, "Hit our backstop breakpoint")
- self.assertEqual(thread.stop_reason, lldb.eStopReasonBreakpoint, "We attributed the stop to the breakpoint")
+ self.assertStopReason(thread.stop_reason, lldb.eStopReasonBreakpoint, "We attributed the stop to the breakpoint")
self.assertEqual(load_bkpt.GetHitCount(), 1, "We hit our breakpoint at the load address")
else:
bkpt_modifier(load_bkpt)
process.Continue()
self.assertState(process.GetState(), lldb.eStateStopped, "We didn't stop")
self.assertTrue(thread.IsValid(), "Our thread was no longer valid.")
- self.assertEqual(thread.stop_reason, lldb.eStopReasonBreakpoint, "We didn't hit some breakpoint")
+ self.assertStopReason(thread.stop_reason, lldb.eStopReasonBreakpoint, "We didn't hit some breakpoint")
self.assertEqual(backstop_bkpt_2.GetHitCount(), 1, "We continued to the right breakpoint")
diff --git a/lldb/test/API/functionalities/thread/create_during_step/TestCreateDuringStep.py b/lldb/test/API/functionalities/thread/create_during_step/TestCreateDuringStep.py
index 372ac139df21d..6abeccba52649 100644
--- a/lldb/test/API/functionalities/thread/create_during_step/TestCreateDuringStep.py
+++ b/lldb/test/API/functionalities/thread/create_during_step/TestCreateDuringStep.py
@@ -141,7 +141,7 @@ def create_during_step_base(self, step_cmd, step_stop_reason):
'Number of expected threads and actual threads do not match after thread exit.')
stop_reason = stepping_thread.GetStopReason()
- self.assertEqual(stop_reason, lldb.eStopReasonPlanComplete, "Stopped for plan completion")
+ self.assertStopReason(stop_reason, lldb.eStopReasonPlanComplete, "Stopped for plan completion")
# Run to completion
self.runCmd("process continue")
diff --git a/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py b/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py
index 7ddf6f21f61f7..8cc1100ed560a 100644
--- a/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py
+++ b/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py
@@ -107,7 +107,7 @@ def is_thread3(thread):
# If we aren't stopped out the thread breakpoint try to resume.
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
self.runCmd("thread continue %d"%(i+1))
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonBreakpoint)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonBreakpoint)
expect_threads += " #%d"%(i+1)
diff --git a/lldb/test/API/functionalities/thread/state/TestThreadStates.py b/lldb/test/API/functionalities/thread/state/TestThreadStates.py
index 9d6863f610edd..c9d19381733e9 100644
--- a/lldb/test/API/functionalities/thread/state/TestThreadStates.py
+++ b/lldb/test/API/functionalities/thread/state/TestThreadStates.py
@@ -226,7 +226,7 @@ def test_process_interrupt(self):
# Stop the process
self.runCmd("process interrupt")
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
# Get the inferior out of its loop
self.runCmd("expression g_test = 1")
@@ -282,7 +282,7 @@ def thread_states_test(self):
# Stop the process
self.runCmd("process interrupt")
- self.assertEqual(thread.GetState(), lldb.eStopReasonSignal)
+ self.assertStopReason(thread.GetState(), lldb.eStopReasonSignal)
# Check the thread state
self.assertTrue(
@@ -302,12 +302,12 @@ def thread_states_test(self):
thread.IsSuspended(),
"Thread state is \'suspended\' after expression evaluation.")
- self.assertEqual(thread.GetState(), lldb.eStopReasonSignal)
+ self.assertStopReason(thread.GetState(), lldb.eStopReasonSignal)
# Run to breakpoint 2
self.runCmd("continue")
- self.assertEqual(thread.GetState(), lldb.eStopReasonBreakpoint)
+ self.assertStopReason(thread.GetState(), lldb.eStopReasonBreakpoint)
# Make sure both threads are stopped
self.assertTrue(
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 e26e066ce63bc..90fc9a2569312 100644
--- a/lldb/test/API/functionalities/thread/state_after_expression/TestStateAfterExpression.py
+++ b/lldb/test/API/functionalities/thread/state_after_expression/TestStateAfterExpression.py
@@ -45,7 +45,7 @@ def do_test(self):
stop_reason = other_thread.GetStopReason()
- self.assertEqual(stop_reason, lldb.eStopReasonBreakpoint,
+ self.assertStopReason(stop_reason, lldb.eStopReasonBreakpoint,
"Still records stopped at breakpoint: %s"
%(lldbutil.stop_reason_to_str(stop_reason)))
self.assertEqual(other_thread.GetStopReasonDataAtIndex(0), 1,
diff --git a/lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py b/lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py
index 4220a597b048c..2af97098a431c 100644
--- a/lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py
+++ b/lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py
@@ -41,7 +41,7 @@ def ubsan_tests(self):
substrs=['stopped', 'stop reason ='])
stop_reason = thread.GetStopReason()
- self.assertEqual(stop_reason, lldb.eStopReasonInstrumentation)
+ self.assertStopReason(stop_reason, lldb.eStopReasonInstrumentation)
# test that the UBSan dylib is present
self.expect(
diff --git a/lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py b/lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py
index 62cce7181a340..18347716e30dd 100644
--- a/lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py
+++ b/lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py
@@ -165,13 +165,13 @@ def test_and_python_api(self):
process.Continue()
self.assertEqual(thread.GetFrameAtIndex(0).GetFunctionName(), "a")
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
# And one more time should get us back to main:
process.Continue()
self.assertEqual(thread.GetFrameAtIndex(0).GetFunctionName(), "main")
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
# Now make sure we can call a function, break in the called function,
# then have "continue" get us back out again:
diff --git a/lldb/test/API/macosx/ignore_exceptions/TestIgnoredExceptions.py b/lldb/test/API/macosx/ignore_exceptions/TestIgnoredExceptions.py
index f8112b6803e1f..4117e5e42cd38 100644
--- a/lldb/test/API/macosx/ignore_exceptions/TestIgnoredExceptions.py
+++ b/lldb/test/API/macosx/ignore_exceptions/TestIgnoredExceptions.py
@@ -46,7 +46,7 @@ def suspended_thread_test(self):
name = thread.frame[0].name
self.fail("Hit breakpoint {0} in '{1}' rather than getting a SIGBUS".format(id, name))
- self.assertEqual(thread.stop_reason, lldb.eStopReasonSignal)
+ self.assertStopReason(thread.stop_reason, lldb.eStopReasonSignal)
self.assertEqual(thread.GetStopReasonDataAtIndex(0), 10, "Got a SIGBUS")
# Now when we continue, we'll find our way into the signal handler:
diff --git a/lldb/test/API/python_api/thread/TestThreadAPI.py b/lldb/test/API/python_api/thread/TestThreadAPI.py
index 612c47e6fa123..50dd73c4f8ad7 100644
--- a/lldb/test/API/python_api/thread/TestThreadAPI.py
+++ b/lldb/test/API/python_api/thread/TestThreadAPI.py
@@ -214,7 +214,7 @@ def step_over_3_times(self, exe_name):
# main2.cpp.
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
+ self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
# Expected failure with clang as the compiler.
# rdar://problem/9223880
#
More information about the lldb-commits
mailing list