[Lldb-commits] [lldb] c151230 - [lldb/Test] Cleanup TestJITLoaderGDB and make it compatible with reproducers

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 16 15:46:22 PDT 2020


Author: Jonas Devlieghere
Date: 2020-06-16T15:46:14-07:00
New Revision: c151230533e07b8fb3dd20b9a83ba0d79677f54c

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

LOG: [lldb/Test] Cleanup TestJITLoaderGDB and make it compatible with reproducers

Added: 
    

Modified: 
    lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py b/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py
index 4bd4150185cf..3a89947d3051 100644
--- a/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py
+++ b/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py
@@ -8,7 +8,6 @@
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 
-file_index = 0
 
 class JITLoaderGDBTestCase(TestBase):
 
@@ -27,25 +26,18 @@ def test_bogus_values(self):
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)
 
-        # launch the process, do not stop at entry point.
+        # Launch the process, do not stop at entry point.
         process = target.LaunchSimple(
             None, None, self.get_process_working_directory())
         self.assertTrue(process, PROCESS_IS_VALID)
 
         # The inferior will now pass bogus values over the interface. Make sure
         # we don't crash.
-
         self.assertEqual(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
 
     def gen_log_file(self):
-        global file_index
-        ++file_index
-        logfile = os.path.join(
-            self.getBuildDir(),
-            "jitintgdb-" + self.getArchitecture() + "-" +
-                str(file_index) + ".txt")
-
+        logfile = self.getBuildArtifact("jitintgdb-{}.txt".format(self.getArchitecture()))
         def cleanup():
             if os.path.exists(logfile):
                 os.unlink(logfile)
@@ -70,7 +62,7 @@ def cleanup():
             self.runCmd("settings set plugin.jit-loader.gdb.enable default")
         self.addTearDownHook(cleanup)
 
-        # launch the process
+        # Launch the process.
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)
         process = target.LaunchSimple(
@@ -80,11 +72,10 @@ def cleanup():
         self.assertEqual(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
 
-        logcontent = ""
-        if os.path.exists(logfile):
+        if not configuration.is_reproducer():
+            self.assertTrue(os.path.exists(logfile))
             logcontent = open(logfile).read()
-        self.assertIn(
-            "SetJITBreakpoint setting JIT breakpoint", logcontent)
+            self.assertIn("SetJITBreakpoint setting JIT breakpoint", logcontent)
 
     @skipIfWindows # This test fails on Windows during C code build
     def test_jit_int_off(self):
@@ -100,7 +91,7 @@ def cleanup():
             self.runCmd("settings set plugin.jit-loader.gdb.enable default")
         self.addTearDownHook(cleanup)
 
-        # launch the process
+        # Launch the process.
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)
         process = target.LaunchSimple(
@@ -110,9 +101,7 @@ def cleanup():
         self.assertEqual(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
 
-        if os.path.exists(logfile):
+        if not configuration.is_reproducer():
+            self.assertTrue(os.path.exists(logfile))
             logcontent = open(logfile).read()
-            self.assertNotIn(
-              "SetJITBreakpoint setting JIT breakpoint", logcontent)
-        else:
-            self.assertTrue(false)
+            self.assertNotIn("SetJITBreakpoint setting JIT breakpoint", logcontent)


        


More information about the lldb-commits mailing list