aboutsummaryrefslogtreecommitdiff
path: root/lldb/packages/Python/lldbsuite/test/lldbtest.py
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2022-08-03 11:42:12 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2022-08-03 11:44:13 -0700
commit0f821339dad1bf45dd71a1cac32b6352ba251ecb (patch)
treea324aaed0dee45aad11f4d5972e18f98f70ebb2c /lldb/packages/Python/lldbsuite/test/lldbtest.py
parent371610793491fcd1c9af114a0de0cdda9a4408b0 (diff)
downloadllvm-0f821339dad1bf45dd71a1cac32b6352ba251ecb.zip
llvm-0f821339dad1bf45dd71a1cac32b6352ba251ecb.tar.gz
llvm-0f821339dad1bf45dd71a1cac32b6352ba251ecb.tar.bz2
[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
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lldbtest.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbtest.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index d46e54f..d28e0d2 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2474,6 +2474,14 @@ FileCheck output:
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):
"""