Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def call_function(self):
handler_bkpt = target.BreakpointCreateBySourceRegex(
"Got sigchld %d.", self.main_source_spec
)
self.assertTrue(handler_bkpt.GetNumLocations() > 0)
self.assertGreater(handler_bkpt.GetNumLocations(), 0)
options.SetIgnoreBreakpoints(True)
options.SetUnwindOnError(True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def call_function(self):
handler_bkpt = target.BreakpointCreateBySourceRegex(
"I felt like it", self.main_source_spec
)
self.assertTrue(handler_bkpt.GetNumLocations() > 0)
self.assertGreater(handler_bkpt.GetNumLocations(), 0)
options.SetIgnoreBreakpoints(True)
options.SetUnwindOnError(True)

Expand All @@ -69,7 +69,7 @@ def call_function(self):
exception_bkpt = target.BreakpointCreateForException(
lldb.eLanguageTypeObjC, False, True
)
self.assertTrue(exception_bkpt.GetNumLocations() > 0)
self.assertGreater(exception_bkpt.GetNumLocations(), 0)

options.SetIgnoreBreakpoints(True)
options.SetUnwindOnError(True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test(self):
callee_break = target.BreakpointCreateByName(
"SomeClass::SomeClass(ParamClass)", None
)
self.assertTrue(callee_break.GetNumLocations() > 0)
self.assertGreater(callee_break.GetNumLocations(), 0)
self.runCmd("run", RUN_SUCCEEDED)

to_complete = "e ParamClass"
Expand Down
8 changes: 4 additions & 4 deletions lldb/test/API/commands/expression/fixits/TestFixIts.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ def test_with_target(self):
self.assertTrue(value.IsValid())
self.assertTrue(value.GetError().Fail())
error_string = value.GetError().GetCString()
self.assertTrue(
error_string.find("fixed expression suggested:") != -1, "Fix was suggested"
self.assertNotEqual(
error_string.find("fixed expression suggested:"), -1, "Fix was suggested"
)
self.assertTrue(
error_string.find("my_pointer->second.a") != -1, "Fix was right"
self.assertNotEqual(
error_string.find("my_pointer->second.a"), -1, "Fix was right"
)

def test_with_target_error_applies_fixit(self):
Expand Down
2 changes: 1 addition & 1 deletion lldb/test/API/commands/expression/test/TestExprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def test_evaluate_expression_python(self):
self.DebugSBValue(val)

callee_break = target.BreakpointCreateByName("a_function_to_call", None)
self.assertTrue(callee_break.GetNumLocations() > 0)
self.assertGreater(callee_break.GetNumLocations(), 0)

# Make sure ignoring breakpoints works from the command line:
self.expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ def do_unwind_test(self, thread, bkpt, timeout):

self.assertTrue(val.GetError().Fail(), "We did not complete the execution.")
error_str = val.GetError().GetCString()
self.assertTrue(
"Execution was interrupted, reason: breakpoint" in error_str,
self.assertIn(
"Execution was interrupted, reason: breakpoint",
error_str,
"And the reason was right.",
)

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

# Write back the current vg to confirm read/write works at all.
current_svg = self.match("register read vg", ["(0x[0-9]+)"])
self.assertTrue(current_svg is not None)
self.assertIsNotNone(current_svg)
self.expect("register write vg {}".format(current_svg.group()))

# Aka 128, 256 and 512 bit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_supported_vg(self):
)

current_vg = self.match("register read vg", ["(0x[0-9]+)"])
self.assertTrue(current_vg is not None)
self.assertIsNotNone(current_vg)
self.expect("register write vg {}".format(current_vg.group()))

# Aka 128, 256 and 512 bit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_supported_vg(self):

# Write back the current vg to confirm read/write works at all.
current_vg = self.match("register read vg", ["(0x[0-9]+)"])
self.assertTrue(current_vg is not None)
self.assertIsNotNone(current_vg)
self.expect("register write vg {}".format(current_vg.group()))

# Aka 128, 256 and 512 bit.
Expand Down
2 changes: 1 addition & 1 deletion lldb/test/API/commands/session/save/TestSessionSave.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_session_save(self):
raw += self.raw_transcript_builder(cmd, res)

self.assertTrue(interpreter.HasCommands())
self.assertTrue(len(raw) != 0)
self.assertNotEqual(len(raw), 0)

# Check for error
cmd = "session save /root/file"
Expand Down
4 changes: 2 additions & 2 deletions lldb/test/API/commands/statistics/basic/TestStats.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def test_had_frame_variable_errors(self):
# Get stats and verify we had errors.
stats = self.get_stats()
exe_stats = self.find_module_in_metrics(exe, stats)
self.assertTrue(exe_stats is not None)
self.assertIsNotNone(exe_stats)

# Make sure we have "debugInfoHadVariableErrors" variable that is set to
# false before failing to get local variables due to missing .o file.
Expand All @@ -620,7 +620,7 @@ def test_had_frame_variable_errors(self):
# Get stats and verify we had errors.
stats = self.get_stats()
exe_stats = self.find_module_in_metrics(exe, stats)
self.assertTrue(exe_stats is not None)
self.assertIsNotNone(exe_stats)

# Make sure we have "hadFrameVariableErrors" variable that is set to
# true after failing to get local variables due to missing .o file.
Expand Down
2 changes: 1 addition & 1 deletion lldb/test/API/commands/trace/TestTraceExport.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def _testHtrBasicSuperBlockPassSequenceCheck(self):
index_of_first_layer_1_block = None
for i, event in enumerate(data):
layer_id = event.get("pid")
self.assertTrue(layer_id is not None)
self.assertIsNotNone(layer_id)
if layer_id == 1 and index_of_first_layer_1_block is None:
index_of_first_layer_1_block = i
num_units_by_layer[layer_id] += 1
Expand Down
10 changes: 5 additions & 5 deletions lldb/test/API/commands/trace/TestTraceSave.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def checkSessionBundle(session_file_path):
with open(session_file_path) as session_file:
session = json.load(session_file)
# We expect tsc conversion info
self.assertTrue("tscPerfZeroConversion" in session)
self.assertIn("tscPerfZeroConversion", session)
# We expect at least one cpu
self.assertGreater(len(session["cpus"]), 0)

Expand Down Expand Up @@ -152,18 +152,18 @@ def checkSessionBundle(session_file_path):
copied_process = find(
lambda proc: proc["pid"] == process["pid"], copy["processes"]
)
self.assertTrue(copied_process is not None)
self.assertIsNotNone(copied_process)

for thread in process["threads"]:
copied_thread = find(
lambda thr: thr["tid"] == thread["tid"],
copied_process["threads"],
)
self.assertTrue(copied_thread is not None)
self.assertIsNotNone(copied_thread)

for cpu in original["cpus"]:
copied_cpu = find(lambda cor: cor["id"] == cpu["id"], copy["cpus"])
self.assertTrue(copied_cpu is not None)
self.assertIsNotNone(copied_cpu)

def testSaveTrace(self):
self.expect(
Expand Down Expand Up @@ -225,7 +225,7 @@ def testSaveKernelTrace(self):
original_file = json.load(original_file)
with open(copied_trace_file) as copy_file:
copy_file = json.load(copy_file)
self.assertTrue("kernel" in copy_file)
self.assertIn("kernel", copy_file)

self.assertEqual(
os.path.basename(original_file["kernel"]["file"]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def testStartPerCpuSession(self):
].strip()
output = json.loads(response)

self.assertTrue(output is not None)
self.assertIsNotNone(output)
self.assertIn("cpus", output)
self.assertIn("tscPerfZeroConversion", output)
found_non_empty_context_switch = False
Expand All @@ -249,8 +249,8 @@ def testStartPerCpuSession(self):
ipt_trace_size = binary_data["size"]
elif binary_data["kind"] == "perfContextSwitchTrace":
context_switch_size = binary_data["size"]
self.assertTrue(context_switch_size is not None)
self.assertTrue(ipt_trace_size is not None)
self.assertIsNotNone(context_switch_size)
self.assertIsNotNone(ipt_trace_size)
if context_switch_size > 0:
found_non_empty_context_switch = True

Expand Down
10 changes: 6 additions & 4 deletions lldb/test/API/functionalities/archives/TestBSDArchives.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ def check_frame_variable_errors(self, thread, error_strings):
api_error = var_list.GetError().GetCString()

for s in error_strings:
self.assertTrue(
s in command_error,
self.assertIn(
s,
command_error,
'Make sure "%s" exists in the command error "%s"' % (s, command_error),
)
for s in error_strings:
self.assertTrue(
s in api_error,
self.assertIn(
s,
api_error,
'Make sure "%s" exists in the API error "%s"' % (s, api_error),
)

Expand Down
6 changes: 3 additions & 3 deletions lldb/test/API/functionalities/asan/TestMemoryHistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def asan_tests(self):
self.assertEqual(threads.GetSize(), 2)

history_thread = threads.GetThreadAtIndex(0)
self.assertTrue(history_thread.num_frames >= 2)
self.assertGreaterEqual(history_thread.num_frames, 2)
self.assertEqual(
history_thread.frames[1].GetLineEntry().GetFileSpec().GetFilename(),
"main.c",
Expand All @@ -97,7 +97,7 @@ def asan_tests(self):
)

history_thread = threads.GetThreadAtIndex(1)
self.assertTrue(history_thread.num_frames >= 2)
self.assertGreaterEqual(history_thread.num_frames, 2)
self.assertEqual(
history_thread.frames[1].GetLineEntry().GetFileSpec().GetFilename(),
"main.c",
Expand All @@ -109,7 +109,7 @@ def asan_tests(self):
# let's free the container (SBThreadCollection) and see if the
# SBThreads still live
threads = None
self.assertTrue(history_thread.num_frames >= 2)
self.assertGreaterEqual(history_thread.num_frames, 2)
self.assertEqual(
history_thread.frames[1].GetLineEntry().GetFileSpec().GetFilename(),
"main.c",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ def test_breakpoints_with_relative_path_line_tables(self):
]
for path in valid_paths:
bkpt = target.BreakpointCreateByLocation(path, 2)
self.assertTrue(
bkpt.GetNumLocations() > 0,
self.assertGreater(
bkpt.GetNumLocations(),
0,
'Couldn\'t resolve breakpoint using full path "%s" in executate "%s" with '
"debug info that has relative path with matching suffix"
% (path, self.getBuildArtifact("a.out")),
Expand Down Expand Up @@ -142,8 +143,9 @@ def test_breakpoints_with_bad_aranges(self):
target = self.dbg.CreateTarget(obj_path)
src_path = "/tmp/ab/main.cpp"
bkpt = target.BreakpointCreateByLocation(src_path, 2)
self.assertTrue(
bkpt.GetNumLocations() > 0,
self.assertGreater(
bkpt.GetNumLocations(),
0,
'Couldn\'t resolve breakpoint using "%s" in executate "%s" with '
"debug info that has a bad .debug_aranges section"
% (src_path, self.getBuildArtifact("a.out")),
Expand Down Expand Up @@ -613,8 +615,9 @@ def test_breakpoints_auto_source_map_relative(self):
# is a suffix of request breakpoint file path
path = "/x/y/a/b/c/main.cpp"
bp = target.BreakpointCreateByLocation(path, 2)
self.assertTrue(
bp.GetNumLocations() > 0,
self.assertGreater(
bp.GetNumLocations(),
0,
'Couldn\'t resolve breakpoint using full path "%s" in executate "%s" with '
"debug info that has relative path with matching suffix"
% (path, self.getBuildArtifact("a.out")),
Expand All @@ -632,8 +635,9 @@ def test_breakpoints_auto_source_map_relative(self):
# equals the file path in debug info.
path = "a/b/c/main.cpp"
bp = target.BreakpointCreateByLocation(path, 2)
self.assertTrue(
bp.GetNumLocations() > 0,
self.assertGreater(
bp.GetNumLocations(),
0,
'Couldn\'t resolve breakpoint using full path "%s" in executate "%s" with '
"debug info that has relative path with matching suffix"
% (path, self.getBuildArtifact("a.out")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def do_set_python_command_from_python(self):
)
self.assertTrue(no_files_bkpt, VALID_BREAKPOINT)
num_locations = no_files_bkpt.GetNumLocations()
self.assertTrue(num_locations >= 2, "Got at least two breakpoint locations")
self.assertGreaterEqual(
num_locations, 2, "Got at least two breakpoint locations"
)
got_one_in_A = False
got_one_in_B = False
for idx in range(0, num_locations):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ def breakpoint_conditions_python(self):
"The thread index should be invalid",
)
# The thread name should be invalid, too.
self.assertTrue(
breakpoint.GetThreadName() is None, "The thread name should be invalid"
self.assertIsNone(
breakpoint.GetThreadName(), "The thread name should be invalid"
)

# Let's set the thread index for this breakpoint and verify that it is,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def test_step_range(self):
error = lldb.SBError()
thread.StepInto("", 4, error)
self.assertTrue(error.Fail())
self.assertTrue(
"Could not create hardware breakpoint for thread plan" in error.GetCString()
self.assertIn(
"Could not create hardware breakpoint for thread plan", error.GetCString()
)

@skipTestIfFn(HardwareBreakpointTestBase.supports_hw_breakpoints)
Expand All @@ -67,8 +67,8 @@ def test_step_out(self):
error = lldb.SBError()
thread.StepOut(error)
self.assertTrue(error.Fail())
self.assertTrue(
"Could not create hardware breakpoint for thread plan" in error.GetCString()
self.assertIn(
"Could not create hardware breakpoint for thread plan", error.GetCString()
)

@skipTestIfFn(HardwareBreakpointTestBase.supports_hw_breakpoints)
Expand Down Expand Up @@ -107,6 +107,6 @@ def test_step_until(self):
# Ensure we fail when stepping through the API.
error = thread.StepOverUntil(lldb.SBFrame(), lldb.SBFileSpec(), 5)
self.assertTrue(error.Fail())
self.assertTrue(
"Could not create hardware breakpoint for thread plan" in error.GetCString()
self.assertIn(
"Could not create hardware breakpoint for thread plan", error.GetCString()
)
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ def check_category_breakpoints(self):
)
for bp_loc in selector_bp:
function_name = bp_loc.GetAddress().GetSymbol().GetName()
self.assertTrue(
" myCategoryFunction]" in function_name,
self.assertIn(
" myCategoryFunction]",
function_name,
'Make sure all function names have " myCategoryFunction]" in their names',
)

Expand Down Expand Up @@ -108,8 +109,9 @@ def check_objc_breakpoints(self, have_dsym):
) # There are 93 on the latest MacOSX
for bp_loc in selector_bp:
function_name = bp_loc.GetAddress().GetSymbol().GetName()
self.assertTrue(
" count]" in function_name,
self.assertIn(
" count]",
function_name,
'Make sure all function names have " count]" in their names',
)

Expand All @@ -132,8 +134,9 @@ def check_objc_breakpoints(self, have_dsym):
)
for bp_loc in selector_bp:
function_name = bp_loc.GetAddress().GetSymbol().GetName()
self.assertTrue(
" isEqual:]" in function_name,
self.assertIn(
" isEqual:]",
function_name,
'Make sure all function names have " isEqual:]" in their names',
)

Expand Down
Loading