[lldb/Reproducers] Fix/skip passive replay failures in python_api subdir

Fixes or skips tests in the python_api subdirectory that were failing
with passive replay.
This commit is contained in:
Jonas Devlieghere 2020-05-20 23:23:50 -07:00
parent 78dea0e8fb
commit 7606a54363
7 changed files with 31 additions and 17 deletions

View File

@ -414,6 +414,7 @@ Module *SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(
FileSpec oso_file(oso_path);
ConstString oso_object;
if (FileSystem::Instance().Exists(oso_file)) {
FileSystem::Instance().Collect(oso_file);
// The modification time returned by the FS can have a higher precision
// than the one from the CU.
auto oso_mod_time = std::chrono::time_point_cast<std::chrono::seconds>(

View File

@ -19,6 +19,7 @@ class DisassembleRawDataTestCase(TestBase):
@add_test_categories(['pyapi'])
@no_debug_info_test
@skipIfRemote
@skipIfReproducer # GetInstructions is not instrumented.
def test_disassemble_raw_data(self):
"""Test disassembling raw bytes with the API."""
# Create a target from the debugger.

View File

@ -10,6 +10,7 @@ class CommandRunInterpreterLegacyAPICase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
mydir = TestBase.compute_mydir(__file__)
@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented.
def setUp(self):
TestBase.setUp(self)
@ -47,6 +48,7 @@ class CommandRunInterpreterAPICase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
mydir = TestBase.compute_mydir(__file__)
@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented.
def setUp(self):
TestBase.setUp(self)

View File

@ -24,6 +24,7 @@ class ProcessAPITestCase(TestBase):
"// Set break point at this line and check variable 'my_char'.")
@add_test_categories(['pyapi'])
@skipIfReproducer # SBProcess::ReadMemory is not instrumented.
def test_read_memory(self):
"""Test Python SBProcess.ReadMemory() API."""
self.build()
@ -122,6 +123,7 @@ class ProcessAPITestCase(TestBase):
"Result from SBProcess.ReadUnsignedFromMemory() does not match our expected output")
@add_test_categories(['pyapi'])
@skipIfReproducer # SBProcess::WriteMemory is not instrumented.
def test_write_memory(self):
"""Test Python SBProcess.WriteMemory() API."""
self.build()
@ -181,6 +183,7 @@ class ProcessAPITestCase(TestBase):
startstr=b'a')
@add_test_categories(['pyapi'])
@skipIfReproducer # SBProcess::WriteMemory is not instrumented.
def test_access_my_int(self):
"""Test access 'my_int' using Python SBProcess.GetByteOrder() and other APIs."""
self.build()

View File

@ -13,6 +13,7 @@ class TestReadMemCString(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = True
@skipIfReproducer # SBProcess::ReadCStringFromMemory is not instrumented.
def test_read_memory_c_string(self):
"""Test corner case behavior of SBProcess::ReadCStringFromMemory"""
self.build()

View File

@ -122,6 +122,7 @@ class TargetAPITestCase(TestBase):
self.assertEqual(data_section.name, data_section2.name)
@add_test_categories(['pyapi'])
@skipIfReproducer # SBTarget::ReadMemory is not instrumented.
def test_read_memory(self):
d = {'EXE': 'b.out'}
self.build(dictionary=d)
@ -214,16 +215,18 @@ class TargetAPITestCase(TestBase):
self.expect(my_global_var.GetValue(), exe=False,
startstr="'X'")
# While we are at it, let's also exercise the similar
# SBModule.FindGlobalVariables() API.
for m in target.module_iter():
if os.path.normpath(m.GetFileSpec().GetDirectory()) == self.getBuildDir() and m.GetFileSpec().GetFilename() == exe_name:
value_list = m.FindGlobalVariables(
target, 'my_global_var_of_char_type', 3)
self.assertTrue(value_list.GetSize() == 1)
self.assertTrue(
value_list.GetValueAtIndex(0).GetValue() == "'X'")
break
if not configuration.is_reproducer():
# While we are at it, let's also exercise the similar
# SBModule.FindGlobalVariables() API.
for m in target.module_iter():
if os.path.normpath(m.GetFileSpec().GetDirectory()) == self.getBuildDir() and m.GetFileSpec().GetFilename() == exe_name:
value_list = m.FindGlobalVariables(
target, 'my_global_var_of_char_type', 3)
self.assertTrue(value_list.GetSize() == 1)
self.assertTrue(
value_list.GetValueAtIndex(0).GetValue() == "'X'")
break
def find_compile_units(self, exe):
"""Exercise SBTarget.FindCompileUnits() API."""
@ -285,6 +288,7 @@ class TargetAPITestCase(TestBase):
@not_remote_testsuite_ready
@add_test_categories(['pyapi'])
@no_debug_info_test
@skipIfReproducer # Inferior doesn't run during replay.
def test_launch_new_process_and_redirect_stdout(self):
"""Exercise SBTaget.Launch() API with redirected stdout."""
self.build()

View File

@ -134,8 +134,7 @@ class ChangeValueAPITestCase(TestBase):
# gcc may set multiple locations for breakpoint
breakpoint.SetEnabled(False)
# Now continue, grab the stdout and make sure we changed the real
# values as well...
# Now continue.
process.Continue()
self.assertEquals(process.GetState(), lldb.eStateStopped)
@ -145,11 +144,14 @@ class ChangeValueAPITestCase(TestBase):
thread.IsValid(),
"There should be a thread stopped due to breakpoint condition")
expected_value = "Val - 12345 Mine - 55, 98765, 55555555. Ptr - 66, 98765, 66666666"
stdout = process.GetSTDOUT(1000)
self.assertTrue(
expected_value in stdout,
"STDOUT showed changed values.")
# Grab the stdout and make sure we changed the real values as well.
# This doesn't work for reproducers as the inferior doesn't run.
if not configuration.is_reproducer():
expected_value = "Val - 12345 Mine - 55, 98765, 55555555. Ptr - 66, 98765, 66666666"
stdout = process.GetSTDOUT(1000)
self.assertTrue(
expected_value in stdout,
"STDOUT showed changed values.")
# Finally, change the stack pointer to 0, and we should not make it to
# our end breakpoint.