[Lldb-commits] [lldb] 619e2e0 - [lldb] Convert assertTrue(a == b) to assertEqual(a, b)
Dave Lee via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 2 12:39:11 PST 2021
Author: Dave Lee
Date: 2021-02-02T12:39:03-08:00
New Revision: 619e2e095fb1cd1e60b745cf1a10af9f67a4cd41
URL: https://github.com/llvm/llvm-project/commit/619e2e095fb1cd1e60b745cf1a10af9f67a4cd41
DIFF: https://github.com/llvm/llvm-project/commit/619e2e095fb1cd1e60b745cf1a10af9f67a4cd41.diff
LOG: [lldb] Convert assertTrue(a == b) to assertEqual(a, b)
Convert `assertTrue(a == b)` to `assertEqual(a, b)` to produce better failure messages.
These were mostly done via regex search & replace, with some manual fixes.
Differential Revision: https://reviews.llvm.org/D95813
Added:
Modified:
lldb/test/API/commands/register/register/register_command/TestRegisters.py
lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py
lldb/test/API/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
lldb/test/API/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
lldb/test/API/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py
lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
lldb/test/API/functionalities/conditional_break/TestConditionalBreak.py
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
lldb/test/API/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py
lldb/test/API/functionalities/exec/TestExec.py
lldb/test/API/functionalities/return-value/TestReturnValue.py
lldb/test/API/functionalities/tty/TestTerminal.py
lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
lldb/test/API/lang/c/bitfields/TestBitfields.py
lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py
lldb/test/API/lang/cpp/class_static/TestStaticVariables.py
lldb/test/API/lang/cpp/class_types/TestClassTypes.py
lldb/test/API/lang/cpp/dynamic-value/TestCppValueCast.py
lldb/test/API/lang/cpp/template/TestTemplateArgs.py
lldb/test/API/lang/objc/blocks/TestObjCIvarsInBlocks.py
lldb/test/API/lang/objc/foundation/TestObjCMethods.py
lldb/test/API/lang/objc/foundation/TestObjectDescriptionAPI.py
lldb/test/API/lang/objc/foundation/TestSymbolTable.py
lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py
lldb/test/API/lang/objc/objc-class-method/TestObjCClassMethod.py
lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py
lldb/test/API/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py
lldb/test/API/python_api/event/TestEvents.py
lldb/test/API/python_api/frame/TestFrames.py
lldb/test/API/python_api/frame/inlines/TestInlinedFrame.py
lldb/test/API/python_api/function_symbol/TestDisasmAPI.py
lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
lldb/test/API/python_api/lldbutil/frame/TestFrameUtils.py
lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py
lldb/test/API/python_api/process/io/TestProcessIO.py
lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
lldb/test/API/python_api/sbdata/TestSBData.py
lldb/test/API/python_api/symbol-context/TestSymbolContext.py
lldb/test/API/python_api/target/TestTargetAPI.py
lldb/test/API/python_api/thread/TestThreadAPI.py
lldb/test/API/python_api/type/TestTypeList.py
lldb/test/API/python_api/value/TestValueAPI.py
lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py
lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py
lldb/test/API/python_api/watchpoint/TestWatchpointIter.py
lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
lldb/test/API/terminal/TestSTTYBeforeAndAfter.py
lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
lldb/test/API/tools/lldb-vscode/console/TestVSCode_console.py
lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
Removed:
################################################################################
diff --git a/lldb/test/API/commands/register/register/register_command/TestRegisters.py b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
index fa8e99aefa6a..5a4038ea5a8a 100644
--- a/lldb/test/API/commands/register/register/register_command/TestRegisters.py
+++ b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
@@ -222,7 +222,7 @@ def fp_special_purpose_register_read(self):
self.assertTrue(matched, STOPPED_DUE_TO_SIGNAL)
process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
thread = process.GetThreadAtIndex(0)
diff --git a/lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py b/lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py
index 826bed8912b5..a2ee5609cf4c 100644
--- a/lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py
+++ b/lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py
@@ -84,7 +84,7 @@ def test_with_python_api(self):
local_watch.SetCondition(condition)
self.GetWatchpointEvent(lldb.eWatchpointEventTypeConditionChanged)
- self.assertTrue(local_watch.GetCondition() == condition,
+ self.assertEqual(local_watch.GetCondition(), condition,
'make sure watchpoint condition is "' + condition + '"')
def GetWatchpointEvent(self, event_type):
diff --git a/lldb/test/API/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py b/lldb/test/API/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
index a5f9458c05a0..4e9a65222d5f 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
@@ -133,7 +133,7 @@ def breakpoint_conditions_python(self):
# We didn't associate a thread index with the breakpoint, so it should
# be invalid.
- self.assertTrue(breakpoint.GetThreadIndex() == lldb.UINT32_MAX,
+ self.assertEqual(breakpoint.GetThreadIndex(), lldb.UINT32_MAX,
"The thread index should be invalid")
# The thread name should be invalid, too.
self.assertTrue(breakpoint.GetThreadName() is None,
@@ -143,7 +143,7 @@ def breakpoint_conditions_python(self):
# indeed, being set correctly.
# There's only one thread for the process.
breakpoint.SetThreadIndex(1)
- self.assertTrue(breakpoint.GetThreadIndex() == 1,
+ self.assertEqual(breakpoint.GetThreadIndex(), 1,
"The thread index has been set correctly")
# Get the breakpoint location from breakpoint after we verified that,
@@ -175,7 +175,7 @@ def breakpoint_conditions_python(self):
var.GetValue() == '3')
# The hit count for the breakpoint should be 1.
- self.assertTrue(breakpoint.GetHitCount() == 1)
+ self.assertEqual(breakpoint.GetHitCount(), 1)
# Test that the condition expression didn't create a result variable:
options = lldb.SBExpressionOptions()
@@ -217,7 +217,7 @@ def breakpoint_invalid_conditions_python(self):
"There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
var = frame0.FindValue('val', lldb.eValueTypeVariableArgument)
- self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1)
+ self.assertEqual(frame0.GetLineEntry().GetLine(), self.line1)
# The hit count for the breakpoint should be 1.
- self.assertTrue(breakpoint.GetHitCount() == 1)
+ self.assertEqual(breakpoint.GetHitCount(), 1)
diff --git a/lldb/test/API/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py b/lldb/test/API/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
index 3fa81aeadf9d..4f1e35cda114 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
@@ -120,7 +120,7 @@ def breakpoint_ignore_count_python(self):
# Set the ignore count on the breakpoint location.
location.SetIgnoreCount(2)
- self.assertTrue(location.GetIgnoreCount() == 2,
+ self.assertEqual(location.GetIgnoreCount(), 2,
"SetIgnoreCount() works correctly")
# Now launch the process, and do not stop at entry point.
@@ -145,6 +145,6 @@ def breakpoint_ignore_count_python(self):
STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT)
# The hit count for the breakpoint should be 3.
- self.assertTrue(breakpoint.GetHitCount() == 3)
+ self.assertEqual(breakpoint.GetHitCount(), 3)
process.Continue()
diff --git a/lldb/test/API/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py b/lldb/test/API/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py
index 068f563a010d..fa0a20f6938e 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py
@@ -38,9 +38,9 @@ def test(self):
self.assertTrue(process, PROCESS_IS_VALID)
list = target.FindFunctions('foo', lldb.eFunctionNameTypeAuto)
- self.assertTrue(list.GetSize() == 1)
+ self.assertEqual(list.GetSize(), 1)
sc = list.GetContextAtIndex(0)
- self.assertTrue(sc.GetSymbol().GetName() == "foo")
+ self.assertEqual(sc.GetSymbol().GetName(), "foo")
function = sc.GetFunction()
self.assertTrue(function)
self.function(function, target)
@@ -75,7 +75,7 @@ def function(self, function, target):
# Breakpoint address should be adjusted to the address of
# branch instruction.
- self.assertTrue(branchinstaddress == bpaddr)
+ self.assertEqual(branchinstaddress, bpaddr)
i += 1
else:
i += 1
diff --git a/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py b/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
index b26af93525dc..12290411fb5d 100644
--- a/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
+++ b/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
@@ -133,7 +133,7 @@ def check_equivalence(self, source_bps, do_write = True):
num_source_bps = source_bps.GetSize()
num_copy_bps = copy_bps.GetSize()
- self.assertTrue(num_source_bps == num_copy_bps, "Didn't get same number of input and output breakpoints - orig: %d copy: %d"%(num_source_bps, num_copy_bps))
+ self.assertEqual(num_source_bps, num_copy_bps, "Didn't get same number of input and output breakpoints - orig: %d copy: %d"%(num_source_bps, num_copy_bps))
for i in range(0, num_source_bps):
source_bp = source_bps.GetBreakpointAtIndex(i)
@@ -327,12 +327,12 @@ def do_check_names(self):
error = self.copy_target.BreakpointsCreateFromFile(self.bkpts_file_spec, names_list, copy_bps)
self.assertTrue(error.Success(), "Failed reading breakpoints from file: %s"%(error.GetCString()))
- self.assertTrue(copy_bps.GetSize() == 0, "Found breakpoints with a nonexistent name.")
+ self.assertEqual(copy_bps.GetSize(), 0, "Found breakpoints with a nonexistent name.")
names_list.AppendString(good_bkpt_name)
error = self.copy_target.BreakpointsCreateFromFile(self.bkpts_file_spec, names_list, copy_bps)
self.assertTrue(error.Success(), "Failed reading breakpoints from file: %s"%(error.GetCString()))
- self.assertTrue(copy_bps.GetSize() == 1, "Found the matching breakpoint.")
+ self.assertEqual(copy_bps.GetSize(), 1, "Found the matching breakpoint.")
def do_check_extra_args(self):
diff --git a/lldb/test/API/functionalities/conditional_break/TestConditionalBreak.py b/lldb/test/API/functionalities/conditional_break/TestConditionalBreak.py
index 619d8c9f2394..a2c8b42a9a10 100644
--- a/lldb/test/API/functionalities/conditional_break/TestConditionalBreak.py
+++ b/lldb/test/API/functionalities/conditional_break/TestConditionalBreak.py
@@ -49,7 +49,7 @@ def do_conditional_break(self):
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
STOPPED_DUE_TO_BREAKPOINT)
# Find the line number where a's parent frame function is c.
@@ -77,12 +77,12 @@ def do_conditional_break(self):
frame1 = thread.GetFrameAtIndex(1)
name1 = frame1.GetFunction().GetName()
# lldbutil.print_stacktrace(thread)
- self.assertTrue(name0 == "c", "Break on function c()")
+ self.assertEqual(name0, "c", "Break on function c()")
if (name1 == "a"):
# By design, we know that a() calls c() only from main.c:27.
# In reality, similar logic can be used to find out the call
# site.
- self.assertTrue(frame1.GetLineEntry().GetLine() == line,
+ self.assertEqual(frame1.GetLineEntry().GetLine(), line,
"Immediate caller a() at main.c:%d" % line)
# And the local variable 'val' should have a value of (int)
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
index 908a2d0e3722..7c21315caf95 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
@@ -56,8 +56,8 @@ def test(self):
self.assertEqual(i_atomic.GetNumChildren(), 1)
i = i_atomic.GetChildAtIndex(0)
- self.assertTrue(i.GetValueAsUnsigned(0) == 5, "i == 5")
- self.assertTrue(s.GetNumChildren() == 2, "s has two children")
+ self.assertEqual(i.GetValueAsUnsigned(0), 5, "i == 5")
+ self.assertEqual(s.GetNumChildren(), 2, "s has two children")
self.assertTrue(
s.GetChildAtIndex(0).GetValueAsUnsigned(0) == 1,
"s.x == 1")
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py b/lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
index 3a636d079fd5..79c0dfb4dbc0 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
@@ -66,10 +66,10 @@ def cleanup():
"x_val = %s; y_val = %s; z_val = %s; q_val = %s" %
(x_val(), y_val(), z_val(), q_val()))
- self.assertFalse(x_val() == 3, "x == 3 before synthetics")
- self.assertFalse(y_val() == 4, "y == 4 before synthetics")
- self.assertFalse(z_val() == 7, "z == 7 before synthetics")
- self.assertFalse(q_val() == 8, "q == 8 before synthetics")
+ self.assertNotEqual(x_val(), 3, "x == 3 before synthetics")
+ self.assertNotEqual(y_val(), 4, "y == 4 before synthetics")
+ self.assertNotEqual(z_val(), 7, "z == 7 before synthetics")
+ self.assertNotEqual(q_val(), 8, "q == 8 before synthetics")
# now set up the synth
self.runCmd("script from myIntSynthProvider import *")
@@ -82,10 +82,10 @@ def cleanup():
"x_val = %s; y_val = %s; z_val = %s; q_val = %s" %
(x_val(), y_val(), z_val(), q_val()))
- self.assertTrue(x_val() == 3, "x != 3 after synthetics")
- self.assertTrue(y_val() == 4, "y != 4 after synthetics")
- self.assertTrue(z_val() == 7, "z != 7 after synthetics")
- self.assertTrue(q_val() == 8, "q != 8 after synthetics")
+ self.assertEqual(x_val(), 3, "x != 3 after synthetics")
+ self.assertEqual(y_val(), 4, "y != 4 after synthetics")
+ self.assertEqual(z_val(), 7, "z != 7 after synthetics")
+ self.assertEqual(q_val(), 8, "q != 8 after synthetics")
self.expect("frame variable x", substrs=['3'])
self.expect(
diff --git a/lldb/test/API/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py b/lldb/test/API/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py
index e4632afe7b92..ab3499ee926d 100644
--- a/lldb/test/API/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py
+++ b/lldb/test/API/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py
@@ -55,17 +55,17 @@ def cleanup():
if self.TraceOn():
print(v)
- self.assertTrue(
- v.GetNumChildren() == 4,
+ self.assertEqual(
+ v.GetNumChildren(), 4,
"v as float32[] has 4 children")
- self.assertTrue(v.GetChildAtIndex(0).GetData().float[
- 0] == 1.25, "child 0 == 1.25")
- self.assertTrue(v.GetChildAtIndex(1).GetData().float[
- 0] == 1.25, "child 1 == 1.25")
- self.assertTrue(v.GetChildAtIndex(2).GetData().float[
- 0] == 2.50, "child 2 == 2.50")
- self.assertTrue(v.GetChildAtIndex(3).GetData().float[
- 0] == 2.50, "child 3 == 2.50")
+ self.assertEqual(v.GetChildAtIndex(0).GetData().float[0], 1.25,
+ "child 0 == 1.25")
+ self.assertEqual(v.GetChildAtIndex(1).GetData().float[0], 1.25,
+ "child 1 == 1.25")
+ self.assertEqual(v.GetChildAtIndex(2).GetData().float[0], 2.50,
+ "child 2 == 2.50")
+ self.assertEqual(v.GetChildAtIndex(3).GetData().float[0], 2.50,
+ "child 3 == 2.50")
self.expect("expr -f int16_t[] -- v",
substrs=['(0, 16288, 0, 16288, 0, 16416, 0, 16416)'])
@@ -78,11 +78,11 @@ def cleanup():
oldValue = v.GetChildAtIndex(0).GetValue()
v.SetFormat(lldb.eFormatHex)
newValue = v.GetChildAtIndex(0).GetValue()
- self.assertFalse(oldValue == newValue,
- "values did not change along with format")
+ self.assertNotEqual(oldValue, newValue,
+ "values did not change along with format")
v.SetFormat(lldb.eFormatVectorOfFloat32)
oldValueAgain = v.GetChildAtIndex(0).GetValue()
- self.assertTrue(
- oldValue == oldValueAgain,
+ self.assertEqual(
+ oldValue, oldValueAgain,
"same format but
diff erent values")
diff --git a/lldb/test/API/functionalities/exec/TestExec.py b/lldb/test/API/functionalities/exec/TestExec.py
index 354cc2579927..3d9249af4d9d 100644
--- a/lldb/test/API/functionalities/exec/TestExec.py
+++ b/lldb/test/API/functionalities/exec/TestExec.py
@@ -69,12 +69,12 @@ def cleanup():
self.addTearDownHook(cleanup)
# The stop reason of the thread should be breakpoint.
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
STOPPED_DUE_TO_BREAKPOINT)
threads = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint1)
- self.assertTrue(len(threads) == 1)
+ self.assertEqual(len(threads), 1)
# We had a deadlock tearing down the TypeSystemMap on exec, but only if some
# expression had been evaluated. So make sure we do that here so the teardown
@@ -86,16 +86,16 @@ def cleanup():
value.IsValid(),
"Expression evaluated successfully")
int_value = value.GetValueAsSigned()
- self.assertTrue(int_value == 3, "Expression got the right result.")
+ self.assertEqual(int_value, 3, "Expression got the right result.")
# Run and we should stop due to exec
process.Continue()
if not skip_exec:
- self.assertFalse(process.GetState() == lldb.eStateExited,
- "Process should not have exited!")
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- "Process should be stopped at __dyld_start")
+ self.assertNotEqual(process.GetState(), lldb.eStateExited,
+ "Process should not have exited!")
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
+ "Process should be stopped at __dyld_start")
threads = lldbutil.get_stopped_threads(
process, lldb.eStopReasonExec)
@@ -113,7 +113,7 @@ def cleanup():
print(t)
if t.GetStopReason() != lldb.eStopReasonBreakpoint:
self.runCmd("bt")
- self.assertTrue(len(threads) == 1,
+ self.assertEqual(len(threads), 1,
"Stopped at breakpoint in exec'ed process.")
@expectedFailureAll(archs=['i386'],
@@ -137,11 +137,11 @@ def test_correct_thread_plan_state_before_exec(self):
self, 'Set breakpoint 1 here', lldb.SBFileSpec('main.cpp', False))
# The stop reason of the thread should be breakpoint.
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
STOPPED_DUE_TO_BREAKPOINT)
threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint1)
- self.assertTrue(len(threads) == 1)
+ self.assertEqual(len(threads), 1)
# We perform an instruction step, which effectively sets the cache of the base
# thread plan, which should be cleared when a new thread list appears.
@@ -162,10 +162,10 @@ def test_correct_thread_plan_state_before_exec(self):
process.Continue()
- self.assertFalse(process.GetState() == lldb.eStateExited,
+ self.assertNotEqual(process.GetState(), lldb.eStateExited,
"Process should not have exited!")
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- "Process should be stopped at __dyld_start")
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
+ "Process should be stopped at __dyld_start")
threads = lldbutil.get_stopped_threads(
process, lldb.eStopReasonExec)
@@ -178,5 +178,5 @@ def test_correct_thread_plan_state_before_exec(self):
threads = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint2)
- self.assertTrue(len(threads) == 1,
+ self.assertEqual(len(threads), 1,
"Stopped at breakpoint in exec'ed process.")
diff --git a/lldb/test/API/functionalities/return-value/TestReturnValue.py b/lldb/test/API/functionalities/return-value/TestReturnValue.py
index 19756f7e299d..43e6d5f70c59 100644
--- a/lldb/test/API/functionalities/return-value/TestReturnValue.py
+++ b/lldb/test/API/functionalities/return-value/TestReturnValue.py
@@ -124,7 +124,7 @@ def test_with_python(self):
#self.assertTrue(return_value.IsValid())
#return_float = float(return_value.GetValue())
- #self.assertTrue(in_float == return_float)
+ #self.assertEqual(in_float, return_float)
if not self.affected_by_radar_34562999() and not self.affected_by_pr44132():
self.return_and_test_struct_value("return_one_int")
diff --git a/lldb/test/API/functionalities/tty/TestTerminal.py b/lldb/test/API/functionalities/tty/TestTerminal.py
index bf5f1200ace8..a89ef3865cdf 100644
--- a/lldb/test/API/functionalities/tty/TestTerminal.py
+++ b/lldb/test/API/functionalities/tty/TestTerminal.py
@@ -48,4 +48,4 @@ def test_launch_in_terminal(self):
"Make sure launch happened successfully in a terminal window")
# Running in synchronous mode our process should have run and already
# exited by the time target.Launch() returns
- self.assertTrue(process.GetState() == lldb.eStateExited)
+ self.assertEqual(process.GetState(), lldb.eStateExited)
diff --git a/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py b/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
index c1be113dc746..27fe5b5950ac 100644
--- a/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
+++ b/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
@@ -71,8 +71,8 @@ def test(self):
comp_unit = self.find_comp_unit(exe_module, 'compile_unit1.c')
cu_type = self.find_type(comp_unit.GetTypes(), 'compile_unit1_type')
- self.assertTrue(exe_module == cu_type.GetModule())
+ self.assertEqual(exe_module, cu_type.GetModule())
comp_unit = self.find_comp_unit(exe_module, 'compile_unit2.c')
cu_type = self.find_type(comp_unit.GetTypes(), 'compile_unit2_type')
- self.assertTrue(exe_module == cu_type.GetModule())
+ self.assertEqual(exe_module, cu_type.GetModule())
diff --git a/lldb/test/API/lang/c/bitfields/TestBitfields.py b/lldb/test/API/lang/c/bitfields/TestBitfields.py
index 5e4d22ff0b17..a53455fee4b5 100644
--- a/lldb/test/API/lang/c/bitfields/TestBitfields.py
+++ b/lldb/test/API/lang/c/bitfields/TestBitfields.py
@@ -213,7 +213,7 @@ def test_and_python_api(self):
bits.GetNumChildren() == 10,
"bits.GetNumChildren() == 10")
test_compiler = self.getCompiler()
- self.assertTrue(bits.GetByteSize() == 32, "bits.GetByteSize() == 32")
+ self.assertEqual(bits.GetByteSize(), 32, "bits.GetByteSize() == 32")
# Notice the pattern of int(b1.GetValue(), 0). We pass a base of 0
# so that the proper radix is determined based on the contents of the
diff --git a/lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py b/lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py
index 3fc077183421..4654c4041789 100644
--- a/lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py
+++ b/lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py
@@ -166,14 +166,14 @@ def test_and_python_api(self):
process.Continue()
- self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "a")
- self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
+ self.assertEqual(thread.GetFrameAtIndex(0).GetFunctionName(), "a")
+ self.assertEqual(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
# And one more time should get us back to main:
process.Continue()
- self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "main")
- self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
+ self.assertEqual(thread.GetFrameAtIndex(0).GetFunctionName(), "main")
+ self.assertEqual(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
# Now make sure we can call a function, break in the called function,
# then have "continue" get us back out again:
@@ -238,18 +238,18 @@ def test_and_python_api(self):
threads = lldbutil.continue_to_breakpoint(
process, break_before_complex_1)
- self.assertTrue(len(threads) == 1)
+ self.assertEqual(len(threads), 1)
thread = threads[0]
break_before_complex_1.SetEnabled(False)
thread.StepInto("b")
- self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "b")
+ self.assertEqual(thread.GetFrameAtIndex(0).GetFunctionName(), "b")
# Now continue out and stop at the next call to complex. This time
# step all the way into complex:
threads = lldbutil.continue_to_breakpoint(
process, break_before_complex_2)
- self.assertTrue(len(threads) == 1)
+ self.assertEqual(len(threads), 1)
thread = threads[0]
break_before_complex_2.SetEnabled(False)
@@ -261,7 +261,7 @@ def test_and_python_api(self):
# enable breakpoints in a and c and then step targeting b:
threads = lldbutil.continue_to_breakpoint(
process, break_before_complex_3)
- self.assertTrue(len(threads) == 1)
+ self.assertEqual(len(threads), 1)
thread = threads[0]
break_before_complex_3.SetEnabled(False)
@@ -272,7 +272,7 @@ def test_and_python_api(self):
threads = lldbutil.get_stopped_threads(
process, lldb.eStopReasonBreakpoint)
- self.assertTrue(len(threads) == 1)
+ self.assertEqual(len(threads), 1)
thread = threads[0]
stop_break_id = thread.GetStopReasonDataAtIndex(0)
self.assertTrue(stop_break_id == break_at_start_of_a.GetID()
@@ -282,15 +282,15 @@ def test_and_python_api(self):
break_at_start_of_c.SetEnabled(False)
process.Continue()
- self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "b")
+ self.assertEqual(thread.GetFrameAtIndex(0).GetFunctionName(), "b")
# Now continue out and stop at the next call to complex. This time
# enable breakpoints in a and c and then step targeting b:
threads = lldbutil.continue_to_breakpoint(
process, break_before_complex_4)
- self.assertTrue(len(threads) == 1)
+ self.assertEqual(len(threads), 1)
thread = threads[0]
break_before_complex_4.SetEnabled(False)
thread.StepInto("NoSuchFunction")
- self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "main")
+ self.assertEqual(thread.GetFrameAtIndex(0).GetFunctionName(), "main")
diff --git a/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py b/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py
index 7c019e0e7cf8..574aac372eb2 100644
--- a/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py
+++ b/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py
@@ -157,17 +157,17 @@ def test_with_python_api(self):
# SBFrame.FindValue() should also work.
val = frame.FindValue("A::g_points", lldb.eValueTypeVariableGlobal)
self.DebugSBValue(val)
- self.assertTrue(val.GetName() == 'A::g_points')
+ self.assertEqual(val.GetName(), 'A::g_points')
# Also exercise the "parameter" and "local" scopes while we are at it.
val = frame.FindValue("argc", lldb.eValueTypeVariableArgument)
self.DebugSBValue(val)
- self.assertTrue(val.GetName() == 'argc')
+ self.assertEqual(val.GetName(), 'argc')
val = frame.FindValue("argv", lldb.eValueTypeVariableArgument)
self.DebugSBValue(val)
- self.assertTrue(val.GetName() == 'argv')
+ self.assertEqual(val.GetName(), 'argv')
val = frame.FindValue("hello_world", lldb.eValueTypeVariableLocal)
self.DebugSBValue(val)
- self.assertTrue(val.GetName() == 'hello_world')
+ self.assertEqual(val.GetName(), 'hello_world')
diff --git a/lldb/test/API/lang/cpp/class_types/TestClassTypes.py b/lldb/test/API/lang/cpp/class_types/TestClassTypes.py
index 45d64431ab32..8e77e9fb31c0 100644
--- a/lldb/test/API/lang/cpp/class_types/TestClassTypes.py
+++ b/lldb/test/API/lang/cpp/class_types/TestClassTypes.py
@@ -111,7 +111,7 @@ def test_with_python_api(self):
# startstr = "main.cpp:93")
# We should be stopped on the breakpoint with a hit count of 1.
- self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE)
+ self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE)
process.Continue()
diff --git a/lldb/test/API/lang/cpp/dynamic-value/TestCppValueCast.py b/lldb/test/API/lang/cpp/dynamic-value/TestCppValueCast.py
index 609dd608aa4c..561e68f9bcbf 100644
--- a/lldb/test/API/lang/cpp/dynamic-value/TestCppValueCast.py
+++ b/lldb/test/API/lang/cpp/dynamic-value/TestCppValueCast.py
@@ -63,7 +63,7 @@ def do_sbvalue_cast(self, exe_name):
process = target.LaunchSimple(
None, None, self.get_process_working_directory())
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
# Find DerivedA and DerivedB types.
@@ -78,7 +78,7 @@ def do_sbvalue_cast(self, exe_name):
# First stop is for DerivedA instance.
threads = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint)
- self.assertTrue(len(threads) == 1)
+ self.assertEqual(len(threads), 1)
thread = threads[0]
frame0 = thread.GetFrameAtIndex(0)
@@ -103,11 +103,11 @@ def do_sbvalue_cast(self, exe_name):
print(child)
a_member_val = instanceA.GetChildMemberWithName('m_a_val')
self.DebugSBValue(a_member_val)
- self.assertTrue(a_member_val.GetValueAsUnsigned(error, 0) == 10)
+ self.assertEqual(a_member_val.GetValueAsUnsigned(error, 0), 10)
# Second stop is for DerivedB instance.
threads = lldbutil.continue_to_breakpoint(process, breakpoint)
- self.assertTrue(len(threads) == 1)
+ self.assertEqual(len(threads), 1)
thread = threads[0]
frame0 = thread.GetFrameAtIndex(0)
@@ -132,4 +132,4 @@ def do_sbvalue_cast(self, exe_name):
print(child)
b_member_val = instanceB.GetChildMemberWithName('m_b_val')
self.DebugSBValue(b_member_val)
- self.assertTrue(b_member_val.GetValueAsUnsigned(error, 0) == 36)
+ self.assertEqual(b_member_val.GetValueAsUnsigned(error, 0), 36)
diff --git a/lldb/test/API/lang/cpp/template/TestTemplateArgs.py b/lldb/test/API/lang/cpp/template/TestTemplateArgs.py
index 68cd9f69265b..46d8813ab886 100644
--- a/lldb/test/API/lang/cpp/template/TestTemplateArgs.py
+++ b/lldb/test/API/lang/cpp/template/TestTemplateArgs.py
@@ -123,7 +123,7 @@ def test_enum_args(self):
self.assertTrue(
member.IsValid(),
'make sure we find a local variabble named "member"')
- self.assertTrue(member.GetType().GetName() ==
+ self.assertEqual(member.GetType().GetName(),
'EnumTemplate<EnumType::Member>')
expr_result = frame.EvaluateExpression("member.getMember()")
@@ -143,7 +143,7 @@ def test_enum_args(self):
self.assertTrue(
subclass.IsValid(),
'make sure we find a local variabble named "subclass"')
- self.assertTrue(subclass.GetType().GetName() ==
+ self.assertEqual(subclass.GetType().GetName(),
'EnumTemplate<EnumType::Subclass>')
expr_result = frame.EvaluateExpression("subclass.getMember()")
diff --git a/lldb/test/API/lang/objc/blocks/TestObjCIvarsInBlocks.py b/lldb/test/API/lang/objc/blocks/TestObjCIvarsInBlocks.py
index a7f88c1d7d91..fd78b0fe1610 100644
--- a/lldb/test/API/lang/objc/blocks/TestObjCIvarsInBlocks.py
+++ b/lldb/test/API/lang/objc/blocks/TestObjCIvarsInBlocks.py
@@ -48,7 +48,7 @@ def test_with_python_api(self):
thread_list = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint)
- self.assertTrue(len(thread_list) == 1)
+ self.assertEqual(len(thread_list), 1)
thread = thread_list[0]
frame = thread.GetFrameAtIndex(0)
@@ -113,7 +113,7 @@ def test_with_python_api(self):
thread_list = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint_two)
- self.assertTrue(len(thread_list) == 1)
+ self.assertEqual(len(thread_list), 1)
thread = thread_list[0]
frame = thread.GetFrameAtIndex(0)
diff --git a/lldb/test/API/lang/objc/foundation/TestObjCMethods.py b/lldb/test/API/lang/objc/foundation/TestObjCMethods.py
index 8f43ecf17bc1..e62af3910695 100644
--- a/lldb/test/API/lang/objc/foundation/TestObjCMethods.py
+++ b/lldb/test/API/lang/objc/foundation/TestObjCMethods.py
@@ -253,7 +253,7 @@ def test_print_ivars_correctly(self):
cur_frame = thread.GetFrameAtIndex(0)
line_number = cur_frame.GetLineEntry().GetLine()
- self.assertTrue(line_number == self.line, "Hit the first breakpoint.")
+ self.assertEqual(line_number, self.line, "Hit the first breakpoint.")
my_var = cur_frame.FindVariable("my")
self.assertTrue(my_var, "Made a variable object for my")
@@ -320,5 +320,5 @@ def cleanup():
"error: found spurious name lookups when evaluating an expression:")
num_errors += 1
print(line, end='')
- self.assertTrue(num_errors == 0, "Spurious lookups detected")
+ self.assertEqual(num_errors, 0, "Spurious lookups detected")
f.close()
diff --git a/lldb/test/API/lang/objc/foundation/TestObjectDescriptionAPI.py b/lldb/test/API/lang/objc/foundation/TestObjectDescriptionAPI.py
index 43b7c8357835..f09b8ea51432 100644
--- a/lldb/test/API/lang/objc/foundation/TestObjectDescriptionAPI.py
+++ b/lldb/test/API/lang/objc/foundation/TestObjectDescriptionAPI.py
@@ -46,7 +46,7 @@ def test_find_global_variables_then_object_description(self):
# Make sure we hit our breakpoint:
thread_list = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint)
- self.assertTrue(len(thread_list) == 1)
+ self.assertEqual(len(thread_list), 1)
thread = thread_list[0]
frame0 = thread.GetFrameAtIndex(0)
@@ -59,7 +59,7 @@ def test_find_global_variables_then_object_description(self):
print("val:", v)
print("object description:", v.GetObjectDescription())
if v.GetName() == 'my_global_str':
- self.assertTrue(v.GetObjectDescription() ==
+ self.assertEqual(v.GetObjectDescription(),
'This is a global string')
# But not here!
@@ -70,5 +70,5 @@ def test_find_global_variables_then_object_description(self):
print("val:", v)
print("object description:", v.GetObjectDescription())
if v.GetName() == 'my_global_str':
- self.assertTrue(v.GetObjectDescription() ==
+ self.assertEqual(v.GetObjectDescription(),
'This is a global string')
diff --git a/lldb/test/API/lang/objc/foundation/TestSymbolTable.py b/lldb/test/API/lang/objc/foundation/TestSymbolTable.py
index b94934bba4f3..63482a52f6b7 100644
--- a/lldb/test/API/lang/objc/foundation/TestSymbolTable.py
+++ b/lldb/test/API/lang/objc/foundation/TestSymbolTable.py
@@ -68,5 +68,5 @@ def test_with_python_api(self):
# At this point, the known_symbols set should have become an empty set.
# If not, raise an error.
self.trace("symbols unaccounted for:", expected_symbols)
- self.assertTrue(len(expected_symbols) == 0,
+ self.assertEqual(len(expected_symbols), 0,
"All the known symbols are accounted for")
diff --git a/lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py b/lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py
index 19335959313a..16a34e043c91 100644
--- a/lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py
+++ b/lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py
@@ -49,12 +49,12 @@ def test_objc_checker(self):
process = target.LaunchSimple(
None, None, self.get_process_working_directory())
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
threads = lldbutil.get_threads_stopped_at_breakpoint(
process, main_bkpt)
- self.assertTrue(len(threads) == 1)
+ self.assertEqual(len(threads), 1)
thread = threads[0]
#
diff --git a/lldb/test/API/lang/objc/objc-class-method/TestObjCClassMethod.py b/lldb/test/API/lang/objc/objc-class-method/TestObjCClassMethod.py
index eb6ab2a5b6d8..27d4507e6f07 100644
--- a/lldb/test/API/lang/objc/objc-class-method/TestObjCClassMethod.py
+++ b/lldb/test/API/lang/objc/objc-class-method/TestObjCClassMethod.py
@@ -47,7 +47,7 @@ def test_with_python_api(self):
self.assertTrue(
len(thread_list) != 0,
"No thread stopped at our breakpoint.")
- self.assertTrue(len(thread_list) == 1,
+ self.assertEqual(len(thread_list), 1,
"More than one thread stopped at our breakpoint.")
# Now make sure we can call a function in the class method we've
@@ -62,4 +62,4 @@ def test_with_python_api(self):
print("cmd_value is valid")
print("cmd_value has the value %d" % cmd_value.GetValueAsUnsigned())
self.assertTrue(cmd_value.IsValid())
- self.assertTrue(cmd_value.GetValueAsUnsigned() == 5)
+ self.assertEqual(cmd_value.GetValueAsUnsigned(), 5)
diff --git a/lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py b/lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py
index 49992f49a355..80b39d29c835 100644
--- a/lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py
+++ b/lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py
@@ -47,13 +47,13 @@ def test_disassemble_raw_data(self):
print("Raw bytes: ", [hex(x) for x in raw_bytes])
print("Disassembled%s" % str(inst))
if re.match("mips", arch):
- self.assertTrue(inst.GetMnemonic(target) == "move")
- self.assertTrue(inst.GetOperands(target) ==
+ self.assertEqual(inst.GetMnemonic(target), "move")
+ self.assertEqual(inst.GetOperands(target),
'$' + "fp, " + '$' + "sp")
elif re.match("powerpc64le", arch):
- self.assertTrue(inst.GetMnemonic(target) == "li")
- self.assertTrue(inst.GetOperands(target) == "4, 0")
+ self.assertEqual(inst.GetMnemonic(target), "li")
+ self.assertEqual(inst.GetOperands(target), "4, 0")
else:
- self.assertTrue(inst.GetMnemonic(target) == "movq")
- self.assertTrue(inst.GetOperands(target) ==
+ self.assertEqual(inst.GetMnemonic(target), "movq")
+ self.assertEqual(inst.GetOperands(target),
'%' + "rsp, " + '%' + "rbp")
diff --git a/lldb/test/API/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py b/lldb/test/API/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py
index fd5c9ec59ea9..86c51a28e082 100644
--- a/lldb/test/API/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py
+++ b/lldb/test/API/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py
@@ -76,4 +76,4 @@ def split(s):
print("Raw bytes: ", [hex(x) for x in raw_bytes])
print("Disassembled%s" % str(inst))
- self.assertTrue(inst.GetMnemonic(target) == "vst1.64")
+ self.assertEqual(inst.GetMnemonic(target), "vst1.64")
diff --git a/lldb/test/API/python_api/event/TestEvents.py b/lldb/test/API/python_api/event/TestEvents.py
index 238e9eb302d0..5816fc3e12b7 100644
--- a/lldb/test/API/python_api/event/TestEvents.py
+++ b/lldb/test/API/python_api/event/TestEvents.py
@@ -315,5 +315,5 @@ def run(self):
my_thread.join()
# The final judgement. :-)
- self.assertTrue(self.state == 'stopped',
+ self.assertEqual(self.state, 'stopped',
"Both expected state changed events received")
diff --git a/lldb/test/API/python_api/frame/TestFrames.py b/lldb/test/API/python_api/frame/TestFrames.py
index 1ec66a3ddbeb..23de180bd5f5 100644
--- a/lldb/test/API/python_api/frame/TestFrames.py
+++ b/lldb/test/API/python_api/frame/TestFrames.py
@@ -38,7 +38,7 @@ def test_get_arg_vals_for_call_stack(self):
None, None, self.get_process_working_directory())
process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
# Keeps track of the number of times 'a' is called where it is within a
@@ -94,8 +94,9 @@ def test_get_arg_vals_for_call_stack(self):
sp_value = gpr_reg_set.GetChildMemberWithName("sp")
self.assertTrue(
sp_value, "We should have a valid Stack Pointer.")
- self.assertTrue(int(sp_value.GetValue(), 0) == frame.GetSP(
- ), "SP gotten as a value should equal frame's GetSP")
+ self.assertEqual(
+ int(sp_value.GetValue(), 0), frame.GetSP(),
+ "SP gotten as a value should equal frame's GetSP")
print("---", file=session)
process.Continue()
@@ -106,7 +107,7 @@ def test_get_arg_vals_for_call_stack(self):
PROCESS_EXITED)
# Expect to find 'a' on the call stacks two times.
- self.assertTrue(callsOfA == 2,
+ self.assertEqual(callsOfA, 2,
"Expect to find 'a' on the call stacks two times")
# By design, the 'a' call frame has the following arg vals:
# o a((int)val=1, (char)ch='A')
@@ -141,7 +142,7 @@ def test_frame_api_boundary_condition(self):
None, None, self.get_process_working_directory())
process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
thread = lldbutil.get_stopped_thread(
@@ -183,7 +184,7 @@ def test_frame_api_IsEqual(self):
None, None, self.get_process_working_directory())
process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
thread = lldbutil.get_stopped_thread(
diff --git a/lldb/test/API/python_api/frame/inlines/TestInlinedFrame.py b/lldb/test/API/python_api/frame/inlines/TestInlinedFrame.py
index eb40b4c4993e..46b9b9f31911 100644
--- a/lldb/test/API/python_api/frame/inlines/TestInlinedFrame.py
+++ b/lldb/test/API/python_api/frame/inlines/TestInlinedFrame.py
@@ -47,7 +47,7 @@ def test_stop_at_outer_inline(self):
None, None, self.get_process_working_directory())
process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
import lldbsuite.test.lldbutil as lldbutil
@@ -70,7 +70,7 @@ def test_stop_at_outer_inline(self):
frame0 = thread.GetFrameAtIndex(0)
if frame0.IsInlined():
filename = frame0.GetLineEntry().GetFileSpec().GetFilename()
- self.assertTrue(filename == self.source)
+ self.assertEqual(filename, self.source)
self.expect(
stack_traces1, "First stop at %s:%d" %
(self.source, self.first_stop), exe=False, substrs=[
@@ -79,7 +79,7 @@ def test_stop_at_outer_inline(self):
# Expect to break again for the second time.
process.Continue()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
stack_traces2 = lldbutil.print_stacktraces(
process, string_buffer=True)
diff --git a/lldb/test/API/python_api/function_symbol/TestDisasmAPI.py b/lldb/test/API/python_api/function_symbol/TestDisasmAPI.py
index 01d26da060d2..d67798ebc70b 100644
--- a/lldb/test/API/python_api/function_symbol/TestDisasmAPI.py
+++ b/lldb/test/API/python_api/function_symbol/TestDisasmAPI.py
@@ -53,7 +53,7 @@ def test(self):
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.line1.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(
@@ -61,7 +61,7 @@ def test(self):
"There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
- self.assertTrue(lineEntry.GetLine() == self.line1)
+ self.assertEqual(lineEntry.GetLine(), self.line1)
address1 = lineEntry.GetStartAddress()
self.trace("address1:", address1)
@@ -76,7 +76,7 @@ def test(self):
# Continue the inferior, the breakpoint 2 should be hit.
process.Continue()
- self.assertTrue(process.GetState() == lldb.eStateStopped)
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(
@@ -84,7 +84,7 @@ def test(self):
"There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
- self.assertTrue(lineEntry.GetLine() == self.line2)
+ self.assertEqual(lineEntry.GetLine(), self.line2)
# Verify that the symbol and the function has the same address range
# per function 'a'.
diff --git a/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py b/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
index c5bcb152beb0..09e7db7fcefc 100644
--- a/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
+++ b/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
@@ -53,7 +53,7 @@ def test(self):
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.line1.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(
@@ -62,7 +62,7 @@ def test(self):
frame0 = thread.GetFrameAtIndex(0)
symbol_line1 = frame0.GetSymbol()
# We should have a symbol type of code.
- self.assertTrue(symbol_line1.GetType() == lldb.eSymbolTypeCode)
+ self.assertEqual(symbol_line1.GetType(), lldb.eSymbolTypeCode)
addr_line1 = symbol_line1.GetStartAddress()
# And a section type of code, too.
self.assertTrue(addr_line1.GetSection().GetSectionType()
@@ -70,7 +70,7 @@ def test(self):
# Continue the inferior, the breakpoint 2 should be hit.
process.Continue()
- self.assertTrue(process.GetState() == lldb.eStateStopped)
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(
@@ -79,7 +79,7 @@ def test(self):
frame0 = thread.GetFrameAtIndex(0)
symbol_line2 = frame0.GetSymbol()
# We should have a symbol type of code.
- self.assertTrue(symbol_line2.GetType() == lldb.eSymbolTypeCode)
+ self.assertEqual(symbol_line2.GetType(), lldb.eSymbolTypeCode)
addr_line2 = symbol_line2.GetStartAddress()
# And a section type of code, too.
self.assertTrue(addr_line2.GetSection().GetSectionType()
diff --git a/lldb/test/API/python_api/lldbutil/frame/TestFrameUtils.py b/lldb/test/API/python_api/lldbutil/frame/TestFrameUtils.py
index ec8d1f84ded8..09a179cb70d9 100644
--- a/lldb/test/API/python_api/lldbutil/frame/TestFrameUtils.py
+++ b/lldb/test/API/python_api/lldbutil/frame/TestFrameUtils.py
@@ -40,7 +40,7 @@ def test_frame_utils(self):
if not process:
self.fail("SBTarget.LaunchProcess() failed")
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
import lldbsuite.test.lldbutil as lldbutil
diff --git a/lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py b/lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py
index 050ec87fb2b9..0397b0fb0762 100644
--- a/lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py
+++ b/lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py
@@ -50,7 +50,7 @@ def test_lldb_iter_module(self):
for m in target.module_iter():
mine.append(m)
- self.assertTrue(len(yours) == len(mine))
+ self.assertEqual(len(yours), len(mine))
for i in range(len(yours)):
if self.TraceOn():
print("yours[%d]='%s'" % (i, get_description(yours[i])))
@@ -73,7 +73,7 @@ def test_lldb_iter_breakpoint(self):
breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line2)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
- self.assertTrue(target.GetNumBreakpoints() == 2)
+ self.assertEqual(target.GetNumBreakpoints(), 2)
from lldbsuite.test.lldbutil import get_description
yours = []
@@ -83,12 +83,12 @@ def test_lldb_iter_breakpoint(self):
for b in target.breakpoint_iter():
mine.append(b)
- self.assertTrue(len(yours) == len(mine))
+ self.assertEqual(len(yours), len(mine))
for i in range(len(yours)):
if self.TraceOn():
print("yours[%d]='%s'" % (i, get_description(yours[i])))
print("mine[%d]='%s'" % (i, get_description(mine[i])))
- self.assertTrue(yours[i] == mine[i],
+ self.assertEqual(yours[i], mine[i],
"ID of yours[{0}] and mine[{0}] matches".format(i))
@add_test_categories(['pyapi'])
@@ -119,7 +119,7 @@ def test_lldb_iter_frame(self):
if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
stopped_due_to_breakpoint = True
for frame in thread:
- self.assertTrue(frame.GetThread().GetThreadID() == ID)
+ self.assertEqual(frame.GetThread().GetThreadID(), ID)
if self.TraceOn():
print(frame)
diff --git a/lldb/test/API/python_api/process/io/TestProcessIO.py b/lldb/test/API/python_api/process/io/TestProcessIO.py
index 4646c9da58ac..3f210bc71bef 100644
--- a/lldb/test/API/python_api/process/io/TestProcessIO.py
+++ b/lldb/test/API/python_api/process/io/TestProcessIO.py
@@ -201,7 +201,7 @@ def run_process(self, put_stdin):
threads = lldbutil.get_threads_stopped_at_breakpoint(
self.process, self.breakpoint)
- self.assertTrue(len(threads) == 1)
+ self.assertEqual(len(threads), 1)
self.thread = threads[0]
self.frame = self.thread.frames[0]
self.assertTrue(self.frame, "Frame 0 is valid.")
@@ -217,7 +217,7 @@ def run_process(self, put_stdin):
# Let process continue so it will exit
self.process.Continue()
state = self.process.GetState()
- self.assertTrue(state == lldb.eStateExited, PROCESS_IS_VALID)
+ self.assertEqual(state, lldb.eStateExited, PROCESS_IS_VALID)
def check_process_output(self, output, error):
# Since we launched the process without specifying stdin/out/err,
diff --git a/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py b/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
index f18b8e35f8b9..0e5aa0ba97ba 100644
--- a/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
+++ b/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
@@ -48,11 +48,11 @@ def test_read_memory_c_string(self):
# None object.
empty_str = process.ReadCStringFromMemory(empty_str_addr, 2048, err)
self.assertTrue(err.Success())
- self.assertTrue(empty_str == "")
+ self.assertEqual(empty_str, "")
one_letter_string = process.ReadCStringFromMemory(one_letter_str_addr, 2048, err)
self.assertTrue(err.Success())
- self.assertTrue(one_letter_string == "1")
+ self.assertEqual(one_letter_string, "1")
invalid_memory_string = process.ReadCStringFromMemory(invalid_memory_str_addr, 2048, err)
self.assertTrue(err.Fail())
diff --git a/lldb/test/API/python_api/sbdata/TestSBData.py b/lldb/test/API/python_api/sbdata/TestSBData.py
index ee0496804241..16381b8eb18f 100644
--- a/lldb/test/API/python_api/sbdata/TestSBData.py
+++ b/lldb/test/API/python_api/sbdata/TestSBData.py
@@ -30,16 +30,16 @@ def test_byte_order_and_address_byte_size(self):
data = lldb.SBData()
data.SetData(error, addr_data, lldb.eByteOrderBig, 4)
addr = data.GetAddress(error, 0)
- self.assertTrue(addr == 0x11223344);
+ self.assertEqual(addr, 0x11223344);
data.SetData(error, addr_data, lldb.eByteOrderBig, 8)
addr = data.GetAddress(error, 0)
- self.assertTrue(addr == 0x1122334455667788);
+ self.assertEqual(addr, 0x1122334455667788);
data.SetData(error, addr_data, lldb.eByteOrderLittle, 4)
addr = data.GetAddress(error, 0)
- self.assertTrue(addr == 0x44332211);
+ self.assertEqual(addr, 0x44332211);
data.SetData(error, addr_data, lldb.eByteOrderLittle, 8)
addr = data.GetAddress(error, 0)
- self.assertTrue(addr == 0x8877665544332211);
+ self.assertEqual(addr, 0x8877665544332211);
@add_test_categories(['pyapi'])
@skipIfReproducer # SBData::SetData is not instrumented.
@@ -146,8 +146,8 @@ def test_with_run_command(self):
self.assertTrue(new_foobar.IsValid())
data = new_foobar.GetData()
- self.assertTrue(data.uint32[0] == 8, 'then foo[1].a == 8')
- self.assertTrue(data.uint32[1] == 7, 'then foo[1].b == 7')
+ self.assertEqual(data.uint32[0], 8, 'then foo[1].a == 8')
+ self.assertEqual(data.uint32[1], 7, 'then foo[1].b == 7')
# exploiting that sizeof(uint32) == sizeof(float)
self.assertTrue(fabs(data.float[2] - 3.14) < 1, 'foo[1].c == 3.14')
@@ -218,7 +218,7 @@ def test_with_run_command(self):
new_object = barfoo.CreateValueFromData(
"new_object", data, barfoo.GetType().GetBasicType(
lldb.eBasicTypeInt))
- self.assertTrue(new_object.GetValue() == "1", 'new_object == 1')
+ self.assertEqual(new_object.GetValue(), "1", 'new_object == 1')
if data.GetByteOrder() == lldb.eByteOrderBig:
data.SetData(
@@ -262,12 +262,12 @@ def test_with_run_command(self):
hello_str = "hello!"
data2 = lldb.SBData.CreateDataFromCString(
process.GetByteOrder(), process.GetAddressByteSize(), hello_str)
- self.assertTrue(len(data2.uint8) == len(hello_str))
- self.assertTrue(data2.uint8[0] == 104, 'h == 104')
- self.assertTrue(data2.uint8[1] == 101, 'e == 101')
- self.assertTrue(data2.uint8[2] == 108, 'l == 108')
+ self.assertEqual(len(data2.uint8), len(hello_str))
+ self.assertEqual(data2.uint8[0], 104, 'h == 104')
+ self.assertEqual(data2.uint8[1], 101, 'e == 101')
+ self.assertEqual(data2.uint8[2], 108, 'l == 108')
self.assert_data(data2.GetUnsignedInt8, 3, 108) # l
- self.assertTrue(data2.uint8[4] == 111, 'o == 111')
+ self.assertEqual(data2.uint8[4], 111, 'o == 111')
self.assert_data(data2.GetUnsignedInt8, 5, 33) # !
uint_lists = [[1, 2, 3, 4, 5], [int(i) for i in [1, 2, 3, 4, 5]]]
@@ -415,7 +415,7 @@ def test_with_run_command(self):
data2 = lldb.SBData()
data2.SetDataFromCString(hello_str)
- self.assertTrue(len(data2.uint8) == len(hello_str))
+ self.assertEqual(len(data2.uint8), len(hello_str))
self.assert_data(data2.GetUnsignedInt8, 0, 104)
self.assert_data(data2.GetUnsignedInt8, 1, 101)
self.assert_data(data2.GetUnsignedInt8, 2, 108)
diff --git a/lldb/test/API/python_api/symbol-context/TestSymbolContext.py b/lldb/test/API/python_api/symbol-context/TestSymbolContext.py
index cbe4eff0a5e3..742ececee428 100644
--- a/lldb/test/API/python_api/symbol-context/TestSymbolContext.py
+++ b/lldb/test/API/python_api/symbol-context/TestSymbolContext.py
@@ -49,7 +49,7 @@ def test(self):
self.assertTrue(thread.IsValid(),
"There should be a thread stopped due to breakpoint")
frame0 = thread.GetFrameAtIndex(0)
- self.assertTrue(frame0.GetLineEntry().GetLine() == self.line)
+ self.assertEqual(frame0.GetLineEntry().GetLine(), self.line)
# Now get the SBSymbolContext from this frame. We want everything. :-)
context = frame0.GetSymbolContext(lldb.eSymbolContextEverything)
@@ -81,7 +81,7 @@ def test(self):
"The line entry should have the correct filename",
exe=False,
substrs=['main.c'])
- self.assertTrue(lineEntry.GetLine() == self.line,
+ self.assertEqual(lineEntry.GetLine(), self.line,
"The line entry's line number should match ")
symbol = context.GetSymbol()
diff --git a/lldb/test/API/python_api/target/TestTargetAPI.py b/lldb/test/API/python_api/target/TestTargetAPI.py
index ae9ff126b7b4..a8a10e4c7759 100644
--- a/lldb/test/API/python_api/target/TestTargetAPI.py
+++ b/lldb/test/API/python_api/target/TestTargetAPI.py
@@ -244,11 +244,11 @@ def find_global_variables(self, exe_name):
# Make sure we hit our breakpoint:
thread_list = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint)
- self.assertTrue(len(thread_list) == 1)
+ self.assertEqual(len(thread_list), 1)
value_list = target.FindGlobalVariables(
'my_global_var_of_char_type', 3)
- self.assertTrue(value_list.GetSize() == 1)
+ self.assertEqual(value_list.GetSize(), 1)
my_global_var = value_list.GetValueAtIndex(0)
self.DebugSBValue(my_global_var)
self.assertTrue(my_global_var)
@@ -267,7 +267,7 @@ def find_global_variables(self, exe_name):
if os.path.normpath(m.GetFileSpec().GetDirectory()) == self.getBuildDir() and m.GetFileSpec().GetFilename() == exe_name:
value_list = m.FindGlobalVariables(
target, 'my_global_var_of_char_type', 3)
- self.assertTrue(value_list.GetSize() == 1)
+ self.assertEqual(value_list.GetSize(), 1)
self.assertTrue(
value_list.GetValueAtIndex(0).GetValue() == "'X'")
break
@@ -296,15 +296,15 @@ def find_functions(self, exe_name):
# Try it with a null name:
list = target.FindFunctions(None, lldb.eFunctionNameTypeAuto)
- self.assertTrue(list.GetSize() == 0)
+ self.assertEqual(list.GetSize(), 0)
list = target.FindFunctions('c', lldb.eFunctionNameTypeAuto)
- self.assertTrue(list.GetSize() == 1)
+ self.assertEqual(list.GetSize(), 1)
for sc in list:
self.assertTrue(
sc.GetModule().GetFileSpec().GetFilename() == exe_name)
- self.assertTrue(sc.GetSymbol().GetName() == 'c')
+ self.assertEqual(sc.GetSymbol().GetName(), 'c')
def get_description(self):
"""Exercise SBTaget.GetDescription() API."""
@@ -422,7 +422,7 @@ def resolve_symbol_context_with_address(self):
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.line1.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(
@@ -431,13 +431,13 @@ def resolve_symbol_context_with_address(self):
#self.runCmd("process status")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
- self.assertTrue(lineEntry.GetLine() == self.line1)
+ self.assertEqual(lineEntry.GetLine(), self.line1)
address1 = lineEntry.GetStartAddress()
# Continue the inferior, the breakpoint 2 should be hit.
process.Continue()
- self.assertTrue(process.GetState() == lldb.eStateStopped)
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(
@@ -446,7 +446,7 @@ def resolve_symbol_context_with_address(self):
#self.runCmd("process status")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
- self.assertTrue(lineEntry.GetLine() == self.line2)
+ self.assertEqual(lineEntry.GetLine(), self.line2)
address2 = lineEntry.GetStartAddress()
diff --git a/lldb/test/API/python_api/thread/TestThreadAPI.py b/lldb/test/API/python_api/thread/TestThreadAPI.py
index c97be6cf4529..420510a5c085 100644
--- a/lldb/test/API/python_api/thread/TestThreadAPI.py
+++ b/lldb/test/API/python_api/thread/TestThreadAPI.py
@@ -203,7 +203,7 @@ def step_over_3_times(self, exe_name):
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.step_out_of_malloc.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
self.assertTrue(
thread.IsValid(),
@@ -211,7 +211,7 @@ def step_over_3_times(self, exe_name):
self.runCmd("thread backtrace")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
- self.assertTrue(lineEntry.GetLine() == self.step_out_of_malloc)
+ self.assertEqual(lineEntry.GetLine(), self.step_out_of_malloc)
thread.StepOver()
thread.StepOver()
@@ -222,13 +222,13 @@ def step_over_3_times(self, exe_name):
# main2.cpp.
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
- self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
+ self.assertEqual(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
# Expected failure with clang as the compiler.
# rdar://problem/9223880
#
# Which has been fixed on the lldb by compensating for inaccurate line
# table information with r140416.
- self.assertTrue(lineEntry.GetLine() == self.after_3_step_overs)
+ self.assertEqual(lineEntry.GetLine(), self.after_3_step_overs)
def run_to_address(self, exe_name):
"""Test Python SBThread.RunToAddress() API."""
@@ -249,7 +249,7 @@ def run_to_address(self, exe_name):
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.step_out_of_malloc.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
self.assertTrue(
thread.IsValid(),
@@ -257,7 +257,7 @@ def run_to_address(self, exe_name):
self.runCmd("thread backtrace")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
- self.assertTrue(lineEntry.GetLine() == self.step_out_of_malloc)
+ self.assertEqual(lineEntry.GetLine(), self.step_out_of_malloc)
# Get the start/end addresses for this line entry.
start_addr = lineEntry.GetStartAddress().GetLoadAddress(target)
diff --git a/lldb/test/API/python_api/type/TestTypeList.py b/lldb/test/API/python_api/type/TestTypeList.py
index 359dfe8cf5a9..9d4f16413f1b 100644
--- a/lldb/test/API/python_api/type/TestTypeList.py
+++ b/lldb/test/API/python_api/type/TestTypeList.py
@@ -47,7 +47,7 @@ def test(self):
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(
@@ -113,13 +113,13 @@ def test(self):
self.DebugSBType(task_head_type)
self.assertTrue(task_head_type.IsPointerType())
- self.assertTrue(task_head_type == task_pointer_type)
+ self.assertEqual(task_head_type, task_pointer_type)
# Get the pointee type of 'task_head'.
task_head_pointee_type = task_head_type.GetPointeeType()
self.DebugSBType(task_head_pointee_type)
- self.assertTrue(task_type == task_head_pointee_type)
+ self.assertEqual(task_type, task_head_pointee_type)
# We'll now get the child member 'id' from 'task_head'.
id = task_head.GetChildMemberWithName('id')
@@ -130,7 +130,7 @@ def test(self):
# SBType.GetBasicType() takes an enum 'BasicType'
# (lldb-enumerations.h).
int_type = id_type.GetBasicType(lldb.eBasicTypeInt)
- self.assertTrue(id_type == int_type)
+ self.assertEqual(id_type, int_type)
# Find 'myint_arr' and check the array element type.
myint_arr = frame0.FindVariable('myint_arr')
@@ -143,7 +143,7 @@ def test(self):
self.DebugSBType(myint_arr_element_type)
myint_type = target.FindFirstType('myint')
self.DebugSBType(myint_type)
- self.assertTrue(myint_arr_element_type == myint_type)
+ self.assertEqual(myint_arr_element_type, myint_type)
# Test enum methods. Requires DW_AT_enum_class which was added in Dwarf 4.
if configuration.dwarf_version >= 4:
diff --git a/lldb/test/API/python_api/value/TestValueAPI.py b/lldb/test/API/python_api/value/TestValueAPI.py
index bf8cbe34320b..d6fff9be5da5 100644
--- a/lldb/test/API/python_api/value/TestValueAPI.py
+++ b/lldb/test/API/python_api/value/TestValueAPI.py
@@ -46,7 +46,7 @@ def test(self):
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(
@@ -79,14 +79,14 @@ def test(self):
list = target.FindGlobalVariables('weekdays', 1)
weekdays = list.GetValueAtIndex(0)
self.assertTrue(weekdays, VALID_VARIABLE)
- self.assertTrue(weekdays.GetNumChildren() == 5, VALID_VARIABLE)
+ self.assertEqual(weekdays.GetNumChildren(), 5, VALID_VARIABLE)
self.DebugSBValue(weekdays)
# Get global variable 'g_table'.
list = target.FindGlobalVariables('g_table', 1)
g_table = list.GetValueAtIndex(0)
self.assertTrue(g_table, VALID_VARIABLE)
- self.assertTrue(g_table.GetNumChildren() == 2, VALID_VARIABLE)
+ self.assertEqual(g_table.GetNumChildren(), 2, VALID_VARIABLE)
self.DebugSBValue(g_table)
fmt = lldbutil.BasicFormatter()
@@ -126,9 +126,9 @@ def test(self):
# Verify the SBValue::GetByteSize() API is working correctly.
arch = self.getArchitecture()
if arch == 'i386':
- self.assertTrue(value.GetByteSize() == 4)
+ self.assertEqual(value.GetByteSize(), 4)
elif arch == 'x86_64':
- self.assertTrue(value.GetByteSize() == 8)
+ self.assertEqual(value.GetByteSize(), 8)
# Get child at index 5 => 'Friday'.
child = value.GetChildAtIndex(5, lldb.eNoDynamicValues, True)
diff --git a/lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py b/lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py
index b45186a3150f..f01ce035646f 100644
--- a/lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py
+++ b/lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py
@@ -50,7 +50,7 @@ def test(self):
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(
@@ -80,7 +80,7 @@ def test(self):
# Sanity checks that the we visited all the items (no more, no less).
if self.TraceOn():
print("visited IDs:", list)
- self.assertTrue(visitedIDs == list)
+ self.assertEqual(visitedIDs, list)
# Let's exercise the linked_list_iter() API again, this time supplying
# our end of list test function.
@@ -111,7 +111,7 @@ def eol(val):
# Sanity checks that the we visited all the items (no more, no less).
if self.TraceOn():
print("visited IDs:", list)
- self.assertTrue(visitedIDs == list)
+ self.assertEqual(visitedIDs, list)
# Get variable 'empty_task_head'.
empty_task_head = frame0.FindVariable('empty_task_head')
@@ -125,7 +125,7 @@ def eol(val):
print(cvf.format(t))
list.append(int(t.GetChildMemberWithName("id").GetValue()))
- self.assertTrue(len(list) == 0)
+ self.assertEqual(len(list), 0)
# Get variable 'task_evil'.
task_evil = frame0.FindVariable('task_evil')
@@ -139,4 +139,4 @@ def eol(val):
print(cvf.format(t))
list.append(int(t.GetChildMemberWithName("id").GetValue()))
- self.assertTrue(len(list) == 3)
+ self.assertEqual(len(list), 3)
diff --git a/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py b/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py
index 49ecf7aee39c..9ac5d834d502 100644
--- a/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py
+++ b/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py
@@ -49,7 +49,7 @@ def test_watch_val(self):
# We should be stopped due to the breakpoint. Get frame #0.
process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
diff --git a/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py b/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py
index 44df96bae5eb..1a001f9932c3 100644
--- a/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py
+++ b/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py
@@ -52,7 +52,7 @@ def test_watch_iter(self):
# We should be stopped due to the breakpoint. Get frame #0.
process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
@@ -71,7 +71,7 @@ def test_watch_iter(self):
self.HideStdout()
# There should be only 1 watchpoint location under the target.
- self.assertTrue(target.GetNumWatchpoints() == 1)
+ self.assertEqual(target.GetNumWatchpoints(), 1)
self.assertTrue(watchpoint.IsEnabled())
watch_id = watchpoint.GetID()
self.assertTrue(watch_id != 0)
@@ -105,7 +105,7 @@ def test_watch_iter(self):
# Now disable the 'rw' watchpoint. The program won't stop when it reads
# 'global' next.
watchpoint.SetEnabled(False)
- self.assertTrue(watchpoint.GetHardwareIndex() == -1)
+ self.assertEqual(watchpoint.GetHardwareIndex(), -1)
self.assertFalse(watchpoint.IsEnabled())
# Continue. The program does not stop again when the variable is being
@@ -120,6 +120,6 @@ def test_watch_iter(self):
# Verify some vital statistics and exercise the iterator API.
for watchpoint in target.watchpoint_iter():
self.assertTrue(watchpoint)
- self.assertTrue(watchpoint.GetWatchSize() == 4)
- self.assertTrue(watchpoint.GetHitCount() == 1)
+ self.assertEqual(watchpoint.GetWatchSize(), 4)
+ self.assertEqual(watchpoint.GetHitCount(), 1)
print(watchpoint)
diff --git a/lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py b/lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
index 733473411ac8..847f6782404a 100644
--- a/lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
+++ b/lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
@@ -54,7 +54,7 @@ def test_watchpoint_cond_api(self):
# We should be stopped due to the breakpoint. Get frame #0.
process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
@@ -92,4 +92,4 @@ def test_watchpoint_cond_api(self):
self.DebugSBValue(value)
# Verify that the condition is met.
- self.assertTrue(value.GetValueAsUnsigned() == 5)
+ self.assertEqual(value.GetValueAsUnsigned(), 5)
diff --git a/lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py b/lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
index 9cbc396e7a59..0b59e8d114a2 100644
--- a/lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
+++ b/lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
@@ -50,7 +50,7 @@ def test_watch_location(self):
# We should be stopped due to the breakpoint. Get frame #0.
process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
diff --git a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
index 53e794db03f8..02632cb34305 100644
--- a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
+++ b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
@@ -49,7 +49,7 @@ def test_watch_address(self):
# We should be stopped due to the breakpoint. Get frame #0.
process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
@@ -124,7 +124,7 @@ def test_watch_address_with_invalid_watch_size(self):
# We should be stopped due to the breakpoint. Get frame #0.
process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
+ self.assertEqual(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
diff --git a/lldb/test/API/terminal/TestSTTYBeforeAndAfter.py b/lldb/test/API/terminal/TestSTTYBeforeAndAfter.py
index e994508911b9..8fdb8b010806 100644
--- a/lldb/test/API/terminal/TestSTTYBeforeAndAfter.py
+++ b/lldb/test/API/terminal/TestSTTYBeforeAndAfter.py
@@ -111,4 +111,4 @@ def test_stty_dash_a_before_and_afetr_invoking_lldb_command(self):
# Every line should compare equal until the first blank line.
if len(tuple[0]) == 0:
break
- self.assertTrue(tuple[0] == tuple[1])
+ self.assertEqual(tuple[0], tuple[1])
diff --git a/lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py b/lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
index cce22b7643b6..8a91024898ff 100644
--- a/lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
+++ b/lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
@@ -55,7 +55,7 @@ def test_g_target_xml_returns_correct_data(self):
self.assertIsNotNone(context)
q_info_registers = self.parse_register_info_packets(context)
- self.assertTrue(len(target_xml_registers) == len(q_info_registers))
+ self.assertEqual(len(target_xml_registers), len(q_info_registers))
for register in zip(target_xml_registers, q_info_registers):
xml_info_reg = register[0]
q_info_reg = register[1]
diff --git a/lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py b/lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
index aae9cc8cb101..825fcd2f7d96 100644
--- a/lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
+++ b/lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
@@ -91,7 +91,7 @@ def test_breakpoint_events(self):
# We are now stopped at the entry point to the program. Shared
# libraries are not loaded yet (at least on macOS they aren't) and any
# breakpoints set in foo.cpp should not be resolved.
- self.assertTrue(len(self.vscode.breakpoint_events) == 0,
+ self.assertEqual(len(self.vscode.breakpoint_events), 0,
"no breakpoint events when stopped at entry point")
# Continue to the breakpoint
@@ -100,17 +100,17 @@ def test_breakpoint_events(self):
# Make sure we only get an event for the breakpoint we set via a call
# to self.vscode.request_setBreakpoints(...), not the breakpoint
# we set with with a LLDB command in preRunCommands.
- self.assertTrue(len(self.vscode.breakpoint_events) == 1,
+ self.assertEqual(len(self.vscode.breakpoint_events), 1,
"make sure we got a breakpoint event")
event = self.vscode.breakpoint_events[0]
# Verify the details of the breakpoint changed notification.
body = event['body']
- self.assertTrue(body['reason'] == 'changed',
+ self.assertEqual(body['reason'], 'changed',
"breakpoint event is says breakpoint is changed")
breakpoint = body['breakpoint']
- self.assertTrue(breakpoint['verified'] == True,
+ self.assertTrue(breakpoint['verified'],
"breakpoint event is says it is verified")
- self.assertTrue(breakpoint['id'] == foo_bp_id,
+ self.assertEqual(breakpoint['id'], foo_bp_id,
"breakpoint event is for breakpoint %i" % (foo_bp_id))
self.assertTrue('line' in breakpoint and breakpoint['line'] > 0,
"breakpoint event is has a line number")
diff --git a/lldb/test/API/tools/lldb-vscode/console/TestVSCode_console.py b/lldb/test/API/tools/lldb-vscode/console/TestVSCode_console.py
index fd42b66ccac2..9c71be9bf378 100644
--- a/lldb/test/API/tools/lldb-vscode/console/TestVSCode_console.py
+++ b/lldb/test/API/tools/lldb-vscode/console/TestVSCode_console.py
@@ -47,7 +47,7 @@ def test_scopes_variables_setVariable_evaluate(self):
lines = [breakpoint1_line]
# Set breakpoint in the thread function so we can step the threads
breakpoint_ids = self.set_source_breakpoints(source, lines)
- self.assertTrue(len(breakpoint_ids) == len(lines),
+ self.assertEqual(len(breakpoint_ids), len(lines),
"expect correct number of breakpoints")
self.continue_to_breakpoints(breakpoint_ids)
# Cause a "scopes" to be sent for frame zero which should update the
diff --git a/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py b/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
index 40ac7c4e9d19..4022f420ef72 100644
--- a/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
+++ b/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
@@ -90,7 +90,7 @@ def test_compile_units(self):
moduleId = self.vscode.get_modules()['a.out']['id']
response = self.vscode.request_compileUnits(moduleId)
self.assertTrue(response['body'])
- self.assertTrue(len(response['body']['compileUnits']) == 1,
+ self.assertEqual(len(response['body']['compileUnits']), 1,
'Only one source file should exist')
- self.assertTrue(response['body']['compileUnits'][0]['compileUnitPath'] == main_source_path,
+ self.assertEqual(response['body']['compileUnits'][0]['compileUnitPath'], main_source_path,
'Real path to main.cpp matches')
diff --git a/lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py b/lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
index 2acd3e716405..20f9e63e3607 100644
--- a/lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
+++ b/lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
@@ -29,7 +29,7 @@ def verify_values(self, verify_dict, actual, varref_dict=None):
for key in verify:
verify_value = verify[key]
actual_value = actual[key]
- self.assertTrue(verify_value == actual_value,
+ self.assertEqual(verify_value, actual_value,
'"%s" keys don\'t match (%s != %s)' % (
key, actual_value, verify_value))
if 'startswith' in verify_dict:
@@ -87,7 +87,7 @@ def test_scopes_variables_setVariable_evaluate(self):
lines = [breakpoint1_line]
# Set breakpoint in the thread function so we can step the threads
breakpoint_ids = self.set_source_breakpoints(source, lines)
- self.assertTrue(len(breakpoint_ids) == len(lines),
+ self.assertEqual(len(breakpoint_ids), len(lines),
"expect correct number of breakpoints")
self.continue_to_breakpoints(breakpoint_ids)
locals = self.vscode.get_local_variables()
@@ -152,7 +152,7 @@ def test_scopes_variables_setVariable_evaluate(self):
# Verify setting the start index to a value that is out of range
# results in an empty list
response = self.vscode.request_variables(varRef, start=32, count=1)
- self.assertTrue(len(response['body']['variables']) == 0,
+ self.assertEqual(len(response['body']['variables']), 0,
'verify we get no variable back for invalid start')
# Test evaluate
@@ -197,12 +197,12 @@ def test_scopes_variables_setVariable_evaluate(self):
# Test setting variables
self.set_local('argc', 123)
argc = self.get_local_as_int('argc')
- self.assertTrue(argc == 123,
+ self.assertEqual(argc, 123,
'verify argc was set to 123 (123 != %i)' % (argc))
self.set_local('argv', 0x1234)
argv = self.get_local_as_int('argv')
- self.assertTrue(argv == 0x1234,
+ self.assertEqual(argv, 0x1234,
'verify argv was set to 0x1234 (0x1234 != %#x)' % (
argv))
@@ -219,5 +219,5 @@ def test_scopes_variables_setVariable_evaluate(self):
self.vscode.request_setVariable(varRef, "x", 111)
response = self.vscode.request_variables(varRef, start=0, count=1)
value = response['body']['variables'][0]['value']
- self.assertTrue(value == '111',
+ self.assertEqual(value, '111',
'verify pt.x got set to 111 (111 != %s)' % (value))
More information about the lldb-commits
mailing list