JDevlieghere updated this revision to Diff 147787.
JDevlieghere added a comment.
Herald added a subscriber: mgorny.

Make this work for Windows


https://reviews.llvm.org/D47062

Files:
  packages/Python/lldbsuite/test/dosep.py
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/dotest_args.py
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/lldbtest_config.py
  utils/lldb-dotest/CMakeLists.txt
  utils/lldb-dotest/lldb-dotest.in

Index: utils/lldb-dotest/lldb-dotest.in
===================================================================
--- utils/lldb-dotest/lldb-dotest.in
+++ utils/lldb-dotest/lldb-dotest.in
@@ -3,7 +3,7 @@
 import sys
 
 dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args_str = '@LLDB_DOTEST_ARGS@'
+dotest_args_str = '@LLDB_DOTEST_ARGS_WITH_WRAPPER@'
 
 if __name__ == '__main__':
     wrapper_args = sys.argv[1:]
Index: utils/lldb-dotest/CMakeLists.txt
===================================================================
--- utils/lldb-dotest/CMakeLists.txt
+++ utils/lldb-dotest/CMakeLists.txt
@@ -9,14 +9,20 @@
   foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
     string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
     string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
+    set(LLDB_DOTEST_WRAPPER ${LLDB_DOTEST_DIR}/lldb-dotest)
+    set(LLDB_DOTEST_ARGS_WITH_WRAPPER ${LLDB_DOTEST_ARGS})
+    list(APPEND LLDB_DOTEST_ARGS_WITH_WRAPPER --dotest-wrapper "${LLDB_DOTEST_WRAPPER}")
     configure_file(
       lldb-dotest.in
-      ${LLDB_DOTEST_DIR}/lldb-dotest
+      ${LLDB_DOTEST_WRAPPER}
       )
   endforeach()
 else()
+  set(LLDB_DOTEST_WRAPPER ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-dotest)
+  set(LLDB_DOTEST_ARGS_WITH_WRAPPER ${LLDB_DOTEST_ARGS})
+  list(APPEND LLDB_DOTEST_ARGS_WITH_WRAPPER --dotest-wrapper "${LLDB_DOTEST_WRAPPER}")
   configure_file(
     lldb-dotest.in
-    ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-dotest
+    ${LLDB_DOTEST_WRAPPER}
     )
 endif()
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
@@ -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)
Index: packages/Python/lldbsuite/test/dotest_args.py
===================================================================
--- packages/Python/lldbsuite/test/dotest_args.py
+++ packages/Python/lldbsuite/test/dotest_args.py
@@ -124,6 +124,11 @@
         '--executable',
         metavar='executable-path',
         help='The path to the lldb executable')
+    group.add_argument(
+        '--dotest-wrapper',
+        dest='dotest_wrapper',
+        metavar='executable-path',
+        help='The path to the lldb-dotest executable')
     group.add_argument(
         '--server',
         metavar='server-path',
Index: packages/Python/lldbsuite/test/dotest.py
===================================================================
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -390,6 +390,11 @@
                     args.executable)
             sys.exit(-1)
 
+    if args.dotest_wrapper:
+        lldbtest_config.dotestWrapper = os.path.realpath(args.dotest_wrapper)
+    else:
+        lldbtest_config.dotestWrapper = "lldb-dotest"
+
     if args.server:
         os.environ['LLDB_DEBUGSERVER_PATH'] = args.server
 
@@ -991,10 +996,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 +1275,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