[Lldb-commits] [lldb] 7606a54 - [lldb/Reproducers] Fix/skip passive replay failures in python_api subdir

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed May 20 23:24:40 PDT 2020


Author: Jonas Devlieghere
Date: 2020-05-20T23:23:53-07:00
New Revision: 7606a54363d3d90802977c9f5fb9046d4d780835

URL: https://github.com/llvm/llvm-project/commit/7606a54363d3d90802977c9f5fb9046d4d780835
DIFF: https://github.com/llvm/llvm-project/commit/7606a54363d3d90802977c9f5fb9046d4d780835.diff

LOG: [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.

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py
    lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py
    lldb/test/API/python_api/process/TestProcessAPI.py
    lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
    lldb/test/API/python_api/target/TestTargetAPI.py
    lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 0b532050f855..6515d78b8f23 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -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>(

diff  --git a/lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py b/lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py
index 8e2bc4ac45d4..49992f49a355 100644
--- a/lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py
+++ b/lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py
@@ -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.

diff  --git a/lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py b/lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py
index a32805bf859f..9f30f6a98ebd 100644
--- a/lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py
+++ b/lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py
@@ -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)
 

diff  --git a/lldb/test/API/python_api/process/TestProcessAPI.py b/lldb/test/API/python_api/process/TestProcessAPI.py
index d26933a4289d..4442284bf46e 100644
--- a/lldb/test/API/python_api/process/TestProcessAPI.py
+++ b/lldb/test/API/python_api/process/TestProcessAPI.py
@@ -24,6 +24,7 @@ def setUp(self):
             "// 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 @@ def test_read_memory(self):
                 "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 @@ def test_write_memory(self):
             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()

diff  --git a/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py b/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
index fc26c3b6c86d..f18b8e35f8b9 100644
--- a/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
+++ b/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
@@ -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()

diff  --git a/lldb/test/API/python_api/target/TestTargetAPI.py b/lldb/test/API/python_api/target/TestTargetAPI.py
index 6e5be6e8f17a..c5b960528d4b 100644
--- a/lldb/test/API/python_api/target/TestTargetAPI.py
+++ b/lldb/test/API/python_api/target/TestTargetAPI.py
@@ -122,6 +122,7 @@ def test_resolve_file_address(self):
         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 @@ def find_global_variables(self, exe_name):
         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 @@ def get_description(self):
     @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()

diff  --git a/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py b/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
index b7977f112aae..64391ebc3968 100644
--- a/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
+++ b/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
@@ -134,8 +134,7 @@ def test_change_value(self):
         # 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 @@ def test_change_value(self):
             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.


        


More information about the lldb-commits mailing list