mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 23:49:22 +08:00
[lldb][test] Modernize asserts (#82503)
This uses [teyit](https://pypi.org/project/teyit/) to modernize asserts, as recommended by the [unittest release notes](https://docs.python.org/3.12/whatsnew/3.12.html#id3). For example, `assertTrue(a == b)` is replaced with `assertEqual(a, b)`. This produces better error messages, e.g. `error: unexpectedly found 1 and 2 to be different` instead of `error: False`.
This commit is contained in:
@@ -84,7 +84,7 @@ class ExprCommandThatRestartsTestCase(TestBase):
|
||||
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)
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class ExprCommandWithThrowTestCase(TestBase):
|
||||
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)
|
||||
|
||||
@@ -69,7 +69,7 @@ class ExprCommandWithThrowTestCase(TestBase):
|
||||
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)
|
||||
|
||||
@@ -11,7 +11,7 @@ class TestCase(TestBase):
|
||||
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"
|
||||
|
||||
@@ -79,11 +79,11 @@ class ExprCommandWithFixits(TestBase):
|
||||
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):
|
||||
|
||||
@@ -163,7 +163,7 @@ class BasicExprCommandsTestCase(TestBase):
|
||||
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(
|
||||
|
||||
@@ -70,8 +70,9 @@ class UnwindFromExpressionTest(TestBase):
|
||||
|
||||
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.",
|
||||
)
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class AArch64ZATestCase(TestBase):
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -28,7 +28,7 @@ class AArch64ZAThreadedTestCase(TestBase):
|
||||
)
|
||||
|
||||
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.
|
||||
|
||||
@@ -40,7 +40,7 @@ class RegisterCommandsTestCase(TestBase):
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -47,7 +47,7 @@ class SessionSaveTestCase(TestBase):
|
||||
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"
|
||||
|
||||
@@ -600,7 +600,7 @@ class TestCase(TestBase):
|
||||
# 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.
|
||||
@@ -620,7 +620,7 @@ class TestCase(TestBase):
|
||||
# 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.
|
||||
|
||||
@@ -229,7 +229,7 @@ class TestTraceExport(TraceIntelPTTestCaseBase):
|
||||
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
|
||||
|
||||
@@ -103,7 +103,7 @@ class TestTraceSave(TraceIntelPTTestCaseBase):
|
||||
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)
|
||||
|
||||
@@ -152,18 +152,18 @@ class TestTraceSave(TraceIntelPTTestCaseBase):
|
||||
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(
|
||||
@@ -225,7 +225,7 @@ class TestTraceSave(TraceIntelPTTestCaseBase):
|
||||
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"]),
|
||||
|
||||
@@ -236,7 +236,7 @@ class TestTraceStartStopMultipleThreads(TraceIntelPTTestCaseBase):
|
||||
].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
|
||||
@@ -249,8 +249,8 @@ class TestTraceStartStopMultipleThreads(TraceIntelPTTestCaseBase):
|
||||
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
|
||||
|
||||
|
||||
@@ -85,13 +85,15 @@ class BSDArchivesTestCase(TestBase):
|
||||
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),
|
||||
)
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ class AsanTestCase(TestBase):
|
||||
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",
|
||||
@@ -97,7 +97,7 @@ class AsanTestCase(TestBase):
|
||||
)
|
||||
|
||||
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",
|
||||
@@ -109,7 +109,7 @@ class AsanTestCase(TestBase):
|
||||
# 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",
|
||||
|
||||
@@ -86,8 +86,9 @@ class BreakpointCommandTestCase(TestBase):
|
||||
]
|
||||
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")),
|
||||
@@ -142,8 +143,9 @@ class BreakpointCommandTestCase(TestBase):
|
||||
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")),
|
||||
@@ -613,8 +615,9 @@ class BreakpointCommandTestCase(TestBase):
|
||||
# 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")),
|
||||
@@ -632,8 +635,9 @@ class BreakpointCommandTestCase(TestBase):
|
||||
# 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")),
|
||||
|
||||
@@ -76,7 +76,9 @@ class PythonBreakpointCommandSettingTestCase(TestBase):
|
||||
)
|
||||
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):
|
||||
|
||||
@@ -143,8 +143,8 @@ class BreakpointConditionsTestCase(TestBase):
|
||||
"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,
|
||||
|
||||
@@ -45,8 +45,8 @@ class BreakpointLocationsTestCase(HardwareBreakpointTestBase):
|
||||
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)
|
||||
@@ -67,8 +67,8 @@ class BreakpointLocationsTestCase(HardwareBreakpointTestBase):
|
||||
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)
|
||||
@@ -107,6 +107,6 @@ class BreakpointLocationsTestCase(HardwareBreakpointTestBase):
|
||||
# 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()
|
||||
)
|
||||
|
||||
@@ -42,8 +42,9 @@ class TestObjCBreakpoints(TestBase):
|
||||
)
|
||||
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',
|
||||
)
|
||||
|
||||
@@ -108,8 +109,9 @@ class TestObjCBreakpoints(TestBase):
|
||||
) # 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',
|
||||
)
|
||||
|
||||
@@ -132,8 +134,9 @@ class TestObjCBreakpoints(TestBase):
|
||||
)
|
||||
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',
|
||||
)
|
||||
|
||||
|
||||
@@ -123,8 +123,8 @@ class TestScriptedResolver(TestBase):
|
||||
|
||||
# Make sure these all got locations:
|
||||
for i in range(0, len(right)):
|
||||
self.assertTrue(
|
||||
right[i].GetNumLocations() >= 1, "Breakpoint %d has no locations." % (i)
|
||||
self.assertGreaterEqual(
|
||||
right[i].GetNumLocations(), 1, "Breakpoint %d has no locations." % (i)
|
||||
)
|
||||
|
||||
# Now some ones that won't take:
|
||||
@@ -229,7 +229,7 @@ class TestScriptedResolver(TestBase):
|
||||
bkpt = target.BreakpointCreateFromScript(
|
||||
"resolver.Resolver", extra_args, module_list, file_list
|
||||
)
|
||||
self.assertTrue(bkpt.GetNumLocations() > 0, "Resolver got no locations.")
|
||||
self.assertGreater(bkpt.GetNumLocations(), 0, "Resolver got no locations.")
|
||||
self.expect(
|
||||
"script print(resolver.Resolver.got_files)",
|
||||
substrs=["2"],
|
||||
@@ -240,8 +240,8 @@ class TestScriptedResolver(TestBase):
|
||||
bkpt = target.BreakpointCreateFromScript(
|
||||
"resolver.ResolverModuleDepth", extra_args, module_list, file_list
|
||||
)
|
||||
self.assertTrue(
|
||||
bkpt.GetNumLocations() > 0, "ResolverModuleDepth got no locations."
|
||||
self.assertGreater(
|
||||
bkpt.GetNumLocations(), 0, "ResolverModuleDepth got no locations."
|
||||
)
|
||||
self.expect(
|
||||
"script print(resolver.Resolver.got_files)",
|
||||
@@ -253,7 +253,9 @@ class TestScriptedResolver(TestBase):
|
||||
bkpt = target.BreakpointCreateFromScript(
|
||||
"resolver.ResolverCUDepth", extra_args, module_list, file_list
|
||||
)
|
||||
self.assertTrue(bkpt.GetNumLocations() > 0, "ResolverCUDepth got no locations.")
|
||||
self.assertGreater(
|
||||
bkpt.GetNumLocations(), 0, "ResolverCUDepth got no locations."
|
||||
)
|
||||
self.expect(
|
||||
"script print(resolver.Resolver.got_files)",
|
||||
substrs=["1"],
|
||||
@@ -264,8 +266,8 @@ class TestScriptedResolver(TestBase):
|
||||
bkpt = target.BreakpointCreateFromScript(
|
||||
"resolver.ResolverBadDepth", extra_args, module_list, file_list
|
||||
)
|
||||
self.assertTrue(
|
||||
bkpt.GetNumLocations() > 0, "ResolverBadDepth got no locations."
|
||||
self.assertGreater(
|
||||
bkpt.GetNumLocations(), 0, "ResolverBadDepth got no locations."
|
||||
)
|
||||
self.expect(
|
||||
"script print(resolver.Resolver.got_files)",
|
||||
@@ -277,8 +279,8 @@ class TestScriptedResolver(TestBase):
|
||||
bkpt = target.BreakpointCreateFromScript(
|
||||
"resolver.ResolverFuncDepth", extra_args, module_list, file_list
|
||||
)
|
||||
self.assertTrue(
|
||||
bkpt.GetNumLocations() > 0, "ResolverFuncDepth got no locations."
|
||||
self.assertGreater(
|
||||
bkpt.GetNumLocations(), 0, "ResolverFuncDepth got no locations."
|
||||
)
|
||||
self.expect(
|
||||
"script print(resolver.Resolver.got_files)",
|
||||
|
||||
@@ -60,7 +60,7 @@ class BreakpointSerialization(TestBase):
|
||||
exe_module.IsValid(), "Failed to find the executable module in target"
|
||||
)
|
||||
sym_ctx_list = exe_module.FindFunctions("main")
|
||||
self.assertTrue(sym_ctx_list.GetSize() == 1, "Unable to find function 'main'")
|
||||
self.assertEqual(sym_ctx_list.GetSize(), 1, "Unable to find function 'main'")
|
||||
sym_ctx = sym_ctx_list.GetContextAtIndex(0)
|
||||
self.assertTrue(
|
||||
sym_ctx.IsValid(), "SBSymbolContext representing function 'main' is invalid"
|
||||
|
||||
@@ -87,7 +87,7 @@ class StepOverBreakpointsTestCase(TestBase):
|
||||
self.thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), self.line4
|
||||
)
|
||||
# breakpoint_2 and _3 should not affect step count
|
||||
self.assertTrue(step_count >= steps_expected)
|
||||
self.assertGreaterEqual(step_count, steps_expected)
|
||||
break
|
||||
|
||||
# Run the process until termination
|
||||
|
||||
@@ -315,11 +315,13 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
||||
if self.TraceOn():
|
||||
print(str_cast)
|
||||
|
||||
self.assertTrue(str_cast.find("A") != -1, "could not find A in output")
|
||||
self.assertTrue(str_cast.find("B") != -1, "could not find B in output")
|
||||
self.assertTrue(str_cast.find("C") != -1, "could not find C in output")
|
||||
self.assertTrue(str_cast.find("D") != -1, "could not find D in output")
|
||||
self.assertTrue(str_cast.find("4 = '\\0'") != -1, "could not find item 4 == 0")
|
||||
self.assertNotEqual(str_cast.find("A"), -1, "could not find A in output")
|
||||
self.assertNotEqual(str_cast.find("B"), -1, "could not find B in output")
|
||||
self.assertNotEqual(str_cast.find("C"), -1, "could not find C in output")
|
||||
self.assertNotEqual(str_cast.find("D"), -1, "could not find D in output")
|
||||
self.assertNotEqual(
|
||||
str_cast.find("4 = '\\0'"), -1, "could not find item 4 == 0"
|
||||
)
|
||||
|
||||
self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().StepOver()
|
||||
|
||||
@@ -331,8 +333,10 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
||||
# we detect that all the values of the child objects have changed - but the counter-generated item
|
||||
# is still fixed at 0 because it is cached - this would fail if update(self): in ftsp returned False
|
||||
# or if synthetic children were not being preserved
|
||||
self.assertTrue(str_cast.find("Q") != -1, "could not find Q in output")
|
||||
self.assertTrue(str_cast.find("X") != -1, "could not find X in output")
|
||||
self.assertTrue(str_cast.find("T") != -1, "could not find T in output")
|
||||
self.assertTrue(str_cast.find("F") != -1, "could not find F in output")
|
||||
self.assertTrue(str_cast.find("4 = '\\0'") != -1, "could not find item 4 == 0")
|
||||
self.assertNotEqual(str_cast.find("Q"), -1, "could not find Q in output")
|
||||
self.assertNotEqual(str_cast.find("X"), -1, "could not find X in output")
|
||||
self.assertNotEqual(str_cast.find("T"), -1, "could not find T in output")
|
||||
self.assertNotEqual(str_cast.find("F"), -1, "could not find F in output")
|
||||
self.assertNotEqual(
|
||||
str_cast.find("4 = '\\0'"), -1, "could not find item 4 == 0"
|
||||
)
|
||||
|
||||
@@ -83,17 +83,17 @@ class LibcxxStringDataFormatterTestCase(TestBase):
|
||||
uncappedSummaryStream = lldb.SBStream()
|
||||
TheVeryLongOne.GetSummary(uncappedSummaryStream, summaryOptions)
|
||||
uncappedSummary = uncappedSummaryStream.GetData()
|
||||
self.assertTrue(
|
||||
uncappedSummary.find("someText") > 0,
|
||||
self.assertGreater(
|
||||
uncappedSummary.find("someText"),
|
||||
0,
|
||||
"uncappedSummary does not include the full string",
|
||||
)
|
||||
summaryOptions.SetCapping(lldb.eTypeSummaryCapped)
|
||||
cappedSummaryStream = lldb.SBStream()
|
||||
TheVeryLongOne.GetSummary(cappedSummaryStream, summaryOptions)
|
||||
cappedSummary = cappedSummaryStream.GetData()
|
||||
self.assertTrue(
|
||||
cappedSummary.find("someText") <= 0,
|
||||
"cappedSummary includes the full string",
|
||||
self.assertLessEqual(
|
||||
cappedSummary.find("someText"), 0, "cappedSummary includes the full string"
|
||||
)
|
||||
|
||||
self.expect_expr(
|
||||
|
||||
@@ -105,17 +105,17 @@ class LibcxxStringViewDataFormatterTestCase(TestBase):
|
||||
uncappedSummaryStream = lldb.SBStream()
|
||||
TheVeryLongOne.GetSummary(uncappedSummaryStream, summaryOptions)
|
||||
uncappedSummary = uncappedSummaryStream.GetData()
|
||||
self.assertTrue(
|
||||
uncappedSummary.find("someText") > 0,
|
||||
self.assertGreater(
|
||||
uncappedSummary.find("someText"),
|
||||
0,
|
||||
"uncappedSummary does not include the full string",
|
||||
)
|
||||
summaryOptions.SetCapping(lldb.eTypeSummaryCapped)
|
||||
cappedSummaryStream = lldb.SBStream()
|
||||
TheVeryLongOne.GetSummary(cappedSummaryStream, summaryOptions)
|
||||
cappedSummary = cappedSummaryStream.GetData()
|
||||
self.assertTrue(
|
||||
cappedSummary.find("someText") <= 0,
|
||||
"cappedSummary includes the full string",
|
||||
self.assertLessEqual(
|
||||
cappedSummary.find("someText"), 0, "cappedSummary includes the full string"
|
||||
)
|
||||
|
||||
self.expect_expr(
|
||||
|
||||
@@ -74,8 +74,8 @@ class TestMSP430MSPDebug(GDBRemoteTestBase):
|
||||
# Test if the breakpoint address is resolved correctly
|
||||
self.assertEqual(bp.GetNumLocations(), 1, "Only one location")
|
||||
bp_loc = bp.GetLocationAtIndex(0)
|
||||
self.assertTrue(
|
||||
bp_loc.GetAddress().GetLoadAddress(target) == 0x510, "Address of main"
|
||||
self.assertEqual(
|
||||
bp_loc.GetAddress().GetLoadAddress(target), 0x510, "Address of main"
|
||||
)
|
||||
|
||||
# Test if the process stops at the breakpoint
|
||||
@@ -93,8 +93,9 @@ class TestMSP430MSPDebug(GDBRemoteTestBase):
|
||||
|
||||
# Test if thread can step a single instruction
|
||||
thread.StepInstruction(False)
|
||||
self.assertTrue(
|
||||
thread.GetFrameAtIndex(0).GetPCAddress().GetLoadAddress(target) == 0x516,
|
||||
self.assertEqual(
|
||||
thread.GetFrameAtIndex(0).GetPCAddress().GetLoadAddress(target),
|
||||
0x516,
|
||||
"Address of the next instruction",
|
||||
)
|
||||
|
||||
@@ -122,6 +123,6 @@ class TestMSP430MSPDebug(GDBRemoteTestBase):
|
||||
self.assertEqual(reg.GetValueAsUnsigned(), reg_val_dict[reg.GetName()])
|
||||
|
||||
# Check if backtracing works:
|
||||
self.assertTrue(len(thread.frames) >= 3)
|
||||
self.assertGreaterEqual(len(thread.frames), 3)
|
||||
crt0_addr = thread.GetFrameAtIndex(2).GetPCAddress().GetLoadAddress(target)
|
||||
self.assertEqual(crt0_addr, 0x50A)
|
||||
|
||||
@@ -20,8 +20,9 @@ class MultipleDebuggersCommandsTestCase(TestBase):
|
||||
|
||||
retobj = lldb.SBCommandReturnObject()
|
||||
interpreter_1.HandleCommand("apropos env", retobj)
|
||||
self.assertTrue(
|
||||
magic_text in str(retobj),
|
||||
self.assertIn(
|
||||
magic_text,
|
||||
str(retobj),
|
||||
"[interpreter_1]: the output does not contain the correct words",
|
||||
)
|
||||
|
||||
@@ -37,8 +38,9 @@ class MultipleDebuggersCommandsTestCase(TestBase):
|
||||
|
||||
retobj = lldb.SBCommandReturnObject()
|
||||
interpreter_2.HandleCommand("apropos env", retobj)
|
||||
self.assertTrue(
|
||||
magic_text in str(retobj),
|
||||
self.assertIn(
|
||||
magic_text,
|
||||
str(retobj),
|
||||
"[interpreter_2]: the output does not contain the correct words",
|
||||
)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class ProcessSaveCoreMinidumpTestCase(TestBase):
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
self.assertTrue(process.GetProcessInfo().IsValid())
|
||||
self.assertEqual(process.GetProcessInfo().GetProcessID(), expected_pid)
|
||||
self.assertTrue(target.GetTriple().find("linux") != -1)
|
||||
self.assertNotEqual(target.GetTriple().find("linux"), -1)
|
||||
self.assertTrue(target.GetNumModules(), len(expected_modules))
|
||||
self.assertEqual(process.GetNumThreads(), len(expected_threads))
|
||||
|
||||
@@ -40,7 +40,7 @@ class ProcessSaveCoreMinidumpTestCase(TestBase):
|
||||
thread = process.GetThreadAtIndex(thread_idx)
|
||||
self.assertTrue(thread.IsValid())
|
||||
thread_id = thread.GetThreadID()
|
||||
self.assertTrue(thread_id in expected_threads)
|
||||
self.assertIn(thread_id, expected_threads)
|
||||
self.dbg.DeleteTarget(target)
|
||||
|
||||
@skipUnlessArch("x86_64")
|
||||
|
||||
@@ -261,8 +261,9 @@ class ReturnValueTestCase(TestBase):
|
||||
|
||||
# Set the breakpoint, run to it, finish out.
|
||||
bkpt = self.target.BreakpointCreateByName(func_name)
|
||||
self.assertTrue(
|
||||
bkpt.GetNumResolvedLocations() > 0,
|
||||
self.assertGreater(
|
||||
bkpt.GetNumResolvedLocations(),
|
||||
0,
|
||||
"Got wrong number of locations for {0}".format(func_name),
|
||||
)
|
||||
|
||||
|
||||
@@ -201,9 +201,7 @@ class ScriptedProcesTestCase(TestBase):
|
||||
|
||||
py_impl = process_0.GetScriptedImplementation()
|
||||
self.assertTrue(py_impl)
|
||||
self.assertTrue(
|
||||
isinstance(py_impl, dummy_scripted_process.DummyScriptedProcess)
|
||||
)
|
||||
self.assertIsInstance(py_impl, dummy_scripted_process.DummyScriptedProcess)
|
||||
self.assertFalse(hasattr(py_impl, "my_super_secret_member"))
|
||||
py_impl.my_super_secret_member = 42
|
||||
self.assertTrue(hasattr(py_impl, "my_super_secret_member"))
|
||||
|
||||
@@ -75,8 +75,8 @@ class SendSignalTestCase(TestBase):
|
||||
self.assertEqual(len(threads), 1, "One thread stopped for a signal.")
|
||||
thread = threads[0]
|
||||
|
||||
self.assertTrue(
|
||||
thread.GetStopReasonDataCount() >= 1, "There was data in the event."
|
||||
self.assertGreaterEqual(
|
||||
thread.GetStopReasonDataCount(), 1, "There was data in the event."
|
||||
)
|
||||
self.assertEqual(
|
||||
thread.GetStopReasonDataAtIndex(0),
|
||||
|
||||
@@ -33,8 +33,8 @@ class HandleAbortTestCase(TestBase):
|
||||
self.assertTrue(
|
||||
thread and thread.IsValid(), "Thread should be stopped due to a signal"
|
||||
)
|
||||
self.assertTrue(
|
||||
thread.GetStopReasonDataCount() >= 1, "There should be data in the event."
|
||||
self.assertGreaterEqual(
|
||||
thread.GetStopReasonDataCount(), 1, "There should be data in the event."
|
||||
)
|
||||
self.assertEqual(
|
||||
thread.GetStopReasonDataAtIndex(0),
|
||||
|
||||
@@ -29,8 +29,8 @@ class HandleSegvTestCase(TestBase):
|
||||
self.assertTrue(
|
||||
thread and thread.IsValid(), "Thread should be stopped due to a signal"
|
||||
)
|
||||
self.assertTrue(
|
||||
thread.GetStopReasonDataCount() >= 1, "There was data in the event."
|
||||
self.assertGreaterEqual(
|
||||
thread.GetStopReasonDataCount(), 1, "There was data in the event."
|
||||
)
|
||||
self.assertEqual(
|
||||
thread.GetStopReasonDataAtIndex(0), signo, "The stop signal was SIGSEGV"
|
||||
|
||||
@@ -88,8 +88,8 @@ class RaiseTestCase(TestBase):
|
||||
self.assertState(process.GetState(), lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonSignal)
|
||||
self.assertTrue(thread.IsValid(), "Thread should be stopped due to a signal")
|
||||
self.assertTrue(
|
||||
thread.GetStopReasonDataCount() >= 1, "There was data in the event."
|
||||
self.assertGreaterEqual(
|
||||
thread.GetStopReasonDataCount(), 1, "There was data in the event."
|
||||
)
|
||||
self.assertEqual(
|
||||
thread.GetStopReasonDataAtIndex(0), signo, "The stop signal was %s" % signal
|
||||
@@ -137,8 +137,8 @@ class RaiseTestCase(TestBase):
|
||||
self.assertState(process.GetState(), lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonSignal)
|
||||
self.assertTrue(thread.IsValid(), "Thread should be stopped due to a signal")
|
||||
self.assertTrue(
|
||||
thread.GetStopReasonDataCount() >= 1, "There was data in the event."
|
||||
self.assertGreaterEqual(
|
||||
thread.GetStopReasonDataCount(), 1, "There was data in the event."
|
||||
)
|
||||
self.assertEqual(
|
||||
thread.GetStopReasonDataAtIndex(0),
|
||||
|
||||
@@ -83,8 +83,9 @@ class StepAvoidsNoDebugTestCase(TestBase):
|
||||
|
||||
def hit_correct_function(self, pattern):
|
||||
name = self.thread.frames[0].GetFunctionName()
|
||||
self.assertTrue(
|
||||
pattern in name,
|
||||
self.assertIn(
|
||||
pattern,
|
||||
name,
|
||||
"Got to '%s' not the expected function '%s'." % (name, pattern),
|
||||
)
|
||||
|
||||
|
||||
@@ -11,8 +11,9 @@ from lldbsuite.test import lldbutil
|
||||
class StepAvoidsRegexTestCase(TestBase):
|
||||
def hit_correct_function(self, pattern):
|
||||
name = self.thread.frames[0].GetFunctionName()
|
||||
self.assertTrue(
|
||||
pattern in name,
|
||||
self.assertIn(
|
||||
pattern,
|
||||
name,
|
||||
"Got to '%s' not the expected function '%s'." % (name, pattern),
|
||||
)
|
||||
|
||||
|
||||
@@ -85,8 +85,9 @@ class ModuleLoadedNotifysTestCase(TestBase):
|
||||
# when reading dyld from the expanded shared cache.
|
||||
exe_basename = lldb.SBFileSpec(exe).basename
|
||||
if module.file.basename not in ["dyld", exe_basename]:
|
||||
self.assertTrue(
|
||||
module not in already_loaded_modules,
|
||||
self.assertNotIn(
|
||||
module,
|
||||
already_loaded_modules,
|
||||
"{} is already loaded".format(module),
|
||||
)
|
||||
already_loaded_modules.append(module)
|
||||
|
||||
@@ -73,8 +73,9 @@ class BreakpointAfterJoinTestCase(TestBase):
|
||||
num_threads = process.GetNumThreads()
|
||||
|
||||
# Make sure we see at least six threads
|
||||
self.assertTrue(
|
||||
num_threads >= 6,
|
||||
self.assertGreaterEqual(
|
||||
num_threads,
|
||||
6,
|
||||
"Number of expected threads and actual threads do not match.",
|
||||
)
|
||||
|
||||
|
||||
@@ -137,12 +137,14 @@ class CreateDuringStepTestCase(TestBase):
|
||||
current_line = frame.GetLineEntry().GetLine()
|
||||
|
||||
# Make sure we're still where we thought we were
|
||||
self.assertTrue(
|
||||
current_line >= self.breakpoint,
|
||||
self.assertGreaterEqual(
|
||||
current_line,
|
||||
self.breakpoint,
|
||||
"Stepped to unexpected line, " + str(current_line),
|
||||
)
|
||||
self.assertTrue(
|
||||
current_line <= self.continuepoint,
|
||||
self.assertLessEqual(
|
||||
current_line,
|
||||
self.continuepoint,
|
||||
"Stepped to unexpected line, " + str(current_line),
|
||||
)
|
||||
|
||||
|
||||
@@ -49,8 +49,9 @@ class ExitDuringBreakpointTestCase(TestBase):
|
||||
num_threads = process.GetNumThreads()
|
||||
|
||||
# Make sure we see at least five threads
|
||||
self.assertTrue(
|
||||
num_threads >= 5,
|
||||
self.assertGreaterEqual(
|
||||
num_threads,
|
||||
5,
|
||||
"Number of expected threads and actual threads do not match.",
|
||||
)
|
||||
|
||||
|
||||
@@ -60,8 +60,9 @@ class MultipleBreakpointTestCase(TestBase):
|
||||
num_threads = process.GetNumThreads()
|
||||
|
||||
# Make sure we see all three threads
|
||||
self.assertTrue(
|
||||
num_threads >= 3,
|
||||
self.assertGreaterEqual(
|
||||
num_threads,
|
||||
3,
|
||||
"Number of expected threads and actual threads do not match.",
|
||||
)
|
||||
|
||||
|
||||
@@ -63,8 +63,9 @@ class NumberOfThreadsTestCase(TestBase):
|
||||
|
||||
# Using std::thread may involve extra threads, so we assert that there are
|
||||
# at least 4 rather than exactly 4.
|
||||
self.assertTrue(
|
||||
num_threads >= 13,
|
||||
self.assertGreaterEqual(
|
||||
num_threads,
|
||||
13,
|
||||
"Number of expected threads and actual threads do not match.",
|
||||
)
|
||||
|
||||
@@ -98,8 +99,9 @@ class NumberOfThreadsTestCase(TestBase):
|
||||
|
||||
# Using std::thread may involve extra threads, so we assert that there are
|
||||
# at least 10 thread3's rather than exactly 10.
|
||||
self.assertTrue(
|
||||
num_threads >= 10,
|
||||
self.assertGreaterEqual(
|
||||
num_threads,
|
||||
10,
|
||||
"Number of expected threads and actual threads do not match.",
|
||||
)
|
||||
|
||||
|
||||
@@ -121,8 +121,8 @@ class TestThreadPlanCommands(TestBase):
|
||||
call_me_bkpt = target.BreakpointCreateBySourceRegex(
|
||||
"Set another here", self.main_source_file
|
||||
)
|
||||
self.assertTrue(
|
||||
call_me_bkpt.GetNumLocations() > 0, "Set the breakpoint successfully"
|
||||
self.assertGreater(
|
||||
call_me_bkpt.GetNumLocations(), 0, "Set the breakpoint successfully"
|
||||
)
|
||||
thread.StepUsingScriptedThreadPlan("wrap_step_over.WrapStepOver")
|
||||
threads = lldbutil.get_threads_stopped_at_breakpoint(process, call_me_bkpt)
|
||||
@@ -170,14 +170,14 @@ class TestThreadPlanCommands(TestBase):
|
||||
second_step_bkpt = target.BreakpointCreateBySourceRegex(
|
||||
"Run here to step over again", self.main_source_file
|
||||
)
|
||||
self.assertTrue(
|
||||
second_step_bkpt.GetNumLocations() > 0, "Set the breakpoint successfully"
|
||||
self.assertGreater(
|
||||
second_step_bkpt.GetNumLocations(), 0, "Set the breakpoint successfully"
|
||||
)
|
||||
final_bkpt = target.BreakpointCreateBySourceRegex(
|
||||
"Make sure we get here on last continue", self.main_source_file
|
||||
)
|
||||
self.assertTrue(
|
||||
final_bkpt.GetNumLocations() > 0, "Set the breakpoint successfully"
|
||||
self.assertGreater(
|
||||
final_bkpt.GetNumLocations(), 0, "Set the breakpoint successfully"
|
||||
)
|
||||
|
||||
threads = lldbutil.continue_to_breakpoint(process, second_step_bkpt)
|
||||
|
||||
@@ -102,7 +102,7 @@ class TsanBasicTestCase(TestBase):
|
||||
backtraces = thread.GetStopReasonExtendedBacktraces(
|
||||
lldb.eInstrumentationRuntimeTypeThreadSanitizer
|
||||
)
|
||||
self.assertTrue(backtraces.GetSize() >= 2)
|
||||
self.assertGreaterEqual(backtraces.GetSize(), 2)
|
||||
|
||||
# First backtrace is a memory operation
|
||||
thread = backtraces.GetThreadAtIndex(0)
|
||||
|
||||
@@ -84,7 +84,7 @@ class TsanMultipleTestCase(TestBase):
|
||||
lldb.eInstrumentationRuntimeTypeThreadSanitizer
|
||||
)
|
||||
)
|
||||
self.assertTrue(backtraces.GetSize() >= 1)
|
||||
self.assertGreaterEqual(backtraces.GetSize(), 1)
|
||||
|
||||
self.runCmd("continue")
|
||||
|
||||
|
||||
@@ -49,7 +49,9 @@ class AArch64UnwindPAC(TestBase):
|
||||
"_start",
|
||||
]
|
||||
|
||||
self.assertTrue(thread.GetNumFrames() >= (len(backtrace) + len(libc_backtrace)))
|
||||
self.assertGreaterEqual(
|
||||
thread.GetNumFrames(), len(backtrace) + len(libc_backtrace)
|
||||
)
|
||||
|
||||
# Strictly check frames that are in the test program's source.
|
||||
for frame_idx, frame in enumerate(thread.frames[: len(backtrace)]):
|
||||
|
||||
@@ -148,8 +148,9 @@ class RegisterVariableTestCase(TestBase):
|
||||
)
|
||||
|
||||
# Validate that we verified at least one register variable
|
||||
self.assertTrue(
|
||||
register_variables_count > 0,
|
||||
self.assertGreater(
|
||||
register_variables_count,
|
||||
0,
|
||||
"expected to verify at least one variable in a register",
|
||||
)
|
||||
self.trace(
|
||||
|
||||
@@ -82,7 +82,7 @@ class TestCStepping(TestBase):
|
||||
|
||||
# Check that the stop ID increases:
|
||||
new_stop_id = process.GetStopID()
|
||||
self.assertTrue(new_stop_id > old_stop_id, "Stop ID increases monotonically.")
|
||||
self.assertGreater(new_stop_id, old_stop_id, "Stop ID increases monotonically.")
|
||||
|
||||
thread = threads[0]
|
||||
|
||||
@@ -141,8 +141,9 @@ class TestCStepping(TestBase):
|
||||
"Expression calling doesn't change stop ID",
|
||||
)
|
||||
|
||||
self.assertTrue(
|
||||
stop_id_after_including_expressions > stop_id_before_including_expressions,
|
||||
self.assertGreater(
|
||||
stop_id_after_including_expressions,
|
||||
stop_id_before_including_expressions,
|
||||
"Stop ID including expressions increments over expression call.",
|
||||
)
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ class DynamicValueTestCase(TestBase):
|
||||
anotherA_dynamic_typename = anotherA_dynamic.GetTypeName()
|
||||
self.assertNotEqual(anotherA_dynamic_typename.find("B"), -1)
|
||||
|
||||
self.assertTrue(anotherA_dynamic_addr < anotherA_static_addr)
|
||||
self.assertLess(anotherA_dynamic_addr, anotherA_static_addr)
|
||||
|
||||
anotherA_m_b_value_dynamic = anotherA_dynamic.GetChildMemberWithName(
|
||||
"m_b_value", True
|
||||
@@ -204,7 +204,7 @@ class DynamicValueTestCase(TestBase):
|
||||
|
||||
# And that the static address is greater than the dynamic one
|
||||
|
||||
self.assertTrue(this_static_loc > this_dynamic_loc)
|
||||
self.assertGreater(this_static_loc, this_dynamic_loc)
|
||||
|
||||
# Now read m_b_value which is only in the dynamic value:
|
||||
|
||||
@@ -252,4 +252,4 @@ class DynamicValueTestCase(TestBase):
|
||||
contained_b_addr = int(contained_b.GetValue(), 16)
|
||||
contained_b_static_addr = int(contained_b_static.GetValue(), 16)
|
||||
|
||||
self.assertTrue(contained_b_addr < contained_b_static_addr)
|
||||
self.assertLess(contained_b_addr, contained_b_static_addr)
|
||||
|
||||
@@ -32,8 +32,9 @@ class NamespaceBreakpointTestCase(TestBase):
|
||||
)
|
||||
for bp_loc in bp:
|
||||
name = bp_loc.GetAddress().GetFunction().GetName()
|
||||
self.assertTrue(
|
||||
name in names,
|
||||
self.assertIn(
|
||||
name,
|
||||
names,
|
||||
"make sure breakpoint locations are correct for 'func' with eFunctionNameTypeAuto",
|
||||
)
|
||||
|
||||
@@ -61,8 +62,9 @@ class NamespaceBreakpointTestCase(TestBase):
|
||||
)
|
||||
for bp_loc in bp:
|
||||
name = bp_loc.GetAddress().GetFunction().GetName()
|
||||
self.assertTrue(
|
||||
name in names,
|
||||
self.assertIn(
|
||||
name,
|
||||
names,
|
||||
"make sure breakpoint locations are correct for 'func' with eFunctionNameTypeFull",
|
||||
)
|
||||
|
||||
@@ -88,8 +90,9 @@ class NamespaceBreakpointTestCase(TestBase):
|
||||
)
|
||||
for bp_loc in bp:
|
||||
name = bp_loc.GetAddress().GetFunction().GetName()
|
||||
self.assertTrue(
|
||||
name in names,
|
||||
self.assertIn(
|
||||
name,
|
||||
names,
|
||||
"make sure breakpoint locations are correct for 'A::func' with eFunctionNameTypeFull",
|
||||
)
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class STLTestCase(TestBase):
|
||||
self.DebugSBType(map_type)
|
||||
self.assertTrue(map_type, VALID_TYPE)
|
||||
num_template_args = map_type.GetNumberOfTemplateArguments()
|
||||
self.assertTrue(num_template_args > 0)
|
||||
self.assertGreater(num_template_args, 0)
|
||||
|
||||
# We expect the template arguments to contain at least 'string' and
|
||||
# 'int'.
|
||||
|
||||
@@ -34,9 +34,7 @@ class FoundationDisassembleTestCase(TestBase):
|
||||
foundation_framework = module.file.fullpath
|
||||
break
|
||||
|
||||
self.assertTrue(
|
||||
foundation_framework is not None, "Foundation.framework path located"
|
||||
)
|
||||
self.assertIsNotNone(foundation_framework, "Foundation.framework path located")
|
||||
self.runCmd("image dump symtab '%s'" % foundation_framework)
|
||||
raw_output = self.res.GetOutput()
|
||||
# Now, grab every 'Code' symbol and feed it into the command:
|
||||
|
||||
@@ -35,7 +35,7 @@ class TestObjCClassMethod(TestBase):
|
||||
thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
|
||||
|
||||
# Make sure we stopped at the first breakpoint.
|
||||
self.assertTrue(len(thread_list) != 0, "No thread stopped at our breakpoint.")
|
||||
self.assertNotEqual(len(thread_list), 0, "No thread stopped at our breakpoint.")
|
||||
self.assertEqual(
|
||||
len(thread_list), 1, "More than one thread stopped at our breakpoint."
|
||||
)
|
||||
|
||||
@@ -38,7 +38,7 @@ class TestObjCStructArgument(TestBase):
|
||||
thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
|
||||
|
||||
# Make sure we stopped at the first breakpoint.
|
||||
self.assertTrue(len(thread_list) != 0, "No thread stopped at our breakpoint.")
|
||||
self.assertNotEqual(len(thread_list), 0, "No thread stopped at our breakpoint.")
|
||||
self.assertEqual(
|
||||
len(thread_list), 1, "More than one thread stopped at our breakpoint."
|
||||
)
|
||||
|
||||
@@ -36,7 +36,7 @@ class TestObjCClassMethod(TestBase):
|
||||
thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
|
||||
|
||||
# Make sure we stopped at the first breakpoint.
|
||||
self.assertTrue(len(thread_list) != 0, "No thread stopped at our breakpoint.")
|
||||
self.assertNotEqual(len(thread_list), 0, "No thread stopped at our breakpoint.")
|
||||
self.assertEqual(
|
||||
len(thread_list), 1, "More than one thread stopped at our breakpoint."
|
||||
)
|
||||
|
||||
@@ -36,7 +36,7 @@ class TestObjCSuperMethod(TestBase):
|
||||
thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
|
||||
|
||||
# Make sure we stopped at the first breakpoint.
|
||||
self.assertTrue(len(thread_list) != 0, "No thread stopped at our breakpoint.")
|
||||
self.assertNotEqual(len(thread_list), 0, "No thread stopped at our breakpoint.")
|
||||
self.assertEqual(
|
||||
len(thread_list), 1, "More than one thread stopped at our breakpoint."
|
||||
)
|
||||
|
||||
@@ -49,11 +49,12 @@ class Rdar12408181TestCase(TestBase):
|
||||
):
|
||||
window = self.frame().FindVariable("window")
|
||||
window_dynamic = window.GetDynamicValue(lldb.eDynamicCanRunTarget)
|
||||
self.assertTrue(
|
||||
window.GetNumChildren() > 1, "NSWindow (static) only has 1 child!"
|
||||
self.assertGreater(
|
||||
window.GetNumChildren(), 1, "NSWindow (static) only has 1 child!"
|
||||
)
|
||||
self.assertTrue(
|
||||
window_dynamic.GetNumChildren() > 1,
|
||||
self.assertGreater(
|
||||
window_dynamic.GetNumChildren(),
|
||||
1,
|
||||
"NSWindow (dynamic) only has 1 child!",
|
||||
)
|
||||
self.assertTrue(
|
||||
|
||||
@@ -35,7 +35,7 @@ class TestObjCBuiltinTypes(TestBase):
|
||||
thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
|
||||
|
||||
# Make sure we stopped at the first breakpoint.
|
||||
self.assertTrue(len(thread_list) != 0, "No thread stopped at our breakpoint.")
|
||||
self.assertNotEqual(len(thread_list), 0, "No thread stopped at our breakpoint.")
|
||||
self.assertEqual(
|
||||
len(thread_list), 1, "More than one thread stopped at our breakpoint."
|
||||
)
|
||||
|
||||
@@ -84,6 +84,4 @@ class AArch64LinuxTaggedMemoryReadTestCase(TestBase):
|
||||
# First check we actually got something.
|
||||
self.assertRegex(out, "data found at location: 0x[0-9A-Fa-f]+")
|
||||
# Then that the location found does not display the tag bits.
|
||||
self.assertNotRegexpMatches(
|
||||
out, "data found at location: 0x(34|56)[0-9A-Fa-f]+"
|
||||
)
|
||||
self.assertNotRegex(out, "data found at location: 0x(34|56)[0-9A-Fa-f]+")
|
||||
|
||||
@@ -32,8 +32,8 @@ class UnwindSignalTestCase(TestBase):
|
||||
self.assertTrue(
|
||||
thread and thread.IsValid(), "Thread should be stopped due to a signal"
|
||||
)
|
||||
self.assertTrue(
|
||||
thread.GetStopReasonDataCount() >= 1, "There should be data in the event."
|
||||
self.assertGreaterEqual(
|
||||
thread.GetStopReasonDataCount(), 1, "There should be data in the event."
|
||||
)
|
||||
self.assertEqual(
|
||||
thread.GetStopReasonDataAtIndex(0),
|
||||
|
||||
@@ -186,4 +186,4 @@ class TestLuaAPI(TestBase):
|
||||
print(out)
|
||||
print(err, file=sys.stderr)
|
||||
|
||||
self.assertTrue(exitCode == 0, "Lua test '%s' failure." % lua_test)
|
||||
self.assertEqual(exitCode, 0, "Lua test '%s' failure." % lua_test)
|
||||
|
||||
@@ -64,8 +64,8 @@ class FunctionStartsTestCase(TestBase):
|
||||
self.assertSuccess(error, "Didn't attach successfully to %d" % (popen.pid))
|
||||
|
||||
bkpt = target.BreakpointCreateByName("dont_strip_me", exe)
|
||||
self.assertTrue(
|
||||
bkpt.GetNumLocations() > 0, "Didn't set the dont_strip_me bkpt."
|
||||
self.assertGreater(
|
||||
bkpt.GetNumLocations(), 0, "Didn't set the dont_strip_me bkpt."
|
||||
)
|
||||
|
||||
threads = lldbutil.continue_to_breakpoint(process, bkpt)
|
||||
@@ -74,6 +74,6 @@ class FunctionStartsTestCase(TestBase):
|
||||
# Our caller frame should have been stripped. Make sure we made a synthetic symbol
|
||||
# for it:
|
||||
thread = threads[0]
|
||||
self.assertTrue(thread.num_frames > 1, "Couldn't backtrace.")
|
||||
self.assertGreater(thread.num_frames, 1, "Couldn't backtrace.")
|
||||
name = thread.frame[1].GetFunctionName()
|
||||
self.assertTrue(name.startswith("___lldb_unnamed_symbol"))
|
||||
|
||||
@@ -41,8 +41,8 @@ class TestObjCRecognizer(TestBase):
|
||||
exception_bkpt = target.BreakpointCreateForException(
|
||||
lldb.eLanguageTypeObjC, False, True
|
||||
)
|
||||
self.assertTrue(
|
||||
exception_bkpt.GetNumLocations() > 0, "Got some exception locations"
|
||||
self.assertGreater(
|
||||
exception_bkpt.GetNumLocations(), 0, "Got some exception locations"
|
||||
)
|
||||
|
||||
threads = lldbutil.continue_to_breakpoint(process, exception_bkpt)
|
||||
|
||||
@@ -49,7 +49,7 @@ class TestDetachVrsProfile(TestBase):
|
||||
threads = lldbutil.continue_to_breakpoint(process, bkpt)
|
||||
self.assertEqual(len(threads), 1, "Hit our breakpoint again.")
|
||||
str = process.GetAsyncProfileData(1000)
|
||||
self.assertTrue(len(str) > 0, "Got some profile data")
|
||||
self.assertGreater(len(str), 0, "Got some profile data")
|
||||
|
||||
# Now make the profiling interval very long and try to detach.
|
||||
interp.HandleCommand(
|
||||
|
||||
@@ -35,8 +35,9 @@ class TestQueues(TestBase):
|
||||
self.main_source = "main.c"
|
||||
|
||||
def check_queue_for_valid_queue_id(self, queue):
|
||||
self.assertTrue(
|
||||
queue.GetQueueID() != 0,
|
||||
self.assertNotEqual(
|
||||
queue.GetQueueID(),
|
||||
0,
|
||||
"Check queue %s for valid QueueID (got 0x%x)"
|
||||
% (queue.GetName(), queue.GetQueueID()),
|
||||
)
|
||||
@@ -363,8 +364,8 @@ class TestQueues(TestBase):
|
||||
"Skipped because libBacktraceRecording.dylib was not loaded into the process."
|
||||
)
|
||||
|
||||
self.assertTrue(
|
||||
process.GetNumQueues() >= 4, "Found the correct number of queues."
|
||||
self.assertGreaterEqual(
|
||||
process.GetNumQueues(), 4, "Found the correct number of queues."
|
||||
)
|
||||
|
||||
queue_submittor_1 = lldb.SBQueue()
|
||||
@@ -456,8 +457,9 @@ class TestQueues(TestBase):
|
||||
"doing_the_work_2",
|
||||
"queue 2's pending item #0 should be doing_the_work_2",
|
||||
)
|
||||
self.assertTrue(
|
||||
queue_performer_2.GetPendingItemAtIndex(9999).IsValid() == False,
|
||||
self.assertEqual(
|
||||
queue_performer_2.GetPendingItemAtIndex(9999).IsValid(),
|
||||
False,
|
||||
"queue 2's pending item #9999 is invalid",
|
||||
)
|
||||
|
||||
|
||||
@@ -144,8 +144,8 @@ class UniversalTestCase(TestBase):
|
||||
|
||||
bkpt = target.BreakpointCreateBySourceRegex("sleep", lldb.SBFileSpec("main.c"))
|
||||
self.assertTrue(bkpt.IsValid(), "Valid breakpoint")
|
||||
self.assertTrue(
|
||||
bkpt.GetNumLocations() >= 1, "Our main breakpoint has locations."
|
||||
self.assertGreaterEqual(
|
||||
bkpt.GetNumLocations(), 1, "Our main breakpoint has locations."
|
||||
)
|
||||
|
||||
popen = self.spawnSubprocess(exe, ["keep_waiting"])
|
||||
@@ -167,4 +167,4 @@ class UniversalTestCase(TestBase):
|
||||
threads = lldbutil.continue_to_breakpoint(process, bkpt)
|
||||
self.assertEqual(len(threads), 1)
|
||||
thread = threads[0]
|
||||
self.assertTrue(thread.GetNumFrames() > 1, "We were able to backtrace.")
|
||||
self.assertGreater(thread.GetNumFrames(), 1, "We were able to backtrace.")
|
||||
|
||||
@@ -369,7 +369,7 @@ class EventAPITestCase(TestBase):
|
||||
# Now create a breakpoint on main.c by name 'c'.
|
||||
bkpt1 = target.BreakpointCreateByName("c", "a.out")
|
||||
self.trace("breakpoint:", bkpt1)
|
||||
self.assertTrue(bkpt1.GetNumLocations() == 1, VALID_BREAKPOINT)
|
||||
self.assertEqual(bkpt1.GetNumLocations(), 1, VALID_BREAKPOINT)
|
||||
|
||||
self.primary_listener = lldb.SBListener("my listener")
|
||||
self.shadow_listener = lldb.SBListener("shadow listener")
|
||||
@@ -431,11 +431,11 @@ class EventAPITestCase(TestBase):
|
||||
|
||||
main_spec = lldb.SBFileSpec("main.c")
|
||||
bkpt2 = target.BreakpointCreateBySourceRegex("b.2. returns %d", main_spec)
|
||||
self.assertTrue(bkpt2.GetNumLocations() > 0, "BP2 worked")
|
||||
self.assertGreater(bkpt2.GetNumLocations(), 0, "BP2 worked")
|
||||
bkpt2.SetAutoContinue(True)
|
||||
|
||||
bkpt3 = target.BreakpointCreateBySourceRegex("a.3. returns %d", main_spec)
|
||||
self.assertTrue(bkpt3.GetNumLocations() > 0, "BP3 worked")
|
||||
self.assertGreater(bkpt3.GetNumLocations(), 0, "BP3 worked")
|
||||
|
||||
state = lldb.eStateStopped
|
||||
restarted = False
|
||||
|
||||
@@ -682,25 +682,25 @@ class FileHandleTestCase(lldbtest.TestBase):
|
||||
def test_identity(self):
|
||||
f = io.StringIO()
|
||||
sbf = lldb.SBFile(f)
|
||||
self.assertTrue(f is sbf.GetFile())
|
||||
self.assertIs(f, sbf.GetFile())
|
||||
sbf.Close()
|
||||
self.assertTrue(f.closed)
|
||||
|
||||
f = io.StringIO()
|
||||
sbf = lldb.SBFile.Create(f, borrow=True)
|
||||
self.assertTrue(f is sbf.GetFile())
|
||||
self.assertIs(f, sbf.GetFile())
|
||||
sbf.Close()
|
||||
self.assertFalse(f.closed)
|
||||
|
||||
with open(self.out_filename, "w") as f:
|
||||
sbf = lldb.SBFile(f)
|
||||
self.assertTrue(f is sbf.GetFile())
|
||||
self.assertIs(f, sbf.GetFile())
|
||||
sbf.Close()
|
||||
self.assertTrue(f.closed)
|
||||
|
||||
with open(self.out_filename, "w") as f:
|
||||
sbf = lldb.SBFile.Create(f, borrow=True)
|
||||
self.assertFalse(f is sbf.GetFile())
|
||||
self.assertIsNot(f, sbf.GetFile())
|
||||
sbf.Write(b"foobar\n")
|
||||
self.assertEqual(f.fileno(), sbf.GetFile().fileno())
|
||||
sbf.Close()
|
||||
@@ -711,7 +711,7 @@ class FileHandleTestCase(lldbtest.TestBase):
|
||||
|
||||
with open(self.out_filename, "wb") as f:
|
||||
sbf = lldb.SBFile.Create(f, borrow=True, force_io_methods=True)
|
||||
self.assertTrue(f is sbf.GetFile())
|
||||
self.assertIs(f, sbf.GetFile())
|
||||
sbf.Write(b"foobar\n")
|
||||
self.assertEqual(f.fileno(), sbf.GetFile().fileno())
|
||||
sbf.Close()
|
||||
@@ -722,7 +722,7 @@ class FileHandleTestCase(lldbtest.TestBase):
|
||||
|
||||
with open(self.out_filename, "wb") as f:
|
||||
sbf = lldb.SBFile.Create(f, force_io_methods=True)
|
||||
self.assertTrue(f is sbf.GetFile())
|
||||
self.assertIs(f, sbf.GetFile())
|
||||
sbf.Write(b"foobar\n")
|
||||
self.assertEqual(f.fileno(), sbf.GetFile().fileno())
|
||||
sbf.Close()
|
||||
|
||||
@@ -25,7 +25,7 @@ class SBFrameFindValueTestCase(TestBase):
|
||||
breakpoint = target.BreakpointCreateBySourceRegex(
|
||||
"Set breakpoint here", lldb.SBFileSpec("main.cpp")
|
||||
)
|
||||
self.assertTrue(breakpoint.GetNumLocations() > 0, VALID_BREAKPOINT)
|
||||
self.assertGreater(breakpoint.GetNumLocations(), 0, VALID_BREAKPOINT)
|
||||
|
||||
# Launch the process, and do not stop at the entry point.
|
||||
process = target.LaunchSimple(None, None, self.get_process_working_directory())
|
||||
|
||||
@@ -19,6 +19,6 @@ class FormatAPITestCase(TestBase):
|
||||
self.assertTrue(error.Fail())
|
||||
|
||||
format = lldb.SBFormat("${frame.index}", error)
|
||||
self.assertIs(error.GetCString(), None)
|
||||
self.assertIsNone(error.GetCString())
|
||||
self.assertTrue(format)
|
||||
self.assertTrue(error.Success())
|
||||
|
||||
@@ -192,7 +192,7 @@ class SBFormattersAPITestCase(TestBase):
|
||||
)
|
||||
self.assertTrue(foo_var.IsValid(), "could not find foo")
|
||||
|
||||
self.assertFalse(foo_var.GetNumChildren() == 2, "still seeing synthetic value")
|
||||
self.assertNotEqual(foo_var.GetNumChildren(), 2, "still seeing synthetic value")
|
||||
|
||||
filter = lldb.SBTypeFilter(0)
|
||||
filter.AppendExpressionPath("A")
|
||||
@@ -457,9 +457,8 @@ class SBFormattersAPITestCase(TestBase):
|
||||
"frame variable e2", substrs=["I am an empty Empty2 {}"], matching=False
|
||||
)
|
||||
|
||||
self.assertTrue(
|
||||
self.dbg.GetCategory(lldb.eLanguageTypeObjC) is not None,
|
||||
"ObjC category is None",
|
||||
self.assertIsNotNone(
|
||||
self.dbg.GetCategory(lldb.eLanguageTypeObjC), "ObjC category is None"
|
||||
)
|
||||
|
||||
def test_force_synth_off(self):
|
||||
@@ -518,8 +517,8 @@ class SBFormattersAPITestCase(TestBase):
|
||||
int_vector = frame.FindVariable("int_vector")
|
||||
if self.TraceOn():
|
||||
print(int_vector)
|
||||
self.assertFalse(
|
||||
int_vector.GetNumChildren() == 0, '"physical" vector is not empty'
|
||||
self.assertNotEqual(
|
||||
int_vector.GetNumChildren(), 0, '"physical" vector is not empty'
|
||||
)
|
||||
|
||||
self.runCmd("settings set target.enable-synthetic-value true")
|
||||
|
||||
@@ -56,9 +56,9 @@ class TestGetVariables(TestBase):
|
||||
breakpoint2 = target.BreakpointCreateByLocation(self.source, line2)
|
||||
breakpoint3 = target.BreakpointCreateByLocation(self.source, line3)
|
||||
|
||||
self.assertTrue(breakpoint1.GetNumLocations() >= 1, PROCESS_IS_VALID)
|
||||
self.assertTrue(breakpoint2.GetNumLocations() >= 1, PROCESS_IS_VALID)
|
||||
self.assertTrue(breakpoint3.GetNumLocations() >= 1, PROCESS_IS_VALID)
|
||||
self.assertGreaterEqual(breakpoint1.GetNumLocations(), 1, PROCESS_IS_VALID)
|
||||
self.assertGreaterEqual(breakpoint2.GetNumLocations(), 1, PROCESS_IS_VALID)
|
||||
self.assertGreaterEqual(breakpoint3.GetNumLocations(), 1, PROCESS_IS_VALID)
|
||||
|
||||
# Register our shared libraries for remote targets so they get
|
||||
# automatically uploaded
|
||||
|
||||
@@ -17,7 +17,7 @@ class ModuleAndSectionAPIsTestCase(TestBase):
|
||||
|
||||
target = self.dbg.CreateTarget(exe)
|
||||
self.assertTrue(target, VALID_TARGET)
|
||||
self.assertTrue(target.GetNumModules() > 0)
|
||||
self.assertGreater(target.GetNumModules(), 0)
|
||||
|
||||
# Hide stdout if not running with '-t' option.
|
||||
if not self.TraceOn():
|
||||
@@ -62,7 +62,7 @@ class ModuleAndSectionAPIsTestCase(TestBase):
|
||||
|
||||
target = self.dbg.CreateTarget(exe)
|
||||
self.assertTrue(target, VALID_TARGET)
|
||||
self.assertTrue(target.GetNumModules() > 0)
|
||||
self.assertGreater(target.GetNumModules(), 0)
|
||||
|
||||
# Hide stdout if not running with '-t' option.
|
||||
if not self.TraceOn():
|
||||
@@ -102,7 +102,7 @@ class ModuleAndSectionAPIsTestCase(TestBase):
|
||||
|
||||
target = self.dbg.CreateTarget(exe)
|
||||
self.assertTrue(target, VALID_TARGET)
|
||||
self.assertTrue(target.GetNumModules() > 0)
|
||||
self.assertGreater(target.GetNumModules(), 0)
|
||||
|
||||
# Hide stdout if not running with '-t' option.
|
||||
if not self.TraceOn():
|
||||
|
||||
@@ -324,7 +324,7 @@ class ProcessAPITestCase(TestBase):
|
||||
|
||||
if self.TraceOn():
|
||||
print("process state:", state_type_to_str(process.GetState()))
|
||||
self.assertTrue(process.GetState() != lldb.eStateConnected)
|
||||
self.assertNotEqual(process.GetState(), lldb.eStateConnected)
|
||||
|
||||
error = lldb.SBError()
|
||||
success = process.RemoteLaunch(
|
||||
|
||||
@@ -175,7 +175,7 @@ class ProcessIOTestCase(TestBase):
|
||||
self.breakpoint = self.target.BreakpointCreateBySourceRegex(
|
||||
"Set breakpoint here", lldb.SBFileSpec("main.c")
|
||||
)
|
||||
self.assertTrue(self.breakpoint.GetNumLocations() > 0, VALID_BREAKPOINT)
|
||||
self.assertGreater(self.breakpoint.GetNumLocations(), 0, VALID_BREAKPOINT)
|
||||
|
||||
# Launch the process, and do not stop at the entry point.
|
||||
error = lldb.SBError()
|
||||
@@ -223,11 +223,7 @@ class ProcessIOTestCase(TestBase):
|
||||
|
||||
for line in self.lines:
|
||||
check_line = "input line to stdout: %s" % (line)
|
||||
self.assertTrue(
|
||||
check_line in output, "verify stdout line shows up in STDOUT"
|
||||
)
|
||||
self.assertIn(check_line, output, "verify stdout line shows up in STDOUT")
|
||||
for line in self.lines:
|
||||
check_line = "input line to stderr: %s" % (line)
|
||||
self.assertTrue(
|
||||
check_line in error, "verify stderr line shows up in STDERR"
|
||||
)
|
||||
self.assertIn(check_line, error, "verify stderr line shows up in STDERR")
|
||||
|
||||
@@ -90,8 +90,8 @@ class SBDataAPICase(TestBase):
|
||||
self.assertTrue(
|
||||
(low == 9 and high == 0) or (low == 0 and high == 9), "foo[0].b == 9"
|
||||
)
|
||||
self.assertTrue(
|
||||
fabs(data.GetFloat(error, offset) - 3.14) < 1, "foo[0].c == 3.14"
|
||||
self.assertLess(
|
||||
fabs(data.GetFloat(error, offset) - 3.14), 1, "foo[0].c == 3.14"
|
||||
)
|
||||
self.assertSuccess(error)
|
||||
offset += 4
|
||||
@@ -151,7 +151,7 @@ class SBDataAPICase(TestBase):
|
||||
self.assertEqual(data.uint32[0], 8, "then foo[1].a == 8")
|
||||
self.assertEqual(data.uint32[1], 7, "then foo[1].b == 7")
|
||||
# exploiting that sizeof(uint32) == sizeof(float)
|
||||
self.assertTrue(fabs(data.float[2] - 3.14) < 1, "foo[1].c == 3.14")
|
||||
self.assertLess(fabs(data.float[2] - 3.14), 1, "foo[1].c == 3.14")
|
||||
|
||||
self.runCmd("n")
|
||||
|
||||
@@ -160,8 +160,8 @@ class SBDataAPICase(TestBase):
|
||||
offset += 4
|
||||
self.assert_data(data.GetUnsignedInt32, offset, 7)
|
||||
offset += 4
|
||||
self.assertTrue(
|
||||
fabs(data.GetFloat(error, offset) - 3.14) < 1, "foo[1].c == 3.14"
|
||||
self.assertLess(
|
||||
fabs(data.GetFloat(error, offset) - 3.14), 1, "foo[1].c == 3.14"
|
||||
)
|
||||
self.assertSuccess(error)
|
||||
|
||||
@@ -172,8 +172,8 @@ class SBDataAPICase(TestBase):
|
||||
offset += 4
|
||||
self.assert_data(data.GetUnsignedInt32, offset, 7)
|
||||
offset += 4
|
||||
self.assertTrue(
|
||||
fabs(data.GetFloat(error, offset) - 6.28) < 1, "foo[1].c == 6.28"
|
||||
self.assertLess(
|
||||
fabs(data.GetFloat(error, offset) - 6.28), 1, "foo[1].c == 6.28"
|
||||
)
|
||||
self.assertSuccess(error)
|
||||
|
||||
@@ -187,14 +187,14 @@ class SBDataAPICase(TestBase):
|
||||
offset += 4
|
||||
self.assert_data(data.GetUnsignedInt32, offset, 2)
|
||||
offset += 4
|
||||
self.assertTrue(fabs(data.GetFloat(error, offset) - 3) < 1, "barfoo[0].c == 3")
|
||||
self.assertLess(fabs(data.GetFloat(error, offset) - 3), 1, "barfoo[0].c == 3")
|
||||
self.assertSuccess(error)
|
||||
offset += 4
|
||||
self.assert_data(data.GetUnsignedInt32, offset, 4)
|
||||
offset += 4
|
||||
self.assert_data(data.GetUnsignedInt32, offset, 5)
|
||||
offset += 4
|
||||
self.assertTrue(fabs(data.GetFloat(error, offset) - 6) < 1, "barfoo[1].c == 6")
|
||||
self.assertLess(fabs(data.GetFloat(error, offset) - 6), 1, "barfoo[1].c == 6")
|
||||
self.assertSuccess(error)
|
||||
|
||||
new_object = barfoo.CreateValueFromData(
|
||||
@@ -332,16 +332,16 @@ class SBDataAPICase(TestBase):
|
||||
data2 = lldb.SBData.CreateDataFromDoubleArray(
|
||||
process.GetByteOrder(), process.GetAddressByteSize(), [3.14, 6.28, 2.71]
|
||||
)
|
||||
self.assertTrue(
|
||||
fabs(data2.GetDouble(error, 0) - 3.14) < 0.5, "double data2[0] = 3.14"
|
||||
self.assertLess(
|
||||
fabs(data2.GetDouble(error, 0) - 3.14), 0.5, "double data2[0] = 3.14"
|
||||
)
|
||||
self.assertSuccess(error)
|
||||
self.assertTrue(
|
||||
fabs(data2.GetDouble(error, 8) - 6.28) < 0.5, "double data2[1] = 6.28"
|
||||
self.assertLess(
|
||||
fabs(data2.GetDouble(error, 8) - 6.28), 0.5, "double data2[1] = 6.28"
|
||||
)
|
||||
self.assertSuccess(error)
|
||||
self.assertTrue(
|
||||
fabs(data2.GetDouble(error, 16) - 2.71) < 0.5, "double data2[2] = 2.71"
|
||||
self.assertLess(
|
||||
fabs(data2.GetDouble(error, 16) - 2.71), 0.5, "double data2[2] = 2.71"
|
||||
)
|
||||
self.assertSuccess(error)
|
||||
|
||||
@@ -380,8 +380,9 @@ class SBDataAPICase(TestBase):
|
||||
data2.uint64[4], 5, "read_data_helper failure: set data2[4] = 5"
|
||||
)
|
||||
|
||||
self.assertTrue(
|
||||
data2.uint64[0:2] == [1, 2],
|
||||
self.assertEqual(
|
||||
data2.uint64[0:2],
|
||||
[1, 2],
|
||||
"read_data_helper failure: set data2[0:2] = [1,2]",
|
||||
)
|
||||
|
||||
@@ -417,26 +418,29 @@ class SBDataAPICase(TestBase):
|
||||
)
|
||||
|
||||
data2.SetDataFromDoubleArray([3.14, 6.28, 2.71])
|
||||
self.assertTrue(
|
||||
fabs(data2.GetDouble(error, 0) - 3.14) < 0.5, "set double data2[0] = 3.14"
|
||||
self.assertLess(
|
||||
fabs(data2.GetDouble(error, 0) - 3.14), 0.5, "set double data2[0] = 3.14"
|
||||
)
|
||||
self.assertTrue(
|
||||
fabs(data2.GetDouble(error, 8) - 6.28) < 0.5, "set double data2[1] = 6.28"
|
||||
self.assertLess(
|
||||
fabs(data2.GetDouble(error, 8) - 6.28), 0.5, "set double data2[1] = 6.28"
|
||||
)
|
||||
self.assertTrue(
|
||||
fabs(data2.GetDouble(error, 16) - 2.71) < 0.5, "set double data2[2] = 2.71"
|
||||
self.assertLess(
|
||||
fabs(data2.GetDouble(error, 16) - 2.71), 0.5, "set double data2[2] = 2.71"
|
||||
)
|
||||
|
||||
self.assertTrue(
|
||||
fabs(data2.double[0] - 3.14) < 0.5,
|
||||
self.assertLess(
|
||||
fabs(data2.double[0] - 3.14),
|
||||
0.5,
|
||||
"read_data_helper failure: set double data2[0] = 3.14",
|
||||
)
|
||||
self.assertTrue(
|
||||
fabs(data2.double[1] - 6.28) < 0.5,
|
||||
self.assertLess(
|
||||
fabs(data2.double[1] - 6.28),
|
||||
0.5,
|
||||
"read_data_helper failure: set double data2[1] = 6.28",
|
||||
)
|
||||
self.assertTrue(
|
||||
fabs(data2.double[2] - 2.71) < 0.5,
|
||||
self.assertLess(
|
||||
fabs(data2.double[2] - 2.71),
|
||||
0.5,
|
||||
"read_data_helper failure: set double data2[2] = 2.71",
|
||||
)
|
||||
|
||||
@@ -452,7 +456,8 @@ class SBDataAPICase(TestBase):
|
||||
"%s(error, %s) did not succeed: %s"
|
||||
% (func.__name__, arg, stream.GetData()),
|
||||
)
|
||||
self.assertTrue(
|
||||
expected == result,
|
||||
self.assertEqual(
|
||||
expected,
|
||||
result,
|
||||
"%s(error, %s) == %s != %s" % (func.__name__, arg, result, expected),
|
||||
)
|
||||
|
||||
@@ -51,7 +51,7 @@ class SBModuleAPICase(TestBase):
|
||||
)
|
||||
self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
|
||||
main_module = target.FindModule(lldb.SBFileSpec("a.out"))
|
||||
self.assertTrue(main_module is not None)
|
||||
self.assertIsNotNone(main_module)
|
||||
self.assertFalse(
|
||||
main_module.IsFileBacked(),
|
||||
"The module should not be backed by a file on disk.",
|
||||
|
||||
@@ -112,7 +112,7 @@ class TargetAPITestCase(TestBase):
|
||||
target = self.create_simple_target("b.out")
|
||||
|
||||
abi_pre_launch = target.GetABIName()
|
||||
self.assertTrue(len(abi_pre_launch) != 0, "Got an ABI string")
|
||||
self.assertNotEqual(len(abi_pre_launch), 0, "Got an ABI string")
|
||||
|
||||
breakpoint = target.BreakpointCreateByLocation("main.c", self.line_main)
|
||||
self.assertTrue(breakpoint, VALID_BREAKPOINT)
|
||||
|
||||
@@ -54,7 +54,7 @@ class TypeAndTypeListTestCase(TestBase):
|
||||
% type_list.GetSize()
|
||||
)
|
||||
# a second Task make be scared up by the Objective-C runtime
|
||||
self.assertTrue(len(type_list) >= 1)
|
||||
self.assertGreaterEqual(len(type_list), 1)
|
||||
for type in type_list:
|
||||
self.assertTrue(type)
|
||||
self.DebugSBType(type)
|
||||
@@ -133,7 +133,7 @@ class TypeAndTypeListTestCase(TestBase):
|
||||
self.DebugSBType(union_type)
|
||||
|
||||
# Check that we don't find indirectly nested types
|
||||
self.assertTrue(enum_type.size == 1)
|
||||
self.assertEqual(enum_type.size, 1)
|
||||
|
||||
invalid_type = task_type.FindDirectNestedType("E2")
|
||||
self.assertFalse(invalid_type)
|
||||
|
||||
@@ -128,7 +128,7 @@ class ChangeValueAPITestCase(TestBase):
|
||||
"Val - 12345 Mine - 55, 98765, 55555555. Ptr - 66, 98765, 66666666"
|
||||
)
|
||||
stdout = process.GetSTDOUT(1000)
|
||||
self.assertTrue(expected_value in stdout, "STDOUT showed changed values.")
|
||||
self.assertIn(expected_value, stdout, "STDOUT showed changed values.")
|
||||
|
||||
# Finally, change the stack pointer to 0, and we should not make it to
|
||||
# our end breakpoint.
|
||||
@@ -150,8 +150,8 @@ class ChangeValueAPITestCase(TestBase):
|
||||
|
||||
self.assertState(process.GetState(), lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(
|
||||
thread is None,
|
||||
self.assertIsNone(
|
||||
thread,
|
||||
"We should not have managed to hit our second breakpoint with sp == 1",
|
||||
)
|
||||
|
||||
|
||||
@@ -47,4 +47,4 @@ class LibcxxChangeValueTestCase(TestBase):
|
||||
result = inner_val.SetValueFromCString("42")
|
||||
self.assertTrue(result, "Setting val returned True.")
|
||||
result = inner_val.GetValueAsUnsigned()
|
||||
self.assertTrue(result == 42, "Got correct value (42)")
|
||||
self.assertEqual(result, 42, "Got correct value (42)")
|
||||
|
||||
@@ -44,10 +44,10 @@ class LibcxxChangeValueTestCase(TestBase):
|
||||
self.assertTrue(val_value.IsValid(), "Got the SBValue for val")
|
||||
pair0 = val_value.GetChildMemberWithName("[0]")
|
||||
self.assertTrue(pair0.IsValid(), "Got the SBValue for [0]")
|
||||
self.assertTrue(pair0.GetNumChildren() == 2, "Got 2 children")
|
||||
self.assertEqual(pair0.GetNumChildren(), 2, "Got 2 children")
|
||||
pair0_second = pair0.GetChildMemberWithName("second")
|
||||
self.assertTrue(pair0_second.IsValid(), "Got the SBValue for [0].second")
|
||||
result = pair0_second.SetValueFromCString("12345")
|
||||
self.assertTrue(result, "Setting val returned True.")
|
||||
result = pair0_second.GetValueAsUnsigned()
|
||||
self.assertTrue(result == 12345, "Got correct value (12345)")
|
||||
self.assertEqual(result, 12345, "Got correct value (12345)")
|
||||
|
||||
@@ -66,7 +66,7 @@ class WatchpointIteratorTestCase(TestBase):
|
||||
self.assertEqual(target.GetNumWatchpoints(), 1)
|
||||
self.assertTrue(watchpoint.IsEnabled())
|
||||
watch_id = watchpoint.GetID()
|
||||
self.assertTrue(watch_id != 0)
|
||||
self.assertNotEqual(watch_id, 0)
|
||||
|
||||
# Continue. Expect the program to stop due to the variable being
|
||||
# written to.
|
||||
|
||||
@@ -259,7 +259,7 @@ class SourceManagerTestCase(TestBase):
|
||||
m = re.search("^\[(\d+)\].*// Set break point at this line.", output)
|
||||
if not m:
|
||||
self.fail("Fail to display source level breakpoints")
|
||||
self.assertTrue(int(m.group(1)) > 0)
|
||||
self.assertGreater(int(m.group(1)), 0)
|
||||
|
||||
# Modify content
|
||||
self.modify_content()
|
||||
|
||||
@@ -70,4 +70,4 @@ class TestDAP_coreFile(lldbdap_testcase.DAPTestCaseBase):
|
||||
source_map = [["/home/labath/test", current_dir]]
|
||||
self.attach(exe_file, coreFile=core_file, sourceMap=source_map)
|
||||
|
||||
self.assertTrue(current_dir in self.get_stackFrames()[0]["source"]["path"])
|
||||
self.assertIn(current_dir, self.get_stackFrames()[0]["source"]["path"])
|
||||
|
||||
@@ -31,11 +31,11 @@ class TestDAP_disassemble(lldbdap_testcase.DAPTestCaseBase):
|
||||
self.continue_to_next_stop()
|
||||
|
||||
pc_assembly = self.disassemble(frameIndex=0)
|
||||
self.assertTrue("location" in pc_assembly, "Source location missing.")
|
||||
self.assertTrue("instruction" in pc_assembly, "Assembly instruction missing.")
|
||||
self.assertIn("location", pc_assembly, "Source location missing.")
|
||||
self.assertIn("instruction", pc_assembly, "Assembly instruction missing.")
|
||||
|
||||
# The calling frame (qsort) is coming from a system library, as a result
|
||||
# we should not have a source location.
|
||||
qsort_assembly = self.disassemble(frameIndex=1)
|
||||
self.assertFalse("location" in qsort_assembly, "Source location not expected.")
|
||||
self.assertTrue("instruction" in pc_assembly, "Assembly instruction missing.")
|
||||
self.assertNotIn("location", qsort_assembly, "Source location not expected.")
|
||||
self.assertIn("instruction", pc_assembly, "Assembly instruction missing.")
|
||||
|
||||
@@ -78,7 +78,7 @@ class TestDAP_runInTerminal(lldbdap_testcase.DAPTestCaseBase):
|
||||
|
||||
# We verify we actually stopped inside the loop
|
||||
counter = int(self.dap_server.get_local_variable_value("counter"))
|
||||
self.assertTrue(counter > 0)
|
||||
self.assertGreater(counter, 0)
|
||||
|
||||
# We verify we were able to set the launch arguments
|
||||
argc = int(self.dap_server.get_local_variable_value("argc"))
|
||||
@@ -122,7 +122,7 @@ class TestDAP_runInTerminal(lldbdap_testcase.DAPTestCaseBase):
|
||||
capture_output=True,
|
||||
universal_newlines=True,
|
||||
)
|
||||
self.assertTrue(proc.returncode != 0)
|
||||
self.assertNotEqual(proc.returncode, 0)
|
||||
self.assertIn(
|
||||
'"--launch-target" requires "--comm-file" to be specified', proc.stderr
|
||||
)
|
||||
|
||||
@@ -83,8 +83,8 @@ class TestDAP_stackTrace(lldbdap_testcase.DAPTestCaseBase):
|
||||
# Verify we get all stack frames with no arguments
|
||||
(stackFrames, totalFrames) = self.get_stackFrames_and_totalFramesCount()
|
||||
frameCount = len(stackFrames)
|
||||
self.assertTrue(
|
||||
frameCount >= 20, "verify we get at least 20 frames for all frames"
|
||||
self.assertGreaterEqual(
|
||||
frameCount, 20, "verify we get at least 20 frames for all frames"
|
||||
)
|
||||
self.assertEqual(
|
||||
totalFrames, frameCount, "verify we get correct value for totalFrames count"
|
||||
|
||||
@@ -45,16 +45,16 @@ class TestDAP_terminatedEvent(lldbdap_testcase.DAPTestCaseBase):
|
||||
self.continue_to_exit()
|
||||
|
||||
statistics = self.dap_server.wait_for_terminated()["statistics"]
|
||||
self.assertTrue(statistics["totalDebugInfoByteSize"] > 0)
|
||||
self.assertTrue(statistics["totalDebugInfoEnabled"] > 0)
|
||||
self.assertTrue(statistics["totalModuleCountHasDebugInfo"] > 0)
|
||||
self.assertGreater(statistics["totalDebugInfoByteSize"], 0)
|
||||
self.assertGreater(statistics["totalDebugInfoEnabled"], 0)
|
||||
self.assertGreater(statistics["totalModuleCountHasDebugInfo"], 0)
|
||||
|
||||
self.assertIsNotNone(statistics["memory"])
|
||||
self.assertNotIn("modules", statistics.keys())
|
||||
|
||||
# lldb-dap debugs one target at a time
|
||||
target = json.loads(statistics["targets"])[0]
|
||||
self.assertTrue(target["totalBreakpointResolveTime"] > 0)
|
||||
self.assertGreater(target["totalBreakpointResolveTime"], 0)
|
||||
|
||||
breakpoints = target["breakpoints"]
|
||||
self.assertIn(
|
||||
|
||||
@@ -58,14 +58,14 @@ class TestDAP_variables(lldbdap_testcase.DAPTestCaseBase):
|
||||
for key in verify:
|
||||
contains_array = verify[key]
|
||||
actual_value = actual[key]
|
||||
self.assertTrue(isinstance(contains_array, list))
|
||||
self.assertIsInstance(contains_array, list)
|
||||
for verify_value in contains_array:
|
||||
self.assertIn(verify_value, actual_value)
|
||||
if "missing" in verify_dict:
|
||||
missing = verify_dict["missing"]
|
||||
for key in missing:
|
||||
self.assertTrue(
|
||||
key not in actual, 'key "%s" is not expected in %s' % (key, actual)
|
||||
self.assertNotIn(
|
||||
key, actual, 'key "%s" is not expected in %s' % (key, actual)
|
||||
)
|
||||
hasVariablesReference = "variablesReference" in actual
|
||||
varRef = None
|
||||
@@ -727,8 +727,8 @@ class TestDAP_variables(lldbdap_testcase.DAPTestCaseBase):
|
||||
if reg["name"] == pc_name:
|
||||
value = reg["value"]
|
||||
self.assertTrue(value.startswith("0x"))
|
||||
self.assertTrue("a.out`main + " in value)
|
||||
self.assertTrue("at main.cpp:" in value)
|
||||
self.assertIn("a.out`main + ", value)
|
||||
self.assertIn("at main.cpp:", value)
|
||||
|
||||
@no_debug_info_test
|
||||
@skipUnlessDarwin
|
||||
|
||||
@@ -17,7 +17,7 @@ class TestGdbRemoteAttach(gdbremote_testcase.GdbRemoteTestCaseBase):
|
||||
# Make sure the target process has been launched.
|
||||
inferior = procs.get("inferior")
|
||||
self.assertIsNotNone(inferior)
|
||||
self.assertTrue(inferior.pid > 0)
|
||||
self.assertGreater(inferior.pid, 0)
|
||||
self.assertTrue(lldbgdbserverutils.process_is_running(inferior.pid, True))
|
||||
|
||||
# Add attach packets.
|
||||
|
||||
@@ -117,8 +117,8 @@ class TestGdbRemoteAuxvSupport(gdbremote_testcase.GdbRemoteTestCaseBase):
|
||||
# small (usually smaller than 50), they can sometimes be larger.
|
||||
self.trace("auxv dict: {}".format(auxv_dict))
|
||||
for auxv_key in auxv_dict:
|
||||
self.assertTrue(auxv_key >= 1)
|
||||
self.assertTrue(auxv_key <= 2500)
|
||||
self.assertGreaterEqual(auxv_key, 1)
|
||||
self.assertLessEqual(auxv_key, 2500)
|
||||
|
||||
@skipIfWindows
|
||||
@expectedFailureNetBSD
|
||||
|
||||
@@ -44,7 +44,7 @@ class TestGdbRemoteExpeditedRegisters(gdbremote_testcase.GdbRemoteTestCaseBase):
|
||||
# notification.
|
||||
expedited_registers = self.gather_expedited_registers()
|
||||
self.assertIsNotNone(expedited_registers)
|
||||
self.assertTrue(len(expedited_registers) > 0)
|
||||
self.assertGreater(len(expedited_registers), 0)
|
||||
|
||||
# Gather target register infos.
|
||||
reg_infos = self.gather_register_infos()
|
||||
@@ -67,7 +67,7 @@ class TestGdbRemoteExpeditedRegisters(gdbremote_testcase.GdbRemoteTestCaseBase):
|
||||
# notification.
|
||||
expedited_registers = self.gather_expedited_registers()
|
||||
# Verify we have at least one expedited register.
|
||||
self.assertTrue(len(expedited_registers) > 0)
|
||||
self.assertGreater(len(expedited_registers), 0)
|
||||
|
||||
def test_stop_notification_contains_no_duplicate_registers(self):
|
||||
self.build()
|
||||
@@ -113,7 +113,7 @@ class TestGdbRemoteExpeditedRegisters(gdbremote_testcase.GdbRemoteTestCaseBase):
|
||||
# notification.
|
||||
expedited_registers = self.gather_expedited_registers()
|
||||
self.assertIsNotNone(expedited_registers)
|
||||
self.assertTrue(len(expedited_registers) > 0)
|
||||
self.assertGreater(len(expedited_registers), 0)
|
||||
|
||||
# Gather target register infos.
|
||||
reg_infos = self.gather_register_infos()
|
||||
|
||||
@@ -38,7 +38,7 @@ class TestGdbRemoteRegisterState(gdbremote_testcase.GdbRemoteTestCaseBase):
|
||||
for reg_info in reg_infos
|
||||
if self.is_bit_flippable_register(reg_info)
|
||||
]
|
||||
self.assertTrue(len(gpr_reg_infos) > 0)
|
||||
self.assertGreater(len(gpr_reg_infos), 0)
|
||||
|
||||
# Gather thread info.
|
||||
if with_suffix:
|
||||
@@ -77,7 +77,7 @@ class TestGdbRemoteRegisterState(gdbremote_testcase.GdbRemoteTestCaseBase):
|
||||
successful_writes, failed_writes
|
||||
)
|
||||
)
|
||||
self.assertTrue(successful_writes > 0)
|
||||
self.assertGreater(successful_writes, 0)
|
||||
|
||||
flipped_reg_values = self.read_register_values(
|
||||
gpr_reg_infos, endian, thread_id=thread_id
|
||||
|
||||
@@ -214,7 +214,7 @@ class LldbGdbServerTestCase(
|
||||
register_sets = {
|
||||
reg_info["set"]: 1 for reg_info in reg_infos if "set" in reg_info
|
||||
}
|
||||
self.assertTrue(len(register_sets) >= 1)
|
||||
self.assertGreaterEqual(len(register_sets), 1)
|
||||
|
||||
def targetHasAVX(self):
|
||||
triple = self.dbg.GetSelectedPlatform().GetTriple()
|
||||
@@ -344,7 +344,7 @@ class LldbGdbServerTestCase(
|
||||
# Gather register info entries.
|
||||
reg_infos = self.parse_register_info_packets(context)
|
||||
self.assertIsNotNone(reg_infos)
|
||||
self.assertTrue(len(reg_infos) > 0)
|
||||
self.assertGreater(len(reg_infos), 0)
|
||||
|
||||
byte_order = self.get_target_byte_order()
|
||||
|
||||
@@ -1072,7 +1072,7 @@ class LldbGdbServerTestCase(
|
||||
def test_qSupported_returns_known_stub_features(self):
|
||||
supported_dict = self.get_qSupported_dict()
|
||||
self.assertIsNotNone(supported_dict)
|
||||
self.assertTrue(len(supported_dict) > 0)
|
||||
self.assertGreater(len(supported_dict), 0)
|
||||
|
||||
def test_qSupported_auvx(self):
|
||||
expected = (
|
||||
@@ -1267,7 +1267,7 @@ class LldbGdbServerTestCase(
|
||||
for reg_info in reg_infos
|
||||
if self.is_bit_flippable_register(reg_info)
|
||||
]
|
||||
self.assertTrue(len(gpr_reg_infos) > 0)
|
||||
self.assertGreater(len(gpr_reg_infos), 0)
|
||||
|
||||
# Write flipped bit pattern of existing value to each register.
|
||||
(successful_writes, failed_writes) = self.flip_all_bits_in_each_register_value(
|
||||
@@ -1278,7 +1278,7 @@ class LldbGdbServerTestCase(
|
||||
successful_writes, failed_writes
|
||||
)
|
||||
)
|
||||
self.assertTrue(successful_writes > 0)
|
||||
self.assertGreater(successful_writes, 0)
|
||||
|
||||
# Note: as of this moment, a hefty number of the GPR writes are failing
|
||||
# with E32 (everything except rax-rdx, rdi, rsi, rbp).
|
||||
@@ -1310,7 +1310,7 @@ class LldbGdbServerTestCase(
|
||||
reg_index = self.select_modifiable_register(reg_infos)
|
||||
self.assertIsNotNone(reg_index)
|
||||
reg_byte_size = int(reg_infos[reg_index]["bitsize"]) // 8
|
||||
self.assertTrue(reg_byte_size > 0)
|
||||
self.assertGreater(reg_byte_size, 0)
|
||||
|
||||
expected_reg_values = []
|
||||
register_increment = 1
|
||||
|
||||
@@ -26,7 +26,7 @@ class TestGdbRemoteAttachWait(gdbremote_testcase.GdbRemoteTestCaseBase):
|
||||
def _launch_inferior(self, args):
|
||||
inferior = self.spawnSubprocess(self.getBuildArtifact(self._exe_to_run), args)
|
||||
self.assertIsNotNone(inferior)
|
||||
self.assertTrue(inferior.pid > 0)
|
||||
self.assertGreater(inferior.pid, 0)
|
||||
self.assertTrue(lldbgdbserverutils.process_is_running(inferior.pid, True))
|
||||
return inferior
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class TestGdbRemoteTargetXmlPacket(gdbremote_testcase.GdbRemoteTestCaseBase):
|
||||
self.assertIsNotNone(feature)
|
||||
|
||||
target_xml_registers = feature.findall("reg")
|
||||
self.assertTrue(len(target_xml_registers) > 0)
|
||||
self.assertGreater(len(target_xml_registers), 0)
|
||||
|
||||
# registers info collected by qRegisterInfo
|
||||
self.add_register_info_collection_packets()
|
||||
|
||||
Reference in New Issue
Block a user