[lldb] Replace assertTrue(a == b, "msg") with assertEquals(a, b, "msg") in the test...
authorRaphael Isemann <teemperor@gmail.com>
Thu, 13 Feb 2020 12:40:22 +0000 (13:40 +0100)
committerRaphael Isemann <teemperor@gmail.com>
Thu, 13 Feb 2020 14:00:55 +0000 (15:00 +0100)
commitb3a0c4d7dcfa252be17ef5f5b63ffaaa83e01a2b
treef532c1b428f232a9b45c7e210269c072dd70474e
parent70e6ed1db709584c6f0ca5f2c7904c74c962dec7
[lldb] Replace assertTrue(a == b, "msg") with assertEquals(a, b, "msg") in the test suite

Summary:
The error message from the construct `assertTrue(a == b, "msg") ` are nearly always completely useless for actually debugging the issue.
This patch is just replacing this construct (and similar ones like `assertTrue(a != b, ...)` with the proper call to assertEqual or assertNotEquals.

This patch was mostly written by a shell script with some manual verification afterwards:
```
lang=python
import sys

def sanitize_line(line):
  if line.strip().startswith("self.assertTrue(") and " == " in line:
    line = line.replace("self.assertTrue(", "self.assertEquals(")
    line = line.replace(" == ", ", ", 1)
  if line.strip().startswith("self.assertTrue(") and " != " in line:
    line = line.replace("self.assertTrue(", "self.assertNotEqual(")
    line = line.replace(" != ", ", ", 1)
  return line

for a in sys.argv[1:]:
  with open(a, "r") as f:
    lines = f.readlines()
  with open(a, "w") as f:
    for line in lines:
      f.write(sanitize_line(line))
```

Reviewers: labath, JDevlieghere

Reviewed By: labath

Subscribers: abidh, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74475
80 files changed:
lldb/test/API/commands/disassemble/basic/TestFrameDisassemble.py
lldb/test/API/commands/expression/call-restarts/TestCallThatRestarts.py
lldb/test/API/commands/expression/call-throws/TestCallThatThrows.py
lldb/test/API/commands/expression/fixits/TestFixIts.py
lldb/test/API/commands/expression/issue_11588/Test11588.py
lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py
lldb/test/API/commands/expression/test/TestExprs.py
lldb/test/API/commands/expression/timeout/TestCallWithTimeout.py
lldb/test/API/commands/frame/language/TestGuessLanguage.py
lldb/test/API/commands/frame/var/TestFrameVar.py
lldb/test/API/commands/process/launch-with-shellexpand/TestLaunchWithShellExpand.py
lldb/test/API/commands/register/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py
lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py
lldb/test/API/commands/watchpoints/watchpoint_disable/TestWatchpointDisable.py
lldb/test/API/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py
lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
lldb/test/API/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py
lldb/test/API/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
lldb/test/API/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
lldb/test/API/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
lldb/test/API/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
lldb/test/API/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py
lldb/test/API/functionalities/data-formatter/format-propagation/TestFormatPropagation.py
lldb/test/API/functionalities/dynamic_value_child_count/TestDynamicValueChildCount.py
lldb/test/API/functionalities/memory/cache/TestMemoryCache.py
lldb/test/API/functionalities/memory/read/TestMemoryRead.py
lldb/test/API/functionalities/mtc/simple/TestMTCSimple.py
lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
lldb/test/API/functionalities/process_group/TestChangeProcessGroup.py
lldb/test/API/functionalities/return-value/TestReturnValue.py
lldb/test/API/functionalities/signal/TestSendSignal.py
lldb/test/API/functionalities/source-map/TestTargetSourceMap.py
lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py
lldb/test/API/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py
lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py
lldb/test/API/functionalities/value_md5_crash/TestValueMD5Crash.py
lldb/test/API/functionalities/var_path/TestVarPath.py
lldb/test/API/lang/c/array_types/TestArrayTypes.py
lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py
lldb/test/API/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py
lldb/test/API/lang/cpp/global_variables/TestCPPGlobalVariables.py
lldb/test/API/lang/cpp/gmodules/TestWithModuleDebugging.py
lldb/test/API/lang/cpp/stl/TestSTL.py
lldb/test/API/lang/cpp/template/TestTemplateArgs.py
lldb/test/API/lang/objc/global_ptrs/TestGlobalObjects.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-builtin-types/TestObjCBuiltinTypes.py
lldb/test/API/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
lldb/test/API/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
lldb/test/API/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py
lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
lldb/test/API/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py
lldb/test/API/lang/objc/objc-static-method/TestObjCStaticMethod.py
lldb/test/API/lang/objc/objc-struct-argument/TestObjCStructArgument.py
lldb/test/API/lang/objc/objc-struct-return/TestObjCStructReturn.py
lldb/test/API/lang/objc/objc-super/TestObjCSuper.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/TestAddDsymMidExecutionCommand.py
lldb/test/API/macosx/find-app-in-bundle/TestFindAppInBundle.py
lldb/test/API/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py
lldb/test/API/macosx/find-dsym/deep-bundle/TestDeepBundle.py
lldb/test/API/macosx/thread-names/TestInterruptThreadNames.py
lldb/test/API/macosx/universal/TestUniversal.py
lldb/test/API/python_api/class_members/TestSBTypeClassMembers.py
lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py
lldb/test/API/python_api/name_lookup/TestNameLookup.py
lldb/test/API/python_api/objc_type/TestObjCType.py
lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py
lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
lldb/test/API/python_api/value/empty_class/TestValueAPIEmptyClass.py
lldb/test/API/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py
lldb/test/API/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py
lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.py
lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
lldb/test/API/tools/lldb-vscode/stackTrace/TestVSCode_stackTrace.py