Skip to content

[lldb] Replace assertEquals with assertEqual (NFC) #82073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lldb/packages/Python/lldbsuite/test/lldbutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,24 +696,24 @@ def check_breakpoint(
test.assertTrue(bkpt.IsValid(), "Breakpoint is not valid.")

if expected_locations is not None:
test.assertEquals(expected_locations, bkpt.GetNumLocations())
test.assertEqual(expected_locations, bkpt.GetNumLocations())

if expected_resolved_count is not None:
test.assertEquals(expected_resolved_count, bkpt.GetNumResolvedLocations())
test.assertEqual(expected_resolved_count, bkpt.GetNumResolvedLocations())
else:
expected_resolved_count = bkpt.GetNumLocations()
if location_id is None:
test.assertEquals(expected_resolved_count, bkpt.GetNumResolvedLocations())
test.assertEqual(expected_resolved_count, bkpt.GetNumResolvedLocations())

if expected_hit_count is not None:
test.assertEquals(expected_hit_count, bkpt.GetHitCount())
test.assertEqual(expected_hit_count, bkpt.GetHitCount())

if location_id is not None:
loc_bkpt = bkpt.FindLocationByID(location_id)
test.assertTrue(loc_bkpt.IsValid(), "Breakpoint location is not valid.")
test.assertEquals(loc_bkpt.IsResolved(), expected_location_resolved)
test.assertEqual(loc_bkpt.IsResolved(), expected_location_resolved)
if expected_location_hit_count is not None:
test.assertEquals(expected_location_hit_count, loc_bkpt.GetHitCount())
test.assertEqual(expected_location_hit_count, loc_bkpt.GetHitCount())


# ==================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def frame_disassemble_test(self):
)

# The hit count for the breakpoint should be 1.
self.assertEquals(breakpoint.GetHitCount(), 1)
self.assertEqual(breakpoint.GetHitCount(), 1)

frame = threads[0].GetFrameAtIndex(0)
disassembly = frame.Disassemble()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def call_function(self):
value = frame.EvaluateExpression("call_me (%d)" % (num_sigchld), options)
self.assertTrue(value.IsValid())
self.assertSuccess(value.GetError())
self.assertEquals(value.GetValueAsSigned(-1), num_sigchld)
self.assertEqual(value.GetValueAsSigned(-1), num_sigchld)

self.check_after_call(num_sigchld)

Expand All @@ -92,7 +92,7 @@ def call_function(self):

