[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
This commit is contained in:
Raphael Isemann 2020-02-13 13:40:22 +01:00
parent 70e6ed1db7
commit b3a0c4d7dc
80 changed files with 264 additions and 260 deletions

View File

@ -53,8 +53,8 @@ class FrameDisassembleTestCase(TestBase):
"There should be a thread stopped at our breakpoint")
# The hit count for the breakpoint should be 1.
self.assertTrue(breakpoint.GetHitCount() == 1)
self.assertEquals(breakpoint.GetHitCount(), 1)
frame = threads[0].GetFrameAtIndex(0)
disassembly = frame.Disassemble()
self.assertTrue(len(disassembly) != 0, "Disassembly was empty.")
self.assertNotEqual(len(disassembly), 0, "Disassembly was empty.")

View File

@ -85,7 +85,7 @@ class ExprCommandThatRestartsTestCase(TestBase):
(num_sigchld), options)
self.assertTrue(value.IsValid())
self.assertTrue(value.GetError().Success())
self.assertTrue(value.GetValueAsSigned(-1) == num_sigchld)
self.assertEquals(value.GetValueAsSigned(-1), num_sigchld)
self.check_after_call(num_sigchld)
@ -102,7 +102,7 @@ class ExprCommandThatRestartsTestCase(TestBase):
(num_sigchld), options)
self.assertTrue(value.IsValid() and value.GetError().Success())
self.assertTrue(value.GetValueAsSigned(-1) == num_sigchld)
self.assertEquals(value.GetValueAsSigned(-1), num_sigchld)
self.check_after_call(num_sigchld)
# Now set the signal to print but not stop and make sure that calling
@ -118,7 +118,7 @@ class ExprCommandThatRestartsTestCase(TestBase):
(num_sigchld), options)
self.assertTrue(value.IsValid() and value.GetError().Success())
self.assertTrue(value.GetValueAsSigned(-1) == num_sigchld)
self.assertEquals(value.GetValueAsSigned(-1), num_sigchld)
self.check_after_call(num_sigchld)
# Now set this unwind on error to false, and make sure that we still
@ -129,7 +129,7 @@ class ExprCommandThatRestartsTestCase(TestBase):
(num_sigchld), options)
self.assertTrue(value.IsValid() and value.GetError().Success())
self.assertTrue(value.GetValueAsSigned(-1) == num_sigchld)
self.assertEquals(value.GetValueAsSigned(-1), num_sigchld)
self.check_after_call(num_sigchld)
# Okay, now set UnwindOnError to true, and then make the signal behavior to stop

View File

@ -49,7 +49,7 @@ class ExprCommandWithThrowTestCase(TestBase):
value = frame.EvaluateExpression("[my_class callMeIThrow]", options)
self.assertTrue(value.IsValid())
self.assertTrue(value.GetError().Success() == False)
self.assertEquals(value.GetError().Success(), False)
self.check_after_call()
@ -89,7 +89,7 @@ class ExprCommandWithThrowTestCase(TestBase):
value = frame.EvaluateExpression("[my_class iCatchMyself]", options)
self.assertTrue(value.IsValid())
self.assertTrue(value.GetError().Success())
self.assertTrue(value.GetValueAsUnsigned() == 57)
self.assertEquals(value.GetValueAsUnsigned(), 57)
self.check_after_call()
options.SetTrapExceptions(True)

View File

@ -48,14 +48,14 @@ class ExprCommandWithFixits(TestBase):
value = frame.EvaluateExpression("my_pointer.first", options)
self.assertTrue(value.IsValid())
self.assertTrue(value.GetError().Success())
self.assertTrue(value.GetValueAsUnsigned() == 10)
self.assertEquals(value.GetValueAsUnsigned(), 10)
# Try with two errors:
two_error_expression = "my_pointer.second->a"
value = frame.EvaluateExpression(two_error_expression, options)
self.assertTrue(value.IsValid())
self.assertTrue(value.GetError().Success())
self.assertTrue(value.GetValueAsUnsigned() == 20)
self.assertEquals(value.GetValueAsUnsigned(), 20)
# Now turn off the fixits, and the expression should fail:
options.SetAutoApplyFixIts(False)

View File

@ -50,7 +50,7 @@ class Issue11581TestCase(TestBase):
frame = process.GetSelectedThread().GetSelectedFrame()
pointer = frame.FindVariable("r14")
addr = pointer.GetValueAsUnsigned(0)
self.assertTrue(addr != 0, "could not read pointer to StgClosure")
self.assertNotEqual(addr, 0, "could not read pointer to StgClosure")
addr = addr - 1
self.runCmd("register write r14 %d" % addr)
self.expect(

View File

@ -38,14 +38,14 @@ class SaveJITObjectsTestCase(TestBase):
self.cleanJITFiles()
frame.EvaluateExpression("(void*)malloc(0x1)")
self.assertTrue(self.countJITFiles() == 0,
self.assertEquals(self.countJITFiles(), 0,
"No files emitted with save-jit-objects=false")
self.runCmd("settings set target.save-jit-objects true")
frame.EvaluateExpression("(void*)malloc(0x1)")
jit_files_count = self.countJITFiles()
self.cleanJITFiles()
self.assertTrue(jit_files_count != 0,
self.assertNotEqual(jit_files_count, 0,
"At least one file emitted with save-jit-objects=true")
process.Kill()

View File

@ -123,7 +123,7 @@ class BasicExprCommandsTestCase(TestBase):
startstr="main")
# We should be stopped on the breakpoint with a hit count of 1.
self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE)
self.assertEquals(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE)
#
# Use Python API to evaluate expressions while stopped in a stack frame.
@ -164,15 +164,15 @@ class BasicExprCommandsTestCase(TestBase):
# Make sure ignoring breakpoints works from the command line:
self.expect("expression -i true -- a_function_to_call()",
substrs=['(int) $', ' 1'])
self.assertTrue(callee_break.GetHitCount() == 1)
self.assertEquals(callee_break.GetHitCount(), 1)
# Now try ignoring breakpoints using the SB API's:
options = lldb.SBExpressionOptions()
options.SetIgnoreBreakpoints(True)
value = frame.EvaluateExpression('a_function_to_call()', options)
self.assertTrue(value.IsValid())
self.assertTrue(value.GetValueAsSigned(0) == 2)
self.assertTrue(callee_break.GetHitCount() == 2)
self.assertEquals(value.GetValueAsSigned(0), 2)
self.assertEquals(callee_break.GetHitCount(), 2)
# rdar://problem/8686536
# CommandInterpreter::HandleCommand is stripping \'s from input for

View File

@ -51,7 +51,7 @@ class ExprCommandWithTimeoutsTestCase(TestBase):
result = lldb.SBCommandReturnObject()
return_value = interp.HandleCommand(
"expr -t 100 -u true -- wait_a_while(1000000)", result)
self.assertTrue(return_value == lldb.eReturnStatusFailed)
self.assertEquals(return_value, lldb.eReturnStatusFailed)
# Okay, now do it again with long enough time outs:
@ -67,7 +67,7 @@ class ExprCommandWithTimeoutsTestCase(TestBase):
result = lldb.SBCommandReturnObject()
return_value = interp.HandleCommand(
"expr -t 1000000 -u true -- wait_a_while(1000)", result)
self.assertTrue(return_value == lldb.eReturnStatusSuccessFinishResult)
self.assertEquals(return_value, lldb.eReturnStatusSuccessFinishResult)
# Finally set the one thread timeout and make sure that doesn't change
# things much:

View File

@ -65,7 +65,7 @@ class TestFrameGuessLanguage(TestBase):
"There should be a thread stopped at our breakpoint")
# The hit count for the breakpoint should be 1.
self.assertTrue(breakpoint.GetHitCount() == 1)
self.assertEquals(breakpoint.GetHitCount(), 1)
thread = threads[0]

View File

@ -54,7 +54,7 @@ class TestFrameVar(TestBase):
"There should be a thread stopped at our breakpoint")
# The hit count for the breakpoint should be 1.
self.assertTrue(breakpoint.GetHitCount() == 1)
self.assertEquals(breakpoint.GetHitCount(), 1)
frame = threads[0].GetFrameAtIndex(0)
command_result = lldb.SBCommandReturnObject()

View File

@ -46,7 +46,7 @@ class LaunchWithShellExpandTestCase(TestBase):
process = self.process()
self.assertTrue(process.GetState() == lldb.eStateStopped,
self.assertEquals(process.GetState(), lldb.eStateStopped,
STOPPED_DUE_TO_BREAKPOINT)
thread = process.GetThreadAtIndex(0)
@ -84,7 +84,7 @@ class LaunchWithShellExpandTestCase(TestBase):
process = self.process()
self.assertTrue(process.GetState() == lldb.eStateStopped,
self.assertEquals(process.GetState(), lldb.eStateStopped,
STOPPED_DUE_TO_BREAKPOINT)
thread = process.GetThreadAtIndex(0)
@ -107,7 +107,7 @@ class LaunchWithShellExpandTestCase(TestBase):
process = self.process()
self.assertTrue(process.GetState() == lldb.eStateStopped,
self.assertEquals(process.GetState(), lldb.eStateStopped,
STOPPED_DUE_TO_BREAKPOINT)
thread = process.GetThreadAtIndex(0)

View File

@ -48,5 +48,5 @@ class RegisterCommandsTestCase(TestBase):
'fault address:', 'lower bound:', 'upper bound:'])
self.runCmd("continue")
self.assertTrue(process.GetState() == lldb.eStateExited,
self.assertEquals(process.GetState(), lldb.eStateExited,
PROCESS_EXITED)

View File

@ -36,7 +36,7 @@ class TestStepOverWatchpoint(TestBase):
process = target.LaunchSimple(None, None,
self.get_process_working_directory())
self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
self.assertTrue(process.GetState() == lldb.eStateStopped,
self.assertEquals(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
thread = lldbutil.get_stopped_thread(process,
@ -60,14 +60,14 @@ class TestStepOverWatchpoint(TestBase):
self.assertTrue(read_watchpoint, "Failed to set read watchpoint.")
thread.StepOver()
self.assertTrue(thread.GetStopReason() == lldb.eStopReasonWatchpoint,
self.assertEquals(thread.GetStopReason(), lldb.eStopReasonWatchpoint,
STOPPED_DUE_TO_WATCHPOINT)
self.assertTrue(thread.GetStopDescription(20) == 'watchpoint 1')
self.assertEquals(thread.GetStopDescription(20), 'watchpoint 1')
process.Continue()
self.assertTrue(process.GetState() == lldb.eStateStopped,
self.assertEquals(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
self.assertTrue(thread.GetStopDescription(20) == 'step over')
self.assertEquals(thread.GetStopDescription(20), 'step over')
self.step_inst_for_watchpoint(1)
@ -89,14 +89,14 @@ class TestStepOverWatchpoint(TestBase):
error.GetCString())
thread.StepOver()
self.assertTrue(thread.GetStopReason() == lldb.eStopReasonWatchpoint,
self.assertEquals(thread.GetStopReason(), lldb.eStopReasonWatchpoint,
STOPPED_DUE_TO_WATCHPOINT)
self.assertTrue(thread.GetStopDescription(20) == 'watchpoint 2')
self.assertEquals(thread.GetStopDescription(20), 'watchpoint 2')
process.Continue()
self.assertTrue(process.GetState() == lldb.eStateStopped,
self.assertEquals(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
self.assertTrue(thread.GetStopDescription(20) == 'step over')
self.assertEquals(thread.GetStopDescription(20), 'step over')
self.step_inst_for_watchpoint(2)
@ -110,10 +110,10 @@ class TestStepOverWatchpoint(TestBase):
self.assertFalse(watchpoint_hit, "Watchpoint already hit.")
expected_stop_desc = "watchpoint %d" % wp_id
actual_stop_desc = self.thread().GetStopDescription(20)
self.assertTrue(actual_stop_desc == expected_stop_desc,
self.assertEquals(actual_stop_desc, expected_stop_desc,
"Watchpoint ID didn't match.")
watchpoint_hit = True
else:
self.assertTrue(stop_reason == lldb.eStopReasonPlanComplete,
self.assertEquals(stop_reason, lldb.eStopReasonPlanComplete,
STOPPED_DUE_TO_STEP_IN)
self.assertTrue(watchpoint_hit, "Watchpoint never hit.")

View File

@ -51,7 +51,7 @@ class TestWatchpointSetEnable(TestBase):
wp = self.target.FindWatchpointByID(1)
self.assertTrue(wp.IsValid(), "Didn't make a valid watchpoint.")
self.assertTrue(wp.GetWatchAddress() != lldb.LLDB_INVALID_ADDRESS, "Watch address is invalid")
self.assertNotEqual(wp.GetWatchAddress(), lldb.LLDB_INVALID_ADDRESS, "Watch address is invalid")
wp.SetEnabled(False)
self.assertTrue(not wp.IsEnabled(), "The watchpoint thinks it is still enabled")

View File

@ -71,7 +71,7 @@ class AddressBreakpointTestCase(TestBase):
"There should be a thread stopped at our breakpoint")
# The hit count for the breakpoint should be 1.
self.assertTrue(breakpoint.GetHitCount() == 1)
self.assertEquals(breakpoint.GetHitCount(), 1)
process.Kill()
@ -88,4 +88,4 @@ class AddressBreakpointTestCase(TestBase):
"There should be a thread stopped at our breakpoint")
# The hit count for the breakpoint should now be 2.
self.assertTrue(breakpoint.GetHitCount() == 2)
self.assertEquals(breakpoint.GetHitCount(), 2)

View File

@ -36,7 +36,7 @@ class BadAddressBreakpointTestCase(TestBase):
if not error.Success():
bkpt = target.BreakpointCreateByAddress(0x0)
for bp_loc in bkpt:
self.assertTrue(bp_loc.IsResolved() == False)
self.assertEquals(bp_loc.IsResolved(), False)
else:
self.fail(
"Could not find an illegal address at which to set a bad breakpoint.")

View File

@ -41,7 +41,7 @@ class BreakpointHitCountTestCase(TestBase):
"There should be a thread stopped due to breakpoint")
frame0 = thread.GetFrameAtIndex(0)
self.assertTrue(frame0.GetFunctionName() == "a(int)" or frame0.GetFunctionName() == "int a(int)");
self.assertEquals(frame0.GetFunctionName(), "a(int)" or frame0.GetFunctionName() == "int a(int)");
process.Continue()
self.assertEqual(process.GetState(), lldb.eStateExited)

View File

@ -22,15 +22,15 @@ class BreakpointIDTestCase(TestBase):
bpno = lldbutil.run_break_set_by_symbol(
self, 'product', num_expected_locations=-1, sym_exact=False)
self.assertTrue(bpno == 1, "First breakpoint number is 1.")
self.assertEquals(bpno, 1, "First breakpoint number is 1.")
bpno = lldbutil.run_break_set_by_symbol(
self, 'sum', num_expected_locations=-1, sym_exact=False)
self.assertTrue(bpno == 2, "Second breakpoint number is 2.")
self.assertEquals(bpno, 2, "Second breakpoint number is 2.")
bpno = lldbutil.run_break_set_by_symbol(
self, 'junk', num_expected_locations=0, sym_exact=False)
self.assertTrue(bpno == 3, "Third breakpoint number is 3.")
self.assertEquals(bpno, 3, "Third breakpoint number is 3.")
self.expect(
"breakpoint disable 1.1 - 2.2 ",

View File

@ -71,7 +71,7 @@ class BreakpointLocationsTestCase(TestBase):
bkpt_cond = "1 == 0"
bkpt.SetCondition(bkpt_cond)
self.assertEqual(bkpt.GetCondition(), bkpt_cond,"Successfully set condition")
self.assertTrue(bkpt.location[0].GetCondition() == bkpt.GetCondition(), "Conditions are the same")
self.assertEquals(bkpt.location[0].GetCondition(), bkpt.GetCondition(), "Conditions are the same")
# Now set a condition on the locations, make sure that this doesn't effect the bkpt:
bkpt_loc_1_cond = "1 == 1"

View File

@ -128,10 +128,10 @@ class BreakpointNames(TestBase):
name_list = lldb.SBStringList()
bkpt.GetNames(name_list)
num_names = name_list.GetSize()
self.assertTrue(num_names == 1, "Name list has %d items, expected 1."%(num_names))
self.assertEquals(num_names, 1, "Name list has %d items, expected 1."%(num_names))
name = name_list.GetStringAtIndex(0)
self.assertTrue(name == other_bkpt_name, "Remaining name was: %s expected %s."%(name, other_bkpt_name))
self.assertEquals(name, other_bkpt_name, "Remaining name was: %s expected %s."%(name, other_bkpt_name))
def do_check_illegal_names(self):
"""Use Python APIs to check that we reject illegal names."""
@ -170,10 +170,10 @@ class BreakpointNames(TestBase):
bkpts = lldb.SBBreakpointList(self.target)
self.target.FindBreakpointsByName(bkpt_name, bkpts)
self.assertTrue(bkpts.GetSize() == 1, "One breakpoint matched.")
self.assertEquals(bkpts.GetSize(), 1, "One breakpoint matched.")
found_bkpt = bkpts.GetBreakpointAtIndex(0)
self.assertTrue(bkpt.GetID() == found_bkpt.GetID(),"The right breakpoint.")
self.assertTrue(bkpt.GetID() == bkpt_id,"With the same ID as before.")
self.assertEquals(bkpt.GetID(), found_bkpt.GetID(),"The right breakpoint.")
self.assertEquals(bkpt.GetID(), bkpt_id,"With the same ID as before.")
retval = lldb.SBCommandReturnObject()
self.dbg.GetCommandInterpreter().HandleCommand("break disable %s"%(bkpt_name), retval)

View File

@ -26,7 +26,7 @@ class ConsecutiveBreakpointsTestCase(TestBase):
address = frame.GetPCAddress()
instructions = self.target.ReadInstructions(address, 2)
self.assertTrue(len(instructions) == 2)
self.assertEquals(len(instructions), 2)
self.bkpt_address = instructions[1].GetAddress()
self.breakpoint2 = self.target.BreakpointCreateByAddress(
self.bkpt_address.GetLoadAddress(self.target))

View File

@ -55,7 +55,7 @@ class TestCPPExceptionBreakpoint (TestBase):
thread_list = lldbutil.get_threads_stopped_at_breakpoint(
process, exception_bkpt)
self.assertTrue(len(thread_list) == 1,
self.assertEquals(len(thread_list), 1,
"One thread stopped at the exception breakpoint.")
def do_dummy_target_cpp_exception_bkpt(self):
@ -82,5 +82,5 @@ class TestCPPExceptionBreakpoint (TestBase):
thread_list = lldbutil.get_threads_stopped_at_breakpoint(
process, exception_bkpt)
self.assertTrue(len(thread_list) == 1,
self.assertEquals(len(thread_list), 1,
"One thread stopped at the exception breakpoint.")

View File

@ -55,7 +55,7 @@ class TestSourceRegexBreakpoints(TestBase):
a_func_line = line_number("a.c", "Set A breakpoint here")
line_entry = address.GetLineEntry()
self.assertTrue(line_entry.IsValid(), "Got a valid line entry.")
self.assertTrue(line_entry.line == a_func_line,
self.assertEquals(line_entry.line, a_func_line,
"Our line number matches the one lldbtest found.")
def source_regex_restrictions(self):

View File

@ -54,8 +54,8 @@ class FormatPropagationTestCase(TestBase):
Y = parent.GetChildMemberWithName("Y")
self.assertTrue(Y is not None and Y.IsValid(), "could not find Y")
# check their values now
self.assertTrue(X.GetValue() == "1", "X has an invalid value")
self.assertTrue(Y.GetValue() == "2", "Y has an invalid value")
self.assertEquals(X.GetValue(), "1", "X has an invalid value")
self.assertEquals(Y.GetValue(), "2", "Y has an invalid value")
# set the format on the parent
parent.SetFormat(lldb.eFormatHex)
self.assertTrue(
@ -66,12 +66,12 @@ class FormatPropagationTestCase(TestBase):
"Y has not changed format")
# Step and check if the values make sense still
self.runCmd("next")
self.assertTrue(X.GetValue() == "0x00000004", "X has not become 4")
self.assertTrue(Y.GetValue() == "0x00000002", "Y has not stuck as hex")
self.assertEquals(X.GetValue(), "0x00000004", "X has not become 4")
self.assertEquals(Y.GetValue(), "0x00000002", "Y has not stuck as hex")
# Check that children can still make their own choices
Y.SetFormat(lldb.eFormatDecimal)
self.assertTrue(X.GetValue() == "0x00000004", "X is still hex")
self.assertTrue(Y.GetValue() == "2", "Y has not been reset")
self.assertEquals(X.GetValue(), "0x00000004", "X is still hex")
self.assertEquals(Y.GetValue(), "2", "Y has not been reset")
# Make a few more changes
parent.SetFormat(lldb.eFormatDefault)
X.SetFormat(lldb.eFormatHex)
@ -79,4 +79,4 @@ class FormatPropagationTestCase(TestBase):
self.assertTrue(
X.GetValue() == "0x00000004",
"X is not hex as it asked")
self.assertTrue(Y.GetValue() == "2", "Y is not defaulted")
self.assertEquals(Y.GetValue(), "2", "Y is not defaulted")

View File

@ -65,15 +65,15 @@ class DynamicValueChildCountTestCase(TestBase):
process = target.LaunchSimple(
None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
self.assertEquals(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
b = self.frame().FindVariable("b").GetDynamicValue(lldb.eDynamicCanRunTarget)
self.assertTrue(b.GetNumChildren() == 0, "b has 0 children")
self.assertEquals(b.GetNumChildren(), 0, "b has 0 children")
self.runCmd("continue")
self.assertTrue(b.GetNumChildren() == 0, "b still has 0 children")
self.assertEquals(b.GetNumChildren(), 0, "b still has 0 children")
self.runCmd("continue")
self.assertTrue(b.GetNumChildren() != 0, "b now has 1 child")
self.assertNotEqual(b.GetNumChildren(), 0, "b now has 1 child")
self.runCmd("continue")
self.assertTrue(
b.GetNumChildren() == 0,

View File

@ -48,7 +48,7 @@ class MemoryCacheTestCase(TestBase):
# Check the value of my_ints[0] is the same as set in main.cpp.
line = self.res.GetOutput().splitlines()[100]
self.assertTrue(0x00000042 == int(line.split(':')[1], 0))
self.assertEquals(0x00000042, int(line.split(':')[1], 0))
# Change the value of my_ints[0] in memory.
self.runCmd("memory write -s 4 `&my_ints` AA")
@ -59,4 +59,4 @@ class MemoryCacheTestCase(TestBase):
# Check the value of my_ints[0] have been updated correctly.
line = self.res.GetOutput().splitlines()[100]
self.assertTrue(0x000000AA == int(line.split(':')[1], 0))
self.assertEquals(0x000000AA, int(line.split(':')[1], 0))

View File

@ -52,7 +52,8 @@ class MemoryReadTestCase(TestBase):
items = line.split(':')
address = int(items[0], 0)
argc = int(items[1], 0)
self.assertTrue(address > 0 and argc == 1)
self.assertGreater(address, 0)
self.assertEquals(argc, 1)
# (lldb) memory read --format uint32_t[] --size 4 --count 4 `&argc`
# 0x7fff5fbff9a0: {0x00000001}
@ -70,7 +71,7 @@ class MemoryReadTestCase(TestBase):
lines[i].split(':')[1].strip(' {}'), 0))
addr = int(lines[i].split(':')[0], 0)
# Verify that the printout for addr is incremented correctly.
self.assertTrue(addr == (address + i * 4))
self.assertEquals(addr, (address + i * 4))
# (lldb) memory read --format char[] --size 7 --count 1 `&my_string`
# 0x7fff5fbff990: {abcdefg}
@ -130,4 +131,4 @@ class MemoryReadTestCase(TestBase):
# Check that we got back 4 0x0000 etc bytes
for o in objects_read:
self.assertTrue (len(o) == expected_object_length)
self.assertTrue(len(objects_read) == 4)
self.assertEquals(len(objects_read), 4)

View File

@ -25,7 +25,7 @@ class MTCSimpleTestCase(TestBase):
@skipIf(archs=['i386'])
def mtc_tests(self):
self.assertTrue(self.mtc_dylib_path != "")
self.assertNotEqual(self.mtc_dylib_path, "")
# Load the test
exe = self.getBuildArtifact("a.out")

View File

@ -191,5 +191,5 @@ class PluginPythonOSPlugin(TestBase):
self.assertTrue(
line_entry.GetFileSpec().GetFilename() == 'main.c',
"Make sure we stepped from line 5 to line 6 in main.c")
self.assertTrue(line_entry.GetLine() == 6,
self.assertEquals(line_entry.GetLine(), 6,
"Make sure we stepped from line 5 to line 6 in main.c")

View File

@ -67,7 +67,8 @@ class ChangeProcessGroupTestCase(TestBase):
# release the child from its loop
value = thread.GetSelectedFrame().EvaluateExpression("release_child_flag = 1")
self.assertTrue(value.IsValid() and value.GetValueAsUnsigned(0) == 1)
self.assertTrue(value.IsValid())
self.assertEquals(value.GetValueAsUnsigned(0), 1)
process.Continue()
# make sure the child's process group id is different from its pid

View File

@ -51,25 +51,25 @@ class ReturnValueTestCase(TestBase):
thread.StepOut()
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
self.assertEquals(self.process.GetState(), lldb.eStateStopped)
self.assertEquals(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
frame = thread.GetFrameAtIndex(0)
fun_name = frame.GetFunctionName()
self.assertTrue(fun_name == "outer_sint(int)")
self.assertEquals(fun_name, "outer_sint(int)")
return_value = thread.GetStopReturnValue()
self.assertTrue(return_value.IsValid())
ret_int = return_value.GetValueAsSigned(error)
self.assertTrue(error.Success())
self.assertTrue(in_int == ret_int)
self.assertEquals(in_int, ret_int)
# Run again and we will stop in inner_sint the second time outer_sint is called.
# Then test stepping out two frames at once:
thread_list = lldbutil.continue_to_breakpoint(self.process, inner_sint_bkpt)
self.assertTrue(len(thread_list) == 1)
self.assertEquals(len(thread_list), 1)
thread = thread_list[0]
# We are done with the inner_sint breakpoint:
@ -77,23 +77,23 @@ class ReturnValueTestCase(TestBase):
frame = thread.GetFrameAtIndex(1)
fun_name = frame.GetFunctionName()
self.assertTrue(fun_name == "outer_sint(int)")
self.assertEquals(fun_name, "outer_sint(int)")
in_int = frame.FindVariable("value").GetValueAsSigned(error)
self.assertTrue(error.Success())
thread.StepOutOfFrame(frame)
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
self.assertEquals(self.process.GetState(), lldb.eStateStopped)
self.assertEquals(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
frame = thread.GetFrameAtIndex(0)
fun_name = frame.GetFunctionName()
self.assertTrue(fun_name == "main")
self.assertEquals(fun_name, "main")
ret_value = thread.GetStopReturnValue()
self.assertTrue(return_value.IsValid())
ret_int = ret_value.GetValueAsSigned(error)
self.assertTrue(error.Success())
self.assertTrue(2 * in_int == ret_int)
self.assertEquals(2 * in_int, ret_int)
# Now try some simple returns that have different types:
inner_float_bkpt = self.target.BreakpointCreateByName(
@ -102,7 +102,7 @@ class ReturnValueTestCase(TestBase):
self.process.Continue()
thread_list = lldbutil.get_threads_stopped_at_breakpoint(
self.process, inner_float_bkpt)
self.assertTrue(len(thread_list) == 1)
self.assertEquals(len(thread_list), 1)
thread = thread_list[0]
self.target.BreakpointDelete(inner_float_bkpt.GetID())
@ -112,12 +112,12 @@ class ReturnValueTestCase(TestBase):
in_float = float(in_value.GetValue())
thread.StepOut()
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
self.assertEquals(self.process.GetState(), lldb.eStateStopped)
self.assertEquals(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
frame = thread.GetFrameAtIndex(0)
fun_name = frame.GetFunctionName()
self.assertTrue(fun_name == "outer_float(float)")
self.assertEquals(fun_name, "outer_float(float)")
#return_value = thread.GetStopReturnValue()
#self.assertTrue(return_value.IsValid())
@ -235,7 +235,7 @@ class ReturnValueTestCase(TestBase):
thread_list = lldbutil.get_threads_stopped_at_breakpoint(
self.process, bkpt)
self.assertTrue(len(thread_list) == 1)
self.assertEquals(len(thread_list), 1)
thread = thread_list[0]
self.target.BreakpointDelete(bkpt.GetID())
@ -254,14 +254,14 @@ class ReturnValueTestCase(TestBase):
thread.StepOut()
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
self.assertEquals(self.process.GetState(), lldb.eStateStopped)
self.assertEquals(thread.GetStopReason(), lldb.eStopReasonPlanComplete)
# Assuming all these functions step out to main. Could figure out the caller dynamically
# if that would add something to the test.
frame = thread.GetFrameAtIndex(0)
fun_name = frame.GetFunctionName()
self.assertTrue(fun_name == "main")
self.assertEquals(fun_name, "main")
frame = thread.GetFrameAtIndex(0)
ret_value = thread.GetStopReturnValue()
@ -269,7 +269,7 @@ class ReturnValueTestCase(TestBase):
self.assertTrue(ret_value.IsValid())
num_ret_children = ret_value.GetNumChildren()
self.assertTrue(num_in_children == num_ret_children)
self.assertEquals(num_in_children, num_ret_children)
for idx in range(0, num_ret_children):
in_child = in_value.GetChildAtIndex(idx)
ret_child = ret_value.GetChildAtIndex(idx)

View File

@ -88,7 +88,7 @@ class SendSignalTestCase(TestBase):
# Now make sure the thread was stopped with a SIGUSR1:
threads = lldbutil.get_stopped_threads(process, lldb.eStopReasonSignal)
self.assertTrue(len(threads) == 1, "One thread stopped for a signal.")
self.assertEquals(len(threads), 1, "One thread stopped for a signal.")
thread = threads[0]
self.assertTrue(
@ -107,6 +107,6 @@ class SendSignalTestCase(TestBase):
num_seconds, broadcaster, event_type_mask, event)
self.assertTrue(got_event, "Got an event")
state = lldb.SBProcess.GetStateFromEvent(event)
self.assertTrue(state == expected_state,
self.assertEquals(state, expected_state,
"It was the %s state." %
lldb.SBDebugger_StateAsCString(expected_state))

View File

@ -23,14 +23,14 @@ class TestTargetSourceMap(TestBase):
# Set a breakpoint before we remap source and verify that it fails
bp = target.BreakpointCreateByLocation(src_path, 2)
self.assertTrue(bp.GetNumLocations() == 0,
self.assertEquals(bp.GetNumLocations(), 0,
"make sure no breakpoints were resolved without map")
src_map_cmd = 'settings set target.source-map . "%s"' % (src_dir)
self.dbg.HandleCommand(src_map_cmd)
# Set a breakpoint after we remap source and verify that it succeeds
bp = target.BreakpointCreateByLocation(src_path, 2)
self.assertTrue(bp.GetNumLocations() == 1,
self.assertEquals(bp.GetNumLocations(), 1,
"make sure breakpoint was resolved with map")
# Now make sure that we can actually FIND the source file using this
@ -38,6 +38,6 @@ class TestTargetSourceMap(TestBase):
retval = lldb.SBCommandReturnObject()
self.dbg.GetCommandInterpreter().HandleCommand("source list -f main.c -l 2", retval)
self.assertTrue(retval.Succeeded(), "source list didn't succeed.")
self.assertTrue(retval.GetOutput() != None, "We got no ouput from source list")
self.assertNotEqual(retval.GetOutput(), None, "We got no ouput from source list")
self.assertTrue("return" in retval.GetOutput(), "We didn't find the source file...")

View File

@ -109,7 +109,7 @@ class StepAvoidsNoDebugTestCase(TestBase):
# Now finish, and make sure the return value is correct.
threads = lldbutil.get_threads_stopped_at_breakpoint(
self.process, inner_bkpt)
self.assertTrue(len(threads) == 1, "Stopped at inner breakpoint.")
self.assertEquals(len(threads), 1, "Stopped at inner breakpoint.")
self.thread = threads[0]
def do_step_out_past_nodebug(self):

View File

@ -67,7 +67,7 @@ class TsanThreadNumbersTestCase(TestBase):
self.assertEqual(data["mops"][0]["thread_id"], report_thread_id)
other_thread_id = data["mops"][1]["thread_id"]
self.assertTrue(other_thread_id != report_thread_id)
self.assertNotEqual(other_thread_id, report_thread_id)
other_thread = self.dbg.GetSelectedTarget(
).process.GetThreadByIndexID(other_thread_id)
self.assertTrue(other_thread.IsValid())

View File

@ -64,7 +64,7 @@ class UbsanBasicTestCase(TestBase):
backtraces = thread.GetStopReasonExtendedBacktraces(
lldb.eInstrumentationRuntimeTypeUndefinedBehaviorSanitizer)
self.assertTrue(backtraces.GetSize() == 1)
self.assertEquals(backtraces.GetSize(), 1)
self.expect(
"thread info -s",

View File

@ -41,7 +41,7 @@ class ValueMD5CrashTestCase(TestBase):
v = value.GetValue()
type_name = value.GetTypeName()
self.assertTrue(type_name == "B *", "a is a B*")
self.assertEquals(type_name, "B *", "a is a B*")
self.runCmd("next")
self.runCmd("process kill")

View File

@ -25,7 +25,7 @@ class TestVarPath(TestBase):
def verify_point(self, frame, var_name, var_typename, x_value, y_value):
v = frame.GetValueForVariablePath(var_name)
self.assertTrue(v.GetError().Success(), "Make sure we find '%s'" % (var_name))
self.assertTrue(v.GetType().GetName() == var_typename,
self.assertEquals(v.GetType().GetName(), var_typename,
"Make sure '%s' has type '%s'" % (var_name, var_typename))
if '*' in var_typename:
@ -43,15 +43,15 @@ class TestVarPath(TestBase):
v = frame.GetValueForVariablePath(valid_x_path)
self.assertTrue(v.GetError().Success(), "Make sure we find '%s'" % (valid_x_path))
self.assertTrue(v.GetValue() == str(x_value), "Make sure '%s' has a value of %i" % (valid_x_path, x_value))
self.assertTrue(v.GetType().GetName() == "int", "Make sure '%s' has type 'int'" % (valid_x_path))
self.assertEquals(v.GetValue(), str(x_value), "Make sure '%s' has a value of %i" % (valid_x_path, x_value))
self.assertEquals(v.GetType().GetName(), "int", "Make sure '%s' has type 'int'" % (valid_x_path))
v = frame.GetValueForVariablePath(invalid_x_path)
self.assertTrue(v.GetError().Fail(), "Make sure we don't find '%s'" % (invalid_x_path))
v = frame.GetValueForVariablePath(valid_y_path)
self.assertTrue(v.GetError().Success(), "Make sure we find '%s'" % (valid_y_path))
self.assertTrue(v.GetValue() == str(y_value), "Make sure '%s' has a value of %i" % (valid_y_path, y_value))
self.assertTrue(v.GetType().GetName() == "int", "Make sure '%s' has type 'int'" % (valid_y_path))
self.assertEquals(v.GetValue(), str(y_value), "Make sure '%s' has a value of %i" % (valid_y_path, y_value))
self.assertEquals(v.GetType().GetName(), "int", "Make sure '%s' has type 'int'" % (valid_y_path))
v = frame.GetValueForVariablePath(invalid_y_path)
self.assertTrue(v.GetError().Fail(), "Make sure we don't find '%s'" % (invalid_y_path))

View File

@ -170,20 +170,20 @@ class ArrayTypesTestCase(TestBase):
"%s" %
variable.GetName()])
self.DebugSBValue(variable)
self.assertTrue(variable.GetNumChildren() == 4,
self.assertEquals(variable.GetNumChildren(), 4,
"Variable 'strings' should have 4 children")
byte_size = variable.GetByteSize()
self.assertTrue(byte_size >= 4*4 and byte_size <= 1024)
child3 = variable.GetChildAtIndex(3)
self.DebugSBValue(child3)
self.assertTrue(child3.GetSummary() == '"Guten Tag"',
self.assertEquals(child3.GetSummary(), '"Guten Tag"',
'strings[3] == "Guten Tag"')
# Lookup the "char_16" char array variable.
variable = frame.FindVariable("char_16")
self.DebugSBValue(variable)
self.assertTrue(variable.GetNumChildren() == 16,
self.assertEquals(variable.GetNumChildren(), 16,
"Variable 'char_16' should have 16 children")
# Lookup the "ushort_matrix" ushort[] array variable.
@ -192,25 +192,25 @@ class ArrayTypesTestCase(TestBase):
# of the string. Same applies to long().
variable = frame.FindVariable("ushort_matrix")
self.DebugSBValue(variable)
self.assertTrue(variable.GetNumChildren() == 2,
self.assertEquals(variable.GetNumChildren(), 2,
"Variable 'ushort_matrix' should have 2 children")
child0 = variable.GetChildAtIndex(0)
self.DebugSBValue(child0)
self.assertTrue(child0.GetNumChildren() == 3,
self.assertEquals(child0.GetNumChildren(), 3,
"Variable 'ushort_matrix[0]' should have 3 children")
child0_2 = child0.GetChildAtIndex(2)
self.DebugSBValue(child0_2)
self.assertTrue(int(child0_2.GetValue(), 0) == 3,
self.assertEquals(int(child0_2.GetValue(), 0), 3,
"ushort_matrix[0][2] == 3")
# Lookup the "long_6" char array variable.
variable = frame.FindVariable("long_6")
self.DebugSBValue(variable)
self.assertTrue(variable.GetNumChildren() == 6,
self.assertEquals(variable.GetNumChildren(), 6,
"Variable 'long_6' should have 6 children")
child5 = variable.GetChildAtIndex(5)
self.DebugSBValue(child5)
self.assertTrue(int(child5.GetValue(), 0) == 6,
self.assertEquals(int(child5.GetValue(), 0), 6,
"long_6[5] == 6")
# Last, check that "long_6" has a value type of eValueTypeVariableLocal
@ -223,6 +223,6 @@ class ArrayTypesTestCase(TestBase):
lldb.eValueTypeVariableLocal))
argc = frame.FindVariable("argc")
self.DebugSBValue(argc)
self.assertTrue(argc.GetValueType() == lldb.eValueTypeVariableArgument,
self.assertEquals(argc.GetValueType(), lldb.eValueTypeVariableArgument,
"Variable 'argc' should have '%s' value type." %
value_type_to_str(lldb.eValueTypeVariableArgument))

View File

@ -61,12 +61,12 @@ class DynamicValueTestCase(TestBase):
process = target.LaunchSimple(
None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
self.assertEquals(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
threads = lldbutil.get_threads_stopped_at_breakpoint(
process, first_call_bpt)
self.assertTrue(len(threads) == 1)
self.assertEquals(len(threads), 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
@ -88,7 +88,7 @@ class DynamicValueTestCase(TestBase):
# Okay now run to doSomething:
threads = lldbutil.continue_to_breakpoint(process, do_something_bpt)
self.assertTrue(len(threads) == 1)
self.assertEquals(len(threads), 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
@ -144,7 +144,7 @@ class DynamicValueTestCase(TestBase):
self.assertTrue(anotherA_dynamic)
anotherA_dynamic_addr = int(anotherA_dynamic.GetValue(), 16)
anotherA_dynamic_typename = anotherA_dynamic.GetTypeName()
self.assertTrue(anotherA_dynamic_typename.find('B') != -1)
self.assertNotEqual(anotherA_dynamic_typename.find('B'), -1)
self.assertTrue(anotherA_dynamic_addr < anotherA_static_addr)
@ -152,7 +152,7 @@ class DynamicValueTestCase(TestBase):
'm_b_value', True)
self.assertTrue(anotherA_m_b_value_dynamic)
anotherA_m_b_val = int(anotherA_m_b_value_dynamic.GetValue(), 10)
self.assertTrue(anotherA_m_b_val == 300)
self.assertEquals(anotherA_m_b_val, 300)
anotherA_m_b_value_static = anotherA_static.GetChildMemberWithName(
'm_b_value', True)
@ -162,7 +162,7 @@ class DynamicValueTestCase(TestBase):
# main
threads = lldbutil.continue_to_breakpoint(process, second_call_bpt)
self.assertTrue(len(threads) == 1)
self.assertEquals(len(threads), 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
@ -174,15 +174,15 @@ class DynamicValueTestCase(TestBase):
# which this time around is just an "A".
threads = lldbutil.continue_to_breakpoint(process, do_something_bpt)
self.assertTrue(len(threads) == 1)
self.assertEquals(len(threads), 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
anotherA_value = frame.FindVariable('anotherA', True)
self.assertTrue(anotherA_value)
anotherA_loc = int(anotherA_value.GetValue(), 16)
self.assertTrue(anotherA_loc == reallyA_loc)
self.assertTrue(anotherA_value.GetTypeName().find('B') == -1)
self.assertEquals(anotherA_loc, reallyA_loc)
self.assertEquals(anotherA_value.GetTypeName().find('B'), -1)
def examine_value_object_of_this_ptr(
self, this_static, this_dynamic, dynamic_location):
@ -194,12 +194,12 @@ class DynamicValueTestCase(TestBase):
self.assertTrue(this_dynamic)
this_dynamic_typename = this_dynamic.GetTypeName()
self.assertTrue(this_dynamic_typename.find('B') != -1)
self.assertNotEqual(this_dynamic_typename.find('B'), -1)
this_dynamic_loc = int(this_dynamic.GetValue(), 16)
# Make sure we got the right address for "this"
self.assertTrue(this_dynamic_loc == dynamic_location)
self.assertEquals(this_dynamic_loc, dynamic_location)
# And that the static address is greater than the dynamic one
@ -215,7 +215,7 @@ class DynamicValueTestCase(TestBase):
self.assertTrue(this_dynamic_m_b_value)
m_b_value = int(this_dynamic_m_b_value.GetValue(), 0)
self.assertTrue(m_b_value == 10)
self.assertEquals(m_b_value, 10)
# Make sure it is not in the static version

View File

@ -66,7 +66,7 @@ class CPPBreakpointTestCase(TestBase):
while frame_functions.count("throws_exception_on_even(int)") == 1:
stopped_threads = lldbutil.continue_to_breakpoint(
process, exception_bkpt)
self.assertTrue(len(stopped_threads) == 1)
self.assertEquals(len(stopped_threads), 1)
thread = stopped_threads[0]
frame_functions = lldbutil.get_function_names(thread)

View File

@ -31,9 +31,9 @@ class GlobalVariablesCppTestCase(TestBase):
# Check that we can access g_file_global_int by its mangled name
addr = target.EvaluateExpression("&abc::g_file_global_int").GetValueAsUnsigned()
self.assertTrue(addr != 0)
self.assertNotEqual(addr, 0)
mangled = lldb.SBAddress(addr, target).GetSymbol().GetMangledName()
self.assertTrue(mangled != None)
self.assertNotEqual(mangled, None)
gv = target.FindFirstGlobalVariable(mangled)
self.assertTrue(gv.IsValid())
self.assertEqual(gv.GetName(), "abc::g_file_global_int")

View File

@ -38,7 +38,7 @@ class TestWithGmodulesDebugInfo(TestBase):
self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
# Get the thread of the process
self.assertTrue(process.GetState() == lldb.eStateStopped)
self.assertEquals(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(

View File

@ -87,7 +87,7 @@ class STLTestCase(TestBase):
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
self.assertTrue(process.GetState() == lldb.eStateStopped)
self.assertEquals(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(

View File

@ -54,13 +54,13 @@ class TemplateArgsTestCase(TestBase):
self.assertTrue(
testpos.IsValid(),
'make sure we find a local variabble named "testpos"')
self.assertTrue(testpos.GetType().GetName() == 'TestObj<1>')
self.assertEquals(testpos.GetType().GetName(), 'TestObj<1>')
expr_result = frame.EvaluateExpression("testpos.getArg()")
self.assertTrue(
expr_result.IsValid(),
'got a valid expression result from expression "testpos.getArg()"')
self.assertTrue(expr_result.GetValue() == "1", "testpos.getArg() == 1")
self.assertEquals(expr_result.GetValue(), "1", "testpos.getArg() == 1")
self.assertTrue(
expr_result.GetType().GetName() == "int",
'expr_result.GetType().GetName() == "int"')
@ -69,7 +69,7 @@ class TemplateArgsTestCase(TestBase):
self.assertTrue(
testneg.IsValid(),
'make sure we find a local variabble named "testneg"')
self.assertTrue(testneg.GetType().GetName() == 'TestObj<-1>')
self.assertEquals(testneg.GetType().GetName(), 'TestObj<-1>')
expr_result = frame.EvaluateExpression("testneg.getArg()")
self.assertTrue(
@ -90,25 +90,25 @@ class TemplateArgsTestCase(TestBase):
self.assertTrue(
c1.IsValid(),
'make sure we find a local variabble named "c1"')
self.assertTrue(c1.GetType().GetName() == 'C<float, T1>')
self.assertEquals(c1.GetType().GetName(), 'C<float, T1>')
f1 = c1.GetChildMemberWithName("V").GetChildAtIndex(0).GetChildMemberWithName("f")
self.assertTrue(f1.GetType().GetName() == 'float')
self.assertTrue(f1.GetValue() == '1.5')
self.assertEquals(f1.GetType().GetName(), 'float')
self.assertEquals(f1.GetValue(), '1.5')
c2 = frame.FindVariable('c2')
self.assertTrue(
c2.IsValid(),
'make sure we find a local variabble named "c2"')
self.assertTrue(c2.GetType().GetName() == 'C<double, T1, T2>')
self.assertEquals(c2.GetType().GetName(), 'C<double, T1, T2>')
f2 = c2.GetChildMemberWithName("V").GetChildAtIndex(0).GetChildMemberWithName("f")
self.assertTrue(f2.GetType().GetName() == 'double')
self.assertTrue(f2.GetValue() == '1.5')
self.assertEquals(f2.GetType().GetName(), 'double')
self.assertEquals(f2.GetValue(), '1.5')
f3 = c2.GetChildMemberWithName("V").GetChildAtIndex(1).GetChildMemberWithName("f")
self.assertTrue(f3.GetType().GetName() == 'double')
self.assertTrue(f3.GetValue() == '2.5')
self.assertEquals(f3.GetType().GetName(), 'double')
self.assertEquals(f3.GetValue(), '2.5')
f4 = c2.GetChildMemberWithName("V").GetChildAtIndex(1).GetChildMemberWithName("i")
self.assertTrue(f4.GetType().GetName() == 'int')
self.assertTrue(f4.GetValue() == '42')
self.assertEquals(f4.GetType().GetName(), 'int')
self.assertEquals(f4.GetValue(), '42')
# Gcc does not generate the necessary DWARF attribute for enum template
# parameters.

View File

@ -54,4 +54,4 @@ class TestObjCGlobalVar(TestBase):
self.assertTrue(
dyn_value.GetError().Success(),
"Dynamic value is valid")
self.assertTrue(dyn_value.GetObjectDescription() == "Some NSString")
self.assertEquals(dyn_value.GetObjectDescription(), "Some NSString")

View File

@ -35,7 +35,7 @@ class ObjCiVarIMPTestCase(TestBase):
process = target.LaunchSimple(
None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
self.assertEquals(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
self.expect(

View File

@ -42,7 +42,7 @@ class ObjCDynamicValueTestCase(TestBase):
process = target.LaunchSimple(
None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
self.assertEquals(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
var = self.frame().FindVariable("foo")
@ -60,5 +60,5 @@ class ObjCDynamicValueTestCase(TestBase):
self.assertTrue(var_pte_type.GetDirectBaseClassAtIndex(
0).IsValid(), "Foo * has a valid base class")
self.assertTrue(var_ptr_type.GetDirectBaseClassAtIndex(0).GetName() == var_pte_type.GetDirectBaseClassAtIndex(
self.assertEquals(var_ptr_type.GetDirectBaseClassAtIndex(0).GetName(), var_pte_type.GetDirectBaseClassAtIndex(
0).GetName(), "Foo and its pointer type don't agree on their base class")

View File

@ -48,7 +48,7 @@ class TestObjCBuiltinTypes(TestBase):
self.assertTrue(
len(thread_list) != 0,
"No thread stopped at our breakpoint.")
self.assertTrue(len(thread_list) == 1,
self.assertEquals(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

View File

@ -64,12 +64,12 @@ class ObjCDynamicValueTestCase(TestBase):
process = target.LaunchSimple(
None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
self.assertEquals(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
threads = lldbutil.get_threads_stopped_at_breakpoint(
process, main_before_setProperty_bkpt)
self.assertTrue(len(threads) == 1)
self.assertEquals(len(threads), 1)
thread = threads[0]
#
@ -130,7 +130,7 @@ class ObjCDynamicValueTestCase(TestBase):
threads = lldbutil.get_stopped_threads(
process, lldb.eStopReasonPlanComplete)
self.assertTrue(len(threads) == 1)
self.assertEquals(len(threads), 1)
line_entry = threads[0].GetFrameAtIndex(0).GetLineEntry()
self.assertEqual(line_entry.GetLine(), self.set_property_line)
@ -143,7 +143,7 @@ class ObjCDynamicValueTestCase(TestBase):
threads = lldbutil.continue_to_breakpoint(
process, handle_SourceBase_bkpt)
self.assertTrue(len(threads) == 1)
self.assertEquals(len(threads), 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
@ -183,7 +183,7 @@ class ObjCDynamicValueTestCase(TestBase):
threads = lldbutil.continue_to_breakpoint(
process, handle_SourceBase_bkpt)
self.assertTrue(len(threads) == 1)
self.assertEquals(len(threads), 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
@ -201,7 +201,7 @@ class ObjCDynamicValueTestCase(TestBase):
def examine_SourceDerived_ptr(self, object):
self.assertTrue(object)
self.assertTrue(object.GetTypeName().find('SourceDerived') != -1)
self.assertNotEqual(object.GetTypeName().find('SourceDerived'), -1)
derivedValue = object.GetChildMemberWithName('_derivedValue')
self.assertTrue(derivedValue)
self.assertTrue(int(derivedValue.GetValue(), 0) == 30)
self.assertEquals(int(derivedValue.GetValue(), 0), 30)

View File

@ -43,7 +43,7 @@ class TestObjCIvarOffsets(TestBase):
thread_list = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint)
self.assertTrue(len(thread_list) == 1)
self.assertEquals(len(thread_list), 1)
thread = thread_list[0]
frame = thread.GetFrameAtIndex(0)
@ -62,7 +62,7 @@ class TestObjCIvarOffsets(TestBase):
"Found mine->backed_int local variable.")
backed_value = mine_backed_int.GetValueAsSigned(error)
self.assertTrue(error.Success())
self.assertTrue(backed_value == 1111)
self.assertEquals(backed_value, 1111)
# Test the value object value for DerivedClass->_derived_backed_int
@ -72,7 +72,7 @@ class TestObjCIvarOffsets(TestBase):
"Found mine->derived_backed_int local variable.")
derived_backed_value = mine_derived_backed_int.GetValueAsSigned(error)
self.assertTrue(error.Success())
self.assertTrue(derived_backed_value == 3333)
self.assertEquals(derived_backed_value, 3333)
# Make sure we also get bit-field offsets correct:
@ -80,4 +80,4 @@ class TestObjCIvarOffsets(TestBase):
self.assertTrue(mine_flag2, "Found mine->flag2 local variable.")
flag2_value = mine_flag2.GetValueAsUnsigned(error)
self.assertTrue(error.Success())
self.assertTrue(flag2_value == 7)
self.assertEquals(flag2_value, 7)

View File

@ -50,7 +50,7 @@ class TestObjCIvarStripped(TestBase):
thread_list = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint)
self.assertTrue(len(thread_list) == 1)
self.assertEquals(len(thread_list), 1)
thread = thread_list[0]
frame = thread.GetFrameAtIndex(0)
@ -64,4 +64,4 @@ class TestObjCIvarStripped(TestBase):
self.assertTrue(ivar, "Got result for mc->_foo")
ivar_value = ivar.GetValueAsSigned(error)
self.assertTrue(error.Success())
self.assertTrue(ivar_value == 3)
self.assertEquals(ivar_value, 3)

View File

@ -48,12 +48,12 @@ class ObjCPropertyTestCase(TestBase):
process = target.LaunchSimple(
None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
self.assertEquals(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
threads = lldbutil.get_threads_stopped_at_breakpoint(
process, main_bkpt)
self.assertTrue(len(threads) == 1)
self.assertEquals(len(threads), 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
@ -62,7 +62,7 @@ class ObjCPropertyTestCase(TestBase):
access_count = mine.GetChildMemberWithName("_access_count")
self.assertTrue(access_count.IsValid())
start_access_count = access_count.GetValueAsUnsigned(123456)
self.assertTrue(start_access_count != 123456)
self.assertNotEqual(start_access_count, 123456)
#
# The first set of tests test calling the getter & setter of
@ -74,13 +74,13 @@ class ObjCPropertyTestCase(TestBase):
nonexistant_error = nonexistant_value.GetError()
self.assertTrue(nonexistant_error.Success())
nonexistant_int = nonexistant_value.GetValueAsUnsigned(123456)
self.assertTrue(nonexistant_int == 6)
self.assertEquals(nonexistant_int, 6)
# Calling the getter function would up the access count, so make sure
# that happened.
new_access_count = access_count.GetValueAsUnsigned(123456)
self.assertTrue(new_access_count - start_access_count == 1)
self.assertEquals(new_access_count - start_access_count, 1)
start_access_count = new_access_count
#
@ -94,7 +94,7 @@ class ObjCPropertyTestCase(TestBase):
# that happened.
new_access_count = access_count.GetValueAsUnsigned(123456)
self.assertTrue(new_access_count - start_access_count == 1)
self.assertEquals(new_access_count - start_access_count, 1)
start_access_count = new_access_count
#
@ -123,12 +123,12 @@ class ObjCPropertyTestCase(TestBase):
"mine.idWithProtocol", False)
idWithProtocol_error = idWithProtocol_value.GetError()
self.assertTrue(idWithProtocol_error.Success())
self.assertTrue(idWithProtocol_value.GetTypeName() == "id")
self.assertEquals(idWithProtocol_value.GetTypeName(), "id")
# Make sure that class property getter works as expected
value = frame.EvaluateExpression("BaseClass.classInt", False)
self.assertTrue(value.GetError().Success())
self.assertTrue(value.GetValueAsUnsigned(11111) == 123)
self.assertEquals(value.GetValueAsUnsigned(11111), 123)
# Make sure that class property setter works as expected
value = frame.EvaluateExpression("BaseClass.classInt = 234", False)
@ -137,4 +137,4 @@ class ObjCPropertyTestCase(TestBase):
# Verify that setter above actually worked
value = frame.EvaluateExpression("BaseClass.classInt", False)
self.assertTrue(value.GetError().Success())
self.assertTrue(value.GetValueAsUnsigned(11111) == 234)
self.assertEquals(value.GetValueAsUnsigned(11111), 234)

View File

@ -53,7 +53,7 @@ class TestObjCStaticMethodStripped(TestBase):
self.assertTrue(
len(thread_list) != 0,
"No thread stopped at our breakpoint.")
self.assertTrue(len(thread_list) == 1,
self.assertEquals(len(thread_list), 1,
"More than one thread stopped at our breakpoint.")
# Now make sure we can call a function in the static method we've

View File

@ -48,7 +48,7 @@ class TestObjCStaticMethod(TestBase):
self.assertTrue(
len(thread_list) != 0,
"No thread stopped at our breakpoint.")
self.assertTrue(len(thread_list) == 1,
self.assertEquals(len(thread_list), 1,
"More than one thread stopped at our breakpoint.")
# Now make sure we can call a function in the static method we've

View File

@ -48,7 +48,7 @@ class TestObjCStructArgument(TestBase):
self.assertTrue(
len(thread_list) != 0,
"No thread stopped at our breakpoint.")
self.assertTrue(len(thread_list) == 1,
self.assertEquals(len(thread_list), 1,
"More than one thread stopped at our breakpoint.")
frame = thread_list[0].GetFrameAtIndex(0)

View File

@ -47,7 +47,7 @@ class TestObjCClassMethod(TestBase):
self.assertTrue(
len(thread_list) != 0,
"No thread stopped at our breakpoint.")
self.assertTrue(len(thread_list) == 1,
self.assertEquals(len(thread_list), 1,
"More than one thread stopped at our breakpoint.")
frame = thread_list[0].GetFrameAtIndex(0)

View File

@ -47,7 +47,7 @@ class TestObjCSuperMethod(TestBase):
self.assertTrue(
len(thread_list) != 0,
"No thread stopped at our breakpoint.")
self.assertTrue(len(thread_list) == 1,
self.assertEquals(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
@ -57,8 +57,8 @@ class TestObjCSuperMethod(TestBase):
cmd_value = frame.EvaluateExpression("[self get]")
self.assertTrue(cmd_value.IsValid())
self.assertTrue(cmd_value.GetValueAsUnsigned() == 2)
self.assertEquals(cmd_value.GetValueAsUnsigned(), 2)
cmd_value = frame.EvaluateExpression("[super get]")
self.assertTrue(cmd_value.IsValid())
self.assertTrue(cmd_value.GetValueAsUnsigned() == 1)
self.assertEquals(cmd_value.GetValueAsUnsigned(), 1)

View File

@ -33,7 +33,7 @@ class TargetSymbolsAddCommand(TestBase):
self.assertTrue(self.process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.assertTrue(self.process.GetState() == lldb.eStateStopped,
self.assertEquals(self.process.GetState(), lldb.eStateStopped,
STOPPED_DUE_TO_BREAKPOINT)
exe_module = self.target.GetModuleAtIndex(0)

View File

@ -30,7 +30,7 @@ class TestMixedDwarfBinary(TestBase):
self.assertTrue(self.process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.assertTrue(self.process.GetState() == lldb.eStateStopped,
self.assertEquals(self.process.GetState(), lldb.eStateStopped,
STOPPED_DUE_TO_BREAKPOINT)
frame = self.process.GetThreadAtIndex(0).GetFrameAtIndex(0)

View File

@ -36,7 +36,7 @@ class AddDsymMidExecutionCommandCase(TestBase):
self.assertTrue(self.process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.assertTrue(self.process.GetState() == lldb.eStateStopped,
self.assertEquals(self.process.GetState(), lldb.eStateStopped,
STOPPED_DUE_TO_BREAKPOINT)
self.runCmd("add-dsym " +

View File

@ -39,7 +39,7 @@ class FindAppInMacOSAppBundle(TestBase):
self.assertTrue(exe_module_spec.GetFilename(), "TestApp")
bkpt = target.BreakpointCreateBySourceRegex("Set a breakpoint here", self.main_source_file)
self.assertTrue(bkpt.GetNumLocations() == 1, "Couldn't set a breakpoint in the main app")
self.assertEquals(bkpt.GetNumLocations(), 1, "Couldn't set a breakpoint in the main app")
if lldbplatformutil.getPlatform() == "macosx":
launch_info = lldb.SBLaunchInfo(None)
@ -53,6 +53,6 @@ class FindAppInMacOSAppBundle(TestBase):
# Frame #0 should be at our breakpoint.
threads = lldbutil.get_threads_stopped_at_breakpoint(process, bkpt)
self.assertTrue(len(threads) == 1, "Expected 1 thread to stop at breakpoint, %d did."%(len(threads)))
self.assertEquals(len(threads), 1, "Expected 1 thread to stop at breakpoint, %d did."%(len(threads)))

View File

@ -56,7 +56,7 @@ class BundleWithDotInFilenameTestCase(TestBase):
self.assertTrue(target.IsValid(), 'Should have a valid Target after attaching to process')
setup_complete = target.FindFirstGlobalVariable("setup_is_complete")
self.assertTrue(setup_complete.GetValueAsUnsigned() == 1, 'Check that inferior process has completed setup')
self.assertEquals(setup_complete.GetValueAsUnsigned(), 1, 'Check that inferior process has completed setup')
# Find the bundle module, see if we found the dSYM too (they're both in "hide.app")
i = 0

View File

@ -53,7 +53,7 @@ class DeepBundleTestCase(TestBase):
self.assertTrue(target.IsValid(), 'Should have a valid Target after attaching to process')
setup_complete = target.FindFirstGlobalVariable("setup_is_complete")
self.assertTrue(setup_complete.GetValueAsUnsigned() == 1, 'Check that inferior process has completed setup')
self.assertEquals(setup_complete.GetValueAsUnsigned(), 1, 'Check that inferior process has completed setup')
# Find the bundle module, see if we found the dSYM too (they're both in "hide.app")
i = 0

View File

@ -31,12 +31,14 @@ class TestInterruptThreadNames(TestBase):
listener = self.dbg.GetListener()
broadcaster = process.GetBroadcaster()
rc = broadcaster.AddListener(listener, lldb.SBProcess.eBroadcastBitStateChanged)
self.assertTrue(rc != 0, "Unable to add listener to process")
self.assertNotEqual(rc, 0, "Unable to add listener to process")
self.assertTrue(self.wait_for_running(process, listener), "Check that process is up and running")
inferior_set_up = self.wait_until_program_setup_complete(process, listener)
self.assertTrue(inferior_set_up.IsValid() and inferior_set_up.GetValueAsSigned() == 1, "Check that the program was able to create its threads within the allotted time")
# Check that the program was able to create its threads within the allotted time
self.assertTrue(inferior_set_up.IsValid())
self.assertEquals(inferior_set_up.GetValueAsSigned(), 1)
self.check_number_of_threads(process)

View File

@ -155,7 +155,7 @@ class UniversalTestCase(TestBase):
# backtracing failed.
threads = lldbutil.continue_to_breakpoint(process, bkpt)
self.assertTrue(len(threads) == 1)
self.assertEquals(len(threads), 1)
thread = threads[0]
self.assertTrue(
thread.GetNumFrames() > 1,

View File

@ -46,7 +46,7 @@ class SBTypeMemberFunctionsTest(TestBase):
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
self.assertTrue(process.GetState() == lldb.eStateStopped)
self.assertEquals(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(

View File

@ -40,7 +40,7 @@ class SBFrameFindValueTestCase(TestBase):
threads = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint)
self.assertTrue(len(threads) == 1)
self.assertEquals(len(threads), 1)
self.thread = threads[0]
self.frame = self.thread.frames[0]
self.assertTrue(self.frame, "Frame 0 is valid.")

View File

@ -55,7 +55,7 @@ class TestNameLookup(TestBase):
self.assertGreaterEqual(len(mangled_to_symbol), 6)
for mangled in mangled_to_symbol.keys():
symbol_contexts = target.FindFunctions(mangled, lldb.eFunctionNameTypeFull)
self.assertTrue(symbol_contexts.GetSize() == 1)
self.assertEquals(symbol_contexts.GetSize(), 1)
for symbol_context in symbol_contexts:
self.assertTrue(symbol_context.GetFunction().IsValid())
self.assertTrue(symbol_context.GetSymbol().IsValid())

View File

@ -40,7 +40,7 @@ class ObjCSBTypeTestCase(TestBase):
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
self.assertTrue(process.GetState() == lldb.eStateStopped)
self.assertEquals(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(
@ -60,9 +60,9 @@ class ObjCSBTypeTestCase(TestBase):
aFooType = aBarType.GetDirectBaseClassAtIndex(0)
self.assertTrue(aFooType.IsValid(), "Foo should be a valid data type")
self.assertTrue(aFooType.GetName() == "Foo", "Foo has the right name")
self.assertEquals(aFooType.GetName(), "Foo", "Foo has the right name")
self.assertTrue(aBarType.GetNumberOfFields() == 1, "Bar has a field")
self.assertEquals(aBarType.GetNumberOfFields(), 1, "Bar has a field")
aBarField = aBarType.GetFieldAtIndex(0)
self.assertTrue(

View File

@ -63,7 +63,7 @@ class SBValuePersistTestCase(TestBase):
self.assertTrue(
barPersist.GetPointeeData().sint32[0] == 4,
"barPersist != 4")
self.assertTrue(bazPersist.GetSummary() == '"85"', "bazPersist != 85")
self.assertEquals(bazPersist.GetSummary(), '"85"', "bazPersist != 85")
self.runCmd("continue")
@ -77,6 +77,6 @@ class SBValuePersistTestCase(TestBase):
self.assertTrue(
barPersist.GetPointeeData().sint32[0] == 4,
"barPersist != 4")
self.assertTrue(bazPersist.GetSummary() == '"85"', "bazPersist != 85")
self.assertEquals(bazPersist.GetSummary(), '"85"', "bazPersist != 85")
self.expect("expr *(%s)" % (barPersist.GetName()), substrs=['= 4'])

View File

@ -60,7 +60,7 @@ class ChangeValueAPITestCase(TestBase):
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
self.assertTrue(process.GetState() == lldb.eStateStopped)
self.assertEquals(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(
@ -76,7 +76,7 @@ class ChangeValueAPITestCase(TestBase):
self.assertTrue(val_value.IsValid(), "Got the SBValue for val")
actual_value = val_value.GetValueAsSigned(error, 0)
self.assertTrue(error.Success(), "Got a value from val")
self.assertTrue(actual_value == 100, "Got the right value from val")
self.assertEquals(actual_value, 100, "Got the right value from val")
result = val_value.SetValueFromCString("12345")
self.assertTrue(result, "Setting val returned True.")
@ -99,7 +99,7 @@ class ChangeValueAPITestCase(TestBase):
self.assertTrue(
error.Success(),
"Got an unsigned value for second_val")
self.assertTrue(actual_value == 5555)
self.assertEquals(actual_value, 5555)
result = mine_second_value.SetValueFromCString("98765")
self.assertTrue(result, "Success setting mine.second_value.")
@ -107,7 +107,7 @@ class ChangeValueAPITestCase(TestBase):
self.assertTrue(
error.Success(),
"Got a changed value from mine.second_val")
self.assertTrue(actual_value == 98765,
self.assertEquals(actual_value, 98765,
"Got the right changed value from mine.second_val")
# Next do the same thing with the pointer version.
@ -120,7 +120,7 @@ class ChangeValueAPITestCase(TestBase):
self.assertTrue(
error.Success(),
"Got an unsigned value for ptr->second_val")
self.assertTrue(actual_value == 6666)
self.assertEquals(actual_value, 6666)
result = ptr_second_value.SetValueFromCString("98765")
self.assertTrue(result, "Success setting ptr->second_value.")
@ -128,7 +128,7 @@ class ChangeValueAPITestCase(TestBase):
self.assertTrue(
error.Success(),
"Got a changed value from ptr->second_val")
self.assertTrue(actual_value == 98765,
self.assertEquals(actual_value, 98765,
"Got the right changed value from ptr->second_val")
# gcc may set multiple locations for breakpoint
@ -138,7 +138,7 @@ class ChangeValueAPITestCase(TestBase):
# values as well...
process.Continue()
self.assertTrue(process.GetState() == lldb.eStateStopped)
self.assertEquals(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(
@ -171,7 +171,7 @@ class ChangeValueAPITestCase(TestBase):
process.Continue()
self.assertTrue(process.GetState() == lldb.eStateStopped)
self.assertEquals(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(

View File

@ -28,7 +28,7 @@ class ValueAPIEmptyClassTestCase(TestBase):
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
self.assertTrue(process.GetState() == lldb.eStateStopped)
self.assertEquals(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(

View File

@ -112,7 +112,7 @@ class TestGdbRemoteThreadsInStopReply(
pcs_text = results["thread-pcs"]
thread_ids = threads_text.split(",")
pcs = pcs_text.split(",")
self.assertTrue(len(thread_ids) == len(pcs))
self.assertEquals(len(thread_ids), len(pcs))
thread_pcs = dict()
for i in range(0, len(pcs)):

View File

@ -40,7 +40,7 @@ class TestGdbRemoteGPacket(gdbremote_testcase.GdbRemoteTestCaseBase):
self.connect_to_debug_monitor()
context = self.expect_gdbremote_sequence()
register_bank = context.get("register_bank")
self.assertTrue(register_bank[0] != 'E')
self.assertNotEqual(register_bank[0], 'E')
self.test_sequence.add_log_lines(
["read packet: $G" + register_bank + "#00",
@ -48,7 +48,7 @@ class TestGdbRemoteGPacket(gdbremote_testcase.GdbRemoteTestCaseBase):
"capture": {1: "G_reply"}}],
True)
context = self.expect_gdbremote_sequence()
self.assertTrue(context.get("G_reply")[0] != 'E')
self.assertNotEqual(context.get("G_reply")[0], 'E')
@skipIfOutOfTreeDebugserver
@debugserver_test
@ -105,7 +105,7 @@ class TestGdbRemoteGPacket(gdbremote_testcase.GdbRemoteTestCaseBase):
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
reg_bank = context.get("register_bank")
self.assertTrue(reg_bank[0] != 'E')
self.assertNotEqual(reg_bank[0], 'E')
byte_order = self.get_target_byte_order()
get_reg_value = lambda reg_name : _extract_register_value(

View File

@ -165,7 +165,7 @@ class TestVSCode_attach(lldbvscode_testcase.VSCodeTestCaseBase):
functions = ['main']
breakpoint_ids = self.set_function_breakpoints(functions)
self.assertTrue(len(breakpoint_ids) == len(functions),
self.assertEquals(len(breakpoint_ids), len(functions),
"expect one breakpoint")
self.continue_to_breakpoints(breakpoint_ids)
output = self.get_console(timeout=1.0)

View File

@ -48,7 +48,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
line_to_id = {}
if response:
breakpoints = response['body']['breakpoints']
self.assertTrue(len(breakpoints) == len(lines),
self.assertEquals(len(breakpoints), len(lines),
"expect %u source breakpoints" % (len(lines)))
for breakpoint in breakpoints:
line = breakpoint['line']
@ -71,13 +71,13 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
response = self.vscode.request_setBreakpoints(source_path, lines)
if response:
breakpoints = response['body']['breakpoints']
self.assertTrue(len(breakpoints) == len(lines),
self.assertEquals(len(breakpoints), len(lines),
"expect %u source breakpoints" % (len(lines)))
for breakpoint in breakpoints:
line = breakpoint['line']
# Verify the same breakpoints are still set within LLDB by
# making sure the breakpoint ID didn't change
self.assertTrue(line_to_id[line] == breakpoint['id'],
self.assertEquals(line_to_id[line], breakpoint['id'],
"verify previous breakpoints stayed the same")
self.assertTrue(line in lines, "line expected in lines array")
self.assertTrue(breakpoint['verified'],
@ -90,13 +90,13 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
response = self.vscode.request_testGetTargetBreakpoints()
if response:
breakpoints = response['body']['breakpoints']
self.assertTrue(len(breakpoints) == len(lines),
self.assertEquals(len(breakpoints), len(lines),
"expect %u source breakpoints" % (len(lines)))
for breakpoint in breakpoints:
line = breakpoint['line']
# Verify the same breakpoints are still set within LLDB by
# making sure the breakpoint ID didn't change
self.assertTrue(line_to_id[line] == breakpoint['id'],
self.assertEquals(line_to_id[line], breakpoint['id'],
"verify previous breakpoints stayed the same")
self.assertTrue(line in lines, "line expected in lines array")
self.assertTrue(breakpoint['verified'],
@ -108,14 +108,14 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
response = self.vscode.request_setBreakpoints(source_path, lines)
if response:
breakpoints = response['body']['breakpoints']
self.assertTrue(len(breakpoints) == len(lines),
self.assertEquals(len(breakpoints), len(lines),
"expect %u source breakpoints" % (len(lines)))
# Verify with the target that all breakpoints have been cleared
response = self.vscode.request_testGetTargetBreakpoints()
if response:
breakpoints = response['body']['breakpoints']
self.assertTrue(len(breakpoints) == len(lines),
self.assertEquals(len(breakpoints), len(lines),
"expect %u source breakpoints" % (len(lines)))
# Now set a breakpoint again in the same source file and verify it
@ -124,7 +124,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
response = self.vscode.request_setBreakpoints(source_path, lines)
if response:
breakpoints = response['body']['breakpoints']
self.assertTrue(len(breakpoints) == len(lines),
self.assertEquals(len(breakpoints), len(lines),
"expect %u source breakpoints" % (len(lines)))
for breakpoint in breakpoints:
line = breakpoint['line']
@ -139,7 +139,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
response = self.vscode.request_testGetTargetBreakpoints()
if response:
breakpoints = response['body']['breakpoints']
self.assertTrue(len(breakpoints) == len(lines),
self.assertEquals(len(breakpoints), len(lines),
"expect %u source breakpoints" % (len(lines)))
for breakpoint in breakpoints:
line = breakpoint['line']
@ -160,7 +160,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
# Set a breakpoint at the loop line with no condition and no
# hitCondition
breakpoint_ids = self.set_source_breakpoints(source_path, [loop_line])
self.assertTrue(len(breakpoint_ids) == 1, "expect one breakpoint")
self.assertEquals(len(breakpoint_ids), 1, "expect one breakpoint")
self.vscode.request_continue()
# Verify we hit the breakpoint we just set
@ -168,38 +168,38 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
# Make sure i is zero at first breakpoint
i = int(self.vscode.get_local_variable_value('i'))
self.assertTrue(i == 0, 'i != 0 after hitting breakpoint')
self.assertEquals(i, 0, 'i != 0 after hitting breakpoint')
# Update the condition on our breakpoint
new_breakpoint_ids = self.set_source_breakpoints(source_path,
[loop_line],
condition="i==4")
self.assertTrue(breakpoint_ids == new_breakpoint_ids,
self.assertEquals(breakpoint_ids, new_breakpoint_ids,
"existing breakpoint should have its condition "
"updated")
self.continue_to_breakpoints(breakpoint_ids)
i = int(self.vscode.get_local_variable_value('i'))
self.assertTrue(i == 4,
self.assertEquals(i, 4,
'i != 4 showing conditional works')
new_breakpoint_ids = self.set_source_breakpoints(source_path,
[loop_line],
hitCondition="2")
self.assertTrue(breakpoint_ids == new_breakpoint_ids,
self.assertEquals(breakpoint_ids, new_breakpoint_ids,
"existing breakpoint should have its condition "
"updated")
# Continue with a hitContidtion of 2 and expect it to skip 1 value
self.continue_to_breakpoints(breakpoint_ids)
i = int(self.vscode.get_local_variable_value('i'))
self.assertTrue(i == 6,
self.assertEquals(i, 6,
'i != 6 showing hitCondition works')
# continue after hitting our hitCondition and make sure it only goes
# up by 1
self.continue_to_breakpoints(breakpoint_ids)
i = int(self.vscode.get_local_variable_value('i'))
self.assertTrue(i == 7,
self.assertEquals(i, 7,
'i != 7 showing post hitCondition hits every time')

View File

@ -41,7 +41,7 @@ class TestVSCode_setFunctionBreakpoints(
response = self.vscode.request_setFunctionBreakpoints(functions)
if response:
breakpoints = response['body']['breakpoints']
self.assertTrue(len(breakpoints) == len(functions),
self.assertEquals(len(breakpoints), len(functions),
"expect %u source breakpoints" % (len(functions)))
for breakpoint in breakpoints:
bp_id_12 = breakpoint['id']
@ -53,7 +53,7 @@ class TestVSCode_setFunctionBreakpoints(
response = self.vscode.request_setFunctionBreakpoints(functions)
if response:
breakpoints = response['body']['breakpoints']
self.assertTrue(len(breakpoints) == len(functions),
self.assertEquals(len(breakpoints), len(functions),
"expect %u source breakpoints" % (len(functions)))
for breakpoint in breakpoints:
self.assertTrue(breakpoint['verified'],
@ -65,11 +65,11 @@ class TestVSCode_setFunctionBreakpoints(
response = self.vscode.request_setFunctionBreakpoints(functions)
if response:
breakpoints = response['body']['breakpoints']
self.assertTrue(len(breakpoints) == len(functions),
self.assertEquals(len(breakpoints), len(functions),
"expect %u source breakpoints" % (len(functions)))
for breakpoint in breakpoints:
bp_id = breakpoint['id']
self.assertTrue(bp_id == bp_id_12,
self.assertEquals(bp_id, bp_id_12,
'verify "twelve" breakpoint ID is same')
self.assertTrue(breakpoint['verified'],
"expect breakpoint still verified")
@ -81,11 +81,11 @@ class TestVSCode_setFunctionBreakpoints(
response = self.vscode.request_testGetTargetBreakpoints()
if response:
breakpoints = response['body']['breakpoints']
self.assertTrue(len(breakpoints) == len(functions),
self.assertEquals(len(breakpoints), len(functions),
"expect %u source breakpoints" % (len(functions)))
for breakpoint in breakpoints:
bp_id = breakpoint['id']
self.assertTrue(bp_id == bp_id_12,
self.assertEquals(bp_id, bp_id_12,
'verify "twelve" breakpoint ID is same')
self.assertTrue(breakpoint['verified'],
"expect breakpoint still verified")
@ -96,14 +96,14 @@ class TestVSCode_setFunctionBreakpoints(
response = self.vscode.request_setFunctionBreakpoints(functions)
if response:
breakpoints = response['body']['breakpoints']
self.assertTrue(len(breakpoints) == len(functions),
self.assertEquals(len(breakpoints), len(functions),
"expect %u source breakpoints" % (len(functions)))
# Verify with the target that all breakpoints have been cleared
response = self.vscode.request_testGetTargetBreakpoints()
if response:
breakpoints = response['body']['breakpoints']
self.assertTrue(len(breakpoints) == len(functions),
self.assertEquals(len(breakpoints), len(functions),
"expect %u source breakpoints" % (len(functions)))
@skipIfWindows
@ -117,7 +117,7 @@ class TestVSCode_setFunctionBreakpoints(
functions = ['twelve']
breakpoint_ids = self.set_function_breakpoints(functions)
self.assertTrue(len(breakpoint_ids) == len(functions),
self.assertEquals(len(breakpoint_ids), len(functions),
"expect one breakpoint")
# Verify we hit the breakpoint we just set
@ -125,35 +125,35 @@ class TestVSCode_setFunctionBreakpoints(
# Make sure i is zero at first breakpoint
i = int(self.vscode.get_local_variable_value('i'))
self.assertTrue(i == 0, 'i != 0 after hitting breakpoint')
self.assertEquals(i, 0, 'i != 0 after hitting breakpoint')
# Update the condition on our breakpoint
new_breakpoint_ids = self.set_function_breakpoints(functions,
condition="i==4")
self.assertTrue(breakpoint_ids == new_breakpoint_ids,
self.assertEquals(breakpoint_ids, new_breakpoint_ids,
"existing breakpoint should have its condition "
"updated")
self.continue_to_breakpoints(breakpoint_ids)
i = int(self.vscode.get_local_variable_value('i'))
self.assertTrue(i == 4,
self.assertEquals(i, 4,
'i != 4 showing conditional works')
new_breakpoint_ids = self.set_function_breakpoints(functions,
hitCondition="2")
self.assertTrue(breakpoint_ids == new_breakpoint_ids,
self.assertEquals(breakpoint_ids, new_breakpoint_ids,
"existing breakpoint should have its condition "
"updated")
# Continue with a hitContidtion of 2 and expect it to skip 1 value
self.continue_to_breakpoints(breakpoint_ids)
i = int(self.vscode.get_local_variable_value('i'))
self.assertTrue(i == 6,
self.assertEquals(i, 6,
'i != 6 showing hitCondition works')
# continue after hitting our hitCondition and make sure it only goes
# up by 1
self.continue_to_breakpoints(breakpoint_ids)
i = int(self.vscode.get_local_variable_value('i'))
self.assertTrue(i == 7,
self.assertEquals(i, 7,
'i != 7 showing post hitCondition hits every time')

View File

@ -102,7 +102,7 @@ class TestVSCode_launch(lldbvscode_testcase.VSCodeTestCaseBase):
for line in lines:
if line.startswith(prefix):
found = True
self.assertTrue(program_parent_dir == line[len(prefix):],
self.assertEquals(program_parent_dir, line[len(prefix):],
"lldb-vscode working dir '%s' == '%s'" % (
program_parent_dir, line[6:]))
self.assertTrue(found, "verified lldb-vscode working directory")
@ -127,7 +127,7 @@ class TestVSCode_launch(lldbvscode_testcase.VSCodeTestCaseBase):
if line.startswith(prefix):
found = True
quoted_path = '"%s"' % (program_dir)
self.assertTrue(quoted_path == line[len(prefix):],
self.assertEquals(quoted_path, line[len(prefix):],
"lldb-vscode working dir %s == %s" % (
quoted_path, line[6:]))
self.assertTrue(found, 'found "sourcePath" in console output')
@ -144,7 +144,7 @@ class TestVSCode_launch(lldbvscode_testcase.VSCodeTestCaseBase):
self.continue_to_exit()
# Now get the STDOUT and verify our program argument is correct
output = self.get_stdout()
self.assertTrue(output is None or len(output) == 0,
self.assertEquals(output, None,
"expect no program output")
@skipIfWindows
@ -296,7 +296,7 @@ class TestVSCode_launch(lldbvscode_testcase.VSCodeTestCaseBase):
# Set 2 breakoints so we can verify that "stopCommands" get run as the
# breakpoints get hit
breakpoint_ids = self.set_source_breakpoints(source, lines)
self.assertTrue(len(breakpoint_ids) == len(lines),
self.assertEquals(len(breakpoint_ids), len(lines),
"expect correct number of breakpoints")
# Continue after launch and hit the first breakpoint.

View File

@ -41,13 +41,13 @@ class TestVSCode_stackTrace(lldbvscode_testcase.VSCodeTestCaseBase):
else:
expected_line = self.recurse_invocation
expected_name = 'main'
self.assertTrue(frame_name == expected_name,
self.assertEquals(frame_name, expected_name,
'frame #%i name "%s" == "%s"' % (
frame_idx, frame_name, expected_name))
self.assertTrue(frame_source == self.source_path,
self.assertEquals(frame_source, self.source_path,
'frame #%i source "%s" == "%s"' % (
frame_idx, frame_source, self.source_path))
self.assertTrue(frame_line == expected_line,
self.assertEquals(frame_line, expected_line,
'frame #%i line %i == %i' % (frame_idx, frame_line,
expected_line))
@ -68,7 +68,7 @@ class TestVSCode_stackTrace(lldbvscode_testcase.VSCodeTestCaseBase):
# Set breakoint at a point of deepest recuusion
breakpoint_ids = self.set_source_breakpoints(source, lines)
self.assertTrue(len(breakpoint_ids) == len(lines),
self.assertEquals(len(breakpoint_ids), len(lines),
"expect correct number of breakpoints")
self.continue_to_breakpoints(breakpoint_ids)
@ -78,14 +78,14 @@ class TestVSCode_stackTrace(lldbvscode_testcase.VSCodeTestCaseBase):
frameCount = len(stackFrames)
self.assertTrue(frameCount >= 20,
'verify we get at least 20 frames for all frames')
self.assertTrue(totalFrames == frameCount,
self.assertEquals(totalFrames, frameCount,
'verify we get correct value for totalFrames count')
self.verify_stackFrames(startFrame, stackFrames)
# Verify all stack frames by specifying startFrame = 0 and levels not
# specified
stackFrames = self.get_stackFrames(startFrame=startFrame)
self.assertTrue(frameCount == len(stackFrames),
self.assertEquals(frameCount, len(stackFrames),
('verify same number of frames with startFrame=%i') % (
startFrame))
self.verify_stackFrames(startFrame, stackFrames)
@ -94,7 +94,7 @@ class TestVSCode_stackTrace(lldbvscode_testcase.VSCodeTestCaseBase):
levels = 0
stackFrames = self.get_stackFrames(startFrame=startFrame,
levels=levels)
self.assertTrue(frameCount == len(stackFrames),
self.assertEquals(frameCount, len(stackFrames),
('verify same number of frames with startFrame=%i and'
' levels=%i') % (startFrame, levels))
self.verify_stackFrames(startFrame, stackFrames)
@ -104,7 +104,7 @@ class TestVSCode_stackTrace(lldbvscode_testcase.VSCodeTestCaseBase):
levels = 1
stackFrames = self.get_stackFrames(startFrame=startFrame,
levels=levels)
self.assertTrue(levels == len(stackFrames),
self.assertEquals(levels, len(stackFrames),
('verify one frame with startFrame=%i and'
' levels=%i') % (startFrame, levels))
self.verify_stackFrames(startFrame, stackFrames)
@ -114,7 +114,7 @@ class TestVSCode_stackTrace(lldbvscode_testcase.VSCodeTestCaseBase):
levels = 3
stackFrames = self.get_stackFrames(startFrame=startFrame,
levels=levels)
self.assertTrue(levels == len(stackFrames),
self.assertEquals(levels, len(stackFrames),
('verify %i frames with startFrame=%i and'
' levels=%i') % (levels, startFrame, levels))
self.verify_stackFrames(startFrame, stackFrames)
@ -125,7 +125,7 @@ class TestVSCode_stackTrace(lldbvscode_testcase.VSCodeTestCaseBase):
levels = 16
stackFrames = self.get_stackFrames(startFrame=startFrame,
levels=levels)
self.assertTrue(levels == len(stackFrames),
self.assertEquals(levels, len(stackFrames),
('verify %i frames with startFrame=%i and'
' levels=%i') % (levels, startFrame, levels))
self.verify_stackFrames(startFrame, stackFrames)
@ -136,10 +136,10 @@ class TestVSCode_stackTrace(lldbvscode_testcase.VSCodeTestCaseBase):
(stackFrames, totalFrames) = self.get_stackFrames_and_totalFramesCount(
startFrame=startFrame,
levels=levels)
self.assertTrue(len(stackFrames) == frameCount - startFrame,
self.assertEquals(len(stackFrames), frameCount - startFrame,
('verify less than 1000 frames with startFrame=%i and'
' levels=%i') % (startFrame, levels))
self.assertTrue(totalFrames == frameCount,
self.assertEquals(totalFrames, frameCount,
'verify we get correct value for totalFrames count '
'when requested frames not from 0 index')
self.verify_stackFrames(startFrame, stackFrames)
@ -149,7 +149,7 @@ class TestVSCode_stackTrace(lldbvscode_testcase.VSCodeTestCaseBase):
levels = 0
stackFrames = self.get_stackFrames(startFrame=startFrame,
levels=levels)
self.assertTrue(len(stackFrames) == frameCount - startFrame,
self.assertEquals(len(stackFrames), frameCount - startFrame,
('verify less than 1000 frames with startFrame=%i and'
' levels=%i') % (startFrame, levels))
self.verify_stackFrames(startFrame, stackFrames)
@ -159,5 +159,5 @@ class TestVSCode_stackTrace(lldbvscode_testcase.VSCodeTestCaseBase):
levels = 1
stackFrames = self.get_stackFrames(startFrame=startFrame,
levels=levels)
self.assertTrue(0 == len(stackFrames),
self.assertEquals(0, len(stackFrames),
'verify zero frames with startFrame out of bounds')