[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 ce825e4674.

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
This commit is contained in:
Jonas Devlieghere
2022-08-03 11:42:12 -07:00
parent 3716107934
commit 0f821339da
31 changed files with 70 additions and 56 deletions

View File

@@ -214,7 +214,7 @@ class ThreadAPITestCase(TestBase):
# 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
#