JDevlieghere updated this revision to Diff 147711.
JDevlieghere marked an inline comment as done.
JDevlieghere added a comment.

- Use absolute path to `lldb-dotest` when `--executable` is passed.


https://reviews.llvm.org/D47062

Files:
  packages/Python/lldbsuite/test/dosep.py
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/lldbtest_config.py

Index: packages/Python/lldbsuite/test/lldbtest_config.py
===================================================================
--- packages/Python/lldbsuite/test/lldbtest_config.py
+++ packages/Python/lldbsuite/test/lldbtest_config.py
@@ -21,3 +21,6 @@
 
 # path to the lldb command line executable tool
 lldbExec = None
+
+# path to lldb-dotest wrapper
+dotestWrapper = None
Index: packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -700,21 +700,21 @@
         """Return the full path to the current test."""
         return os.path.join(os.environ["LLDB_BUILD"], self.mydir,
                             self.getBuildDirBasename())
-    
-     
+
+
     def makeBuildDir(self):
         """Create the test-specific working directory, deleting any previous
         contents."""
         # See also dotest.py which sets up ${LLDB_BUILD}.
         bdir = self.getBuildDir()
         if os.path.isdir(bdir):
             shutil.rmtree(bdir)
         lldbutil.mkdir_p(bdir)
- 
+
     def getBuildArtifact(self, name="a.out"):
         """Return absolute path to an artifact in the test's build directory."""
         return os.path.join(self.getBuildDir(), name)
- 
+
     def getSourcePath(self, name):
         """Return absolute path to a file in the test's source directory."""
         return os.path.join(self.getSourceDir(), name)
@@ -1089,7 +1089,7 @@
                     file=sbuf)
 
     def getRerunArgs(self):
-        return " -f %s.%s" % (self.__class__.__name__, self._testMethodName)
+        return "-f %s.%s" % (self.__class__.__name__, self._testMethodName)
 
     def getLogBasenameForCurrentTest(self, prefix=None):
         """
@@ -1186,18 +1186,13 @@
             benchmarks = False
 
         import datetime
-        print(
-            "Session info generated @",
+        print("Session info generated @",
             datetime.datetime.now().ctime(),
             file=self.session)
-        print(
-            "To rerun this test, issue the following command from the 'test' directory:\n",
+        print("To rerun this test, issue the following command:\n",
             file=self.session)
         print(
-            "./dotest.py %s -v %s %s" %
-            (self.getRunOptions(),
-             ('+b' if benchmarks else '-t'),
-                self.getRerunArgs()),
+            "{} {}".format(lldbtest_config.dotestWrapper, self.getRerunArgs()),
             file=self.session)
         self.session.close()
         del self.session
@@ -1373,18 +1368,6 @@
 
         return False
 
-    def getRunOptions(self):
-        """Command line option for -A and -C to run this test again, called from
-        self.dumpSessionInfo()."""
-        arch = self.getArchitecture()
-        comp = self.getCompiler()
-        option_str = ""
-        if arch:
-            option_str = "-A " + arch
-        if comp:
-            option_str += " -C " + comp
-        return option_str
-
     def getDebugInfo(self):
         method = getattr(self, self.testMethodName)
         return getattr(method, "debug_info", None)
@@ -1840,7 +1823,7 @@
         temp = os.path.join(self.getSourceDir(), template)
         with open(temp, 'r') as f:
             content = f.read()
-            
+
         public_api_dir = os.path.join(
             os.environ["LLDB_SRC"], "include", "lldb", "API")
 
Index: packages/Python/lldbsuite/test/dotest.py
===================================================================
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -382,8 +382,12 @@
     if args.executable:
         # lldb executable is passed explicitly
         lldbtest_config.lldbExec = os.path.realpath(args.executable)
-        if not is_exe(lldbtest_config.lldbExec):
+        if is_exe(lldbtest_config.lldbExec):
+            lldbtest_config.dotestWrapper = "{}-dotest".format(
+              os.path.realpath(args.executable))
+        else:
             lldbtest_config.lldbExec = which(args.executable)
+            lldbtest_config.dotestWrapper = "lldb-dotest"
         if not is_exe(lldbtest_config.lldbExec):
             logging.error(
                     '%s is not a valid executable to test; aborting...',
@@ -991,10 +995,6 @@
             raise Exception(
                 'log enable failed (check GDB_REMOTE_LOG env variable)')
 
-
-def getMyCommandLine():
-    return ' '.join(sys.argv)
-
 # ======================================== #
 #                                          #
 # Execution of the test driver starts here #
@@ -1274,7 +1274,7 @@
         "\nSession logs for test failures/errors/unexpected successes"
         " will go into directory '%s'\n" %
         configuration.sdir_name)
-    sys.stderr.write("Command invoked: %s\n" % getMyCommandLine())
+    sys.stderr.write("Command invoked: %s\n" % ' '.join(sys.argv))
 
     if not os.path.isdir(configuration.sdir_name):
         try:
Index: packages/Python/lldbsuite/test/dosep.py
===================================================================
--- packages/Python/lldbsuite/test/dosep.py
+++ packages/Python/lldbsuite/test/dosep.py
@@ -55,6 +55,7 @@
 
 from . import configuration
 from . import dotest_args
+from . import lldbtest_config
 from lldbsuite.support import optional_with
 from lldbsuite.test_event import dotest_channels
 from lldbsuite.test_event.event_builder import EventBuilder
@@ -119,7 +120,10 @@
             else:
                 timeout_str = ""
             print("[%s FAILED]%s" % (name, timeout_str), file=sys.stderr)
-            print("Command invoked: %s" % ' '.join(command), file=sys.stderr)
+            print(
+               "Reproduce with: {} -f {}".format(lldbtest_config.dotestWrapper,
+                                                name),
+               file=sys.stderr)
         update_progress(name)
 
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to