self.assertTrue(value.IsValid())
self.assertSuccess(value.GetError())
self.assertEquals(value.GetValueAsSigned(-1), num_sigchld)
self.assertEqual(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
Expand All @@ -103,7 +103,7 @@ def call_function(self):

self.assertTrue(value.IsValid())
self.assertSuccess(value.GetError())
self.assertEquals(value.GetValueAsSigned(-1), num_sigchld)
self.assertEqual(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
Expand All @@ -113,7 +113,7 @@ def call_function(self):

self.assertTrue(value.IsValid())
self.assertSuccess(value.GetError())
self.assertEquals(value.GetValueAsSigned(-1), num_sigchld)
self.assertEqual(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def call_function(self):

value = frame.EvaluateExpression("[my_class callMeIThrow]", options)
self.assertTrue(value.IsValid())
self.assertEquals(value.GetError().Success(), False)
self.assertEqual(value.GetError().Success(), False)

self.check_after_call()

Expand Down Expand Up @@ -86,7 +86,7 @@ def call_function(self):
value = frame.EvaluateExpression("[my_class iCatchMyself]", options)
self.assertTrue(value.IsValid())
self.assertSuccess(value.GetError())
self.assertEquals(value.GetValueAsUnsigned(), 57)
self.assertEqual(value.GetValueAsUnsigned(), 57)
self.check_after_call()
options.SetTrapExceptions(True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def assume_no_completions(self, str_input, cursor_pos=None):
for m in match_strings:
available_completions.append(m)

self.assertEquals(
self.assertEqual(
num_matches,
0,
"Got matches, but didn't expect any: " + str(available_completions),
Expand Down
10 changes: 5 additions & 5 deletions lldb/test/API/commands/expression/fixits/TestFixIts.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_with_target(self):
value = frame.EvaluateExpression("my_pointer.first", options)
self.assertTrue(value.IsValid())
self.assertSuccess(value.GetError())
self.assertEquals(value.GetValueAsUnsigned(), 10)
self.assertEqual(value.GetValueAsUnsigned(), 10)

# Try with one error in a top-level expression.
# The Fix-It changes "ptr.m" to "ptr->m".
Expand All @@ -56,22 +56,22 @@ def test_with_target(self):
# unknown error . If a parsing error would have happened we
# would get a different error kind, so let's check the error
# kind here.
self.assertEquals(value.GetError().GetCString(), "unknown error")
self.assertEqual(value.GetError().GetCString(), "unknown error")

# Try with two errors:
two_error_expression = "my_pointer.second->a"
value = frame.EvaluateExpression(two_error_expression, options)
self.assertTrue(value.IsValid())
self.assertSuccess(value.GetError())
self.assertEquals(value.GetValueAsUnsigned(), 20)
self.assertEqual(value.GetValueAsUnsigned(), 20)

# Try a Fix-It that is stored in the 'note:' diagnostic of an error.
# The Fix-It here is adding parantheses around the ToStr parameters.
fixit_in_note_expr = "#define ToStr(x) #x\nToStr(0 {, })"
value = frame.EvaluateExpression(fixit_in_note_expr, options)
self.assertTrue(value.IsValid())
self.assertSuccess(value.GetError())
self.assertEquals(value.GetSummary(), '"(0 {, })"')
self.assertEqual(value.GetSummary(), '"(0 {, })"')

# Now turn off the fixits, and the expression should fail:
options.SetAutoApplyFixIts(False)
Expand Down Expand Up @@ -178,7 +178,7 @@ def test_with_multiple_retries(self):
multiple_runs_options.SetRetriesWithFixIts(2)
value = frame.EvaluateExpression(two_runs_expr, multiple_runs_options)
# This error signals success for top level expressions.
self.assertEquals(value.GetError().GetCString(), "unknown error")
self.assertEqual(value.GetError().GetCString(), "unknown error")

# Test that the code above compiles to the right thing.
self.expect_expr("test_X(1)", result_type="int", result_value="123")
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_save_jit_objects(self):

self.cleanJITFiles()
frame.EvaluateExpression("(void*)malloc(0x1)")
self.assertEquals(
self.assertEqual(
self.countJITFiles(), 0, "No files emitted with save-jit-objects-dir empty"
)

Expand Down
8 changes: 4 additions & 4 deletions lldb/test/API/commands/expression/test/TestExprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_evaluate_expression_python(self):
)

# We should be stopped on the breakpoint with a hit count of 1.
self.assertEquals(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE)
self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE)

#
# Use Python API to evaluate expressions while stopped in a stack frame.
Expand Down Expand Up @@ -169,15 +169,15 @@ def test_evaluate_expression_python(self):
self.expect(
"expression -i true -- a_function_to_call()", substrs=["(int) $", " 1"]
)
self.assertEquals(callee_break.GetHitCount(), 1)
self.assertEqual(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.assertEquals(value.GetValueAsSigned(0), 2)
self.assertEquals(callee_break.GetHitCount(), 2)
self.assertEqual(value.GetValueAsSigned(0), 2)
self.assertEqual(callee_break.GetHitCount(), 2)

# rdar://problem/8686536
# CommandInterpreter::HandleCommand is stripping \'s from input for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test(self):
return_value = interp.HandleCommand(
"expr -t 100 -u true -- wait_a_while(1000000)", result
)
self.assertEquals(return_value, lldb.eReturnStatusFailed)
self.assertEqual(return_value, lldb.eReturnStatusFailed)

# Okay, now do it again with long enough time outs:

Expand All @@ -63,7 +63,7 @@ def test(self):
return_value = interp.HandleCommand(
"expr -t 1000000 -u true -- wait_a_while(1000)", result
)
self.assertEquals(return_value, lldb.eReturnStatusSuccessFinishResult)
self.assertEqual(return_value, lldb.eReturnStatusSuccessFinishResult)

# Finally set the one thread timeout and make sure that doesn't change
# things much:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_conditional_bktp(self):
main_frame = self.thread.GetFrameAtIndex(0)
val = main_frame.EvaluateExpression("second_function(47)", options)
self.assertSuccess(val.GetError(), "We did complete the execution.")
self.assertEquals(47, val.GetValueAsSigned())
self.assertEqual(47, val.GetValueAsSigned())

@add_test_categories(["pyapi"])
@expectedFlakeyNetBSD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def do_test(self):
)

# The hit count for the breakpoint should be 1.
self.assertEquals(breakpoint.GetHitCount(), 1)
self.assertEqual(breakpoint.GetHitCount(), 1)

thread = threads[0]

Expand Down
2 changes: 1 addition & 1 deletion lldb/test/API/commands/frame/var/TestFrameVar.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def do_test(self):
)

# The hit count for the breakpoint should be 1.
self.assertEquals(breakpoint.GetHitCount(), 1)
self.assertEqual(breakpoint.GetHitCount(), 1)

frame = threads[0].GetFrameAtIndex(0)
command_result = lldb.SBCommandReturnObject()
Expand Down
4 changes: 2 additions & 2 deletions lldb/test/API/commands/log/basic/TestLogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_log_truncate(self):
contents = f.read()

# check that it got removed
self.assertEquals(contents.find("bacon"), -1)
self.assertEqual(contents.find("bacon"), -1)

# Check that lldb can append to a log file
def test_log_append(self):
Expand All @@ -79,7 +79,7 @@ def test_log_append(self):
contents = f.read()

# check that it is still there
self.assertEquals(contents.find("bacon"), 0)
self.assertEqual(contents.find("bacon"), 0)

# Enable all log options and check that nothing crashes.
@skipIfWindows
Expand Down
4 changes: 2 additions & 2 deletions lldb/test/API/commands/memory/read/TestMemoryRead.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_memory_read(self):
address = int(items[0], 0)
argc = int(items[1], 0)
self.assertGreater(address, 0)
self.assertEquals(argc, 1)
self.assertEqual(argc, 1)

# (lldb) memory read --format uint32_t[] --size 4 --count 4 `&argc`
# 0x7fff5fbff9a0: {0x00000001}
Expand Down Expand Up @@ -130,7 +130,7 @@ def test_memory_read(self):
# Check that we got back 4 0x0000 etc bytes
for o in objects_read:
self.assertEqual(len(o), expected_object_length)
self.assertEquals(len(objects_read), 4)
self.assertEqual(len(objects_read), 4)

def test_memory_read_file(self):
self.build_run_stop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def test_step_over_read_watchpoint(self):
lldb.eStopReasonWatchpoint,
STOPPED_DUE_TO_WATCHPOINT,
)
self.assertEquals(thread.GetStopDescription(20), "watchpoint 1")
self.assertEqual(thread.GetStopDescription(20), "watchpoint 1")

process.Continue()
self.assertState(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
self.assertEquals(thread.GetStopDescription(20), "step over")
self.assertEqual(thread.GetStopDescription(20), "step over")

self.step_inst_for_watchpoint(1)

Expand Down Expand Up @@ -95,11 +95,11 @@ def test_step_over_write_watchpoint(self):
lldb.eStopReasonWatchpoint,
STOPPED_DUE_TO_WATCHPOINT,
)
self.assertEquals(thread.GetStopDescription(20), "watchpoint 1")
self.assertEqual(thread.GetStopDescription(20), "watchpoint 1")

process.Continue()
self.assertState(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
self.assertEquals(thread.GetStopDescription(20), "step over")
self.assertEqual(thread.GetStopDescription(20), "step over")

self.step_inst_for_watchpoint(1)

Expand All @@ -113,7 +113,7 @@ def step_inst_for_watchpoint(self, wp_id):
self.assertFalse(watchpoint_hit, "Watchpoint already hit.")
expected_stop_desc = "watchpoint %d" % wp_id
actual_stop_desc = self.thread().GetStopDescription(20)
self.assertEquals(
self.assertEqual(
actual_stop_desc, expected_stop_desc, "Watchpoint ID didn't match."
)
watchpoint_hit = True
Expand Down
2 changes: 1 addition & 1 deletion lldb/test/API/driver/job_control/TestJobControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def post_spawn():
status = int(self.child.match[1])

self.assertTrue(os.WIFSTOPPED(status))
self.assertEquals(os.WSTOPSIG(status), signal.SIGTSTP)
self.assertEqual(os.WSTOPSIG(status), signal.SIGTSTP)

os.kill(self.lldb_pid, signal.SIGCONT)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def address_breakpoints(self):
)

# The hit count for the breakpoint should be 1.
self.assertEquals(breakpoint.GetHitCount(), 1)
self.assertEqual(breakpoint.GetHitCount(), 1)

process.Kill()

Expand All @@ -82,4 +82,4 @@ def address_breakpoints(self):

# The hit count for the breakpoint should be 1, since we reset counts
# for each run.
self.assertEquals(breakpoint.GetHitCount(), 1)
self.assertEqual(breakpoint.GetHitCount(), 1)
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def address_breakpoints(self):
bkpt = target.BreakpointCreateByAddress(illegal_address)
# Verify that breakpoint is not resolved.
for bp_loc in bkpt:
self.assertEquals(bp_loc.IsResolved(), False)
self.assertEqual(bp_loc.IsResolved(), False)
else:
self.fail(
"Could not find an illegal address at which to set a bad breakpoint."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ def breakpoint_command_sequence(self):
self.runCmd("run", RUN_SUCCEEDED)

# Check the value of canary variables.
self.assertEquals("one liner was here", side_effect.one_liner)
self.assertEquals("function was here", side_effect.bktptcmd)
self.assertEqual("one liner was here", side_effect.one_liner)
self.assertEqual("function was here", side_effect.bktptcmd)

# Finish the program.
self.runCmd("process continue")
Expand Down Expand Up @@ -558,10 +558,10 @@ def get_source_map_json(self):
return json.loads(stream.GetData())

def verify_source_map_entry_pair(self, entry, original, replacement):
self.assertEquals(
self.assertEqual(
entry[0], original, "source map entry 'original' does not match"
)
self.assertEquals(
self.assertEqual(
entry[1], replacement, "source map entry 'replacement' does not match"
)

Expand Down Expand Up @@ -604,7 +604,7 @@ def test_breakpoints_auto_source_map_relative(self):
# "./a/b/c/main.cpp".

source_map_json = self.get_source_map_json()
self.assertEquals(
self.assertEqual(
len(source_map_json), 0, "source map should be empty initially"
)
self.verify_source_map_deduce_statistics(target, 0)
Expand All @@ -621,7 +621,7 @@ def test_breakpoints_auto_source_map_relative(self):
)

source_map_json = self.get_source_map_json()
self.assertEquals(len(source_map_json), 1, "source map should not be empty")
self.assertEqual(len(source_map_json), 1, "source map should not be empty")
self.verify_source_map_entry_pair(source_map_json[0], ".", "/x/y")
self.verify_source_map_deduce_statistics(target, 1)

Expand All @@ -640,7 +640,7 @@ def test_breakpoints_auto_source_map_relative(self):
)

source_map_json = self.get_source_map_json()
self.assertEquals(len(source_map_json), 0, "source map should not be deduced")
self.assertEqual(len(source_map_json), 0, "source map should not be deduced")

def test_breakpoint_statistics_hitcount(self):
"""Test breakpoints statistics have hitCount field."""
Expand Down
Loading