[Lldb-commits] [PATCH] D127355: [lldb] Add assertState function

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 8 15:12:39 PDT 2022


JDevlieghere created this revision.
JDevlieghere added reviewers: kastiglione, mib.
Herald added a project: All.
JDevlieghere requested review of this revision.

Add a function to make it easier to debug a test failure caused by an unexpected state. Currently, tests are using `assertEqual` which results in a cryptic error message: "AssertionError: 5 != 10". Even when a test provides a message to make it clear why a particular state is expected, you still have to figure out which of the two numbers was the expected state and what the actual state corresponds to. We have a function in `lldbutil` that helps you convert the state number into a user readable string. This patch adds a wrapper around `assertEqual` specifically for comparing states. The aforementioned error message now looks like this: "AssertionError: 5 != 10 : stopped != exited". If the user provided a message, that gets displayed as well.


https://reviews.llvm.org/D127355

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/test/API/commands/process/launch-with-shellexpand/TestLaunchWithShellExpand.py
  lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py
  lldb/test/API/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
  lldb/test/API/functionalities/breakpoint/move_nearest/TestMoveNearest.py
  lldb/test/API/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
  lldb/test/API/functionalities/completion/TestCompletion.py
  lldb/test/API/functionalities/dynamic_value_child_count/TestDynamicValueChildCount.py
  lldb/test/API/functionalities/launch_stop_at_entry/TestStopAtEntry.py
  lldb/test/API/functionalities/return-value/TestReturnValue.py
  lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py
  lldb/test/API/lang/cpp/gmodules/TestWithModuleDebugging.py
  lldb/test/API/lang/objc/ivar-IMP/TestObjCiVarIMP.py
  lldb/test/API/lang/objc/objc-baseclass-sbtype/TestObjCBaseClassSBType.py
  lldb/test/API/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
  lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
  lldb/test/API/linux/add-symbols/TestTargetSymbolsAddCommand.py
  lldb/test/API/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py
  lldb/test/API/macosx/add-dsym/TestAddDsymDownload.py
  lldb/test/API/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
  lldb/test/API/python_api/class_members/TestSBTypeClassMembers.py
  lldb/test/API/python_api/objc_type/TestObjCType.py
  lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
  lldb/test/API/python_api/value/empty_class/TestValueAPIEmptyClass.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127355.435355.patch
Type: text/x-patch
Size: 25048 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220608/4dd7889d/attachment-0001.bin>


More information about the lldb-commits mailing list