[all-commits] [llvm/llvm-project] ce825e: [lldb] Add assertState function to the API test suite

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Wed Jun 8 16:17:05 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ce825e46743be3e402820484bef639d12deefc2a
      https://github.com/llvm/llvm-project/commit/ce825e46743be3e402820484bef639d12deefc2a
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2022-06-08 (Wed, 08 Jun 2022)

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

  Log Message:
  -----------
  [lldb] Add assertState function to the API test suite

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 was the expected state, and what the other
value 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 and reporting better error
messages.

The aforementioned error message now looks like this: "AssertionError:
stopped (5) != exited (10)". If the user provided a message, that
continues to get printed as well.

Differential revision: https://reviews.llvm.org/D127355




More information about the All-commits mailing list