[PATCH] D44728: [dotest] Use subprocess.call to forward arguments in wrapper

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 21 04:16:50 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL328089: [dotest] Use subprocess.call to forward arguments in wrapper (authored by JDevlieghere, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D44728?vs=139270&id=139274#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44728

Files:
  lldb/trunk/test/CMakeLists.txt
  lldb/trunk/test/lldb-dotest.in


Index: lldb/trunk/test/CMakeLists.txt
===================================================================
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -136,8 +136,7 @@
   )
 
 # Generate a wrapper for dotest.py in the bin directory.
-string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR  "${LLDB_DOTEST_ARGS}")
-# We need this to substitute variables.
+# We need configure_file to substitute variables.
 configure_file(
   lldb-dotest.in
   ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
Index: lldb/trunk/test/lldb-dotest.in
===================================================================
--- lldb/trunk/test/lldb-dotest.in
+++ lldb/trunk/test/lldb-dotest.in
@@ -1,18 +1,16 @@
 #!/usr/bin/env python
+import subprocess
 import sys
-import os
 
 dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
+dotest_args_str = '@LLDB_DOTEST_ARGS@'
 
 if __name__ == '__main__':
-    # Wrap arguments in single quotes. This is necessary because we want to
-    # forward the arguments and otherwise we might split up arguments that were
-    # originally wrapped in single quotes.
-    wrapper_args = list("'" + i + "'" for i in sys.argv[1:])
-    # FIXME: It would be nice if we can mimic the approach taken by llvm-lit
-    # and pass a python configuration straight to dotest, rather than going
-    # through the operating system.
-    command = '{} -q {} {}'.format(dotest_path, dotest_args,
-                                   ' '.join(wrapper_args))
-    os.system(command)
+    wrapper_args = sys.argv[1:]
+    dotest_args = dotest_args_str.split(';')
+    # Build dotest.py command.
+    cmd = [dotest_path, '-q']
+    cmd.extend(dotest_args)
+    cmd.extend(wrapper_args)
+    # Invoke dotest.py
+    subprocess.call(cmd)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44728.139274.patch
Type: text/x-patch
Size: 1786 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180321/24a5bcc2/attachment.bin>


More information about the llvm-commits mailing list