JDevlieghere created this revision.
JDevlieghere added reviewers: labath, vsk.
Herald added subscribers: llvm-commits, mgorny.

As suggested by Pavel on lldb-commits. Originally I picked os.system because it 
was so much more simple than the subprocess module, but that no longer holds 
true after yesterday's hack in r328020. This is what it should've been in the 
first place.


Repository:
  rL LLVM

https://reviews.llvm.org/D44728

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


Index: test/lldb-dotest.in
===================================================================
--- test/lldb-dotest.in
+++ test/lldb-dotest.in
@@ -1,18 +1,16 @@
 #!/usr/bin/env python
 import sys
-import os
+import subprocess
 
 dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
+dotest_args_str = '@LLDB_DOTEST_ARGS_STR@'
 
 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(';')[:-1]
+    # Build dotest.py command.
+    cmd = [dotest_path, '-q']
+    cmd.extend(dotest_args)
+    cmd.extend(wrapper_args)
+    # Invoke dotest.py
+    subprocess.call(cmd)
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -135,8 +135,6 @@
   "Testing LLDB (parallel execution, with a separate subprocess per test)"
   )
 
-# 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.
 configure_file(
   lldb-dotest.in


Index: test/lldb-dotest.in
===================================================================
--- test/lldb-dotest.in
+++ test/lldb-dotest.in
@@ -1,18 +1,16 @@
 #!/usr/bin/env python
 import sys
-import os
+import subprocess
 
 dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
+dotest_args_str = '@LLDB_DOTEST_ARGS_STR@'
 
 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(';')[:-1]
+    # Build dotest.py command.
+    cmd = [dotest_path, '-q']
+    cmd.extend(dotest_args)
+    cmd.extend(wrapper_args)
+    # Invoke dotest.py
+    subprocess.call(cmd)
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -135,8 +135,6 @@
   "Testing LLDB (parallel execution, with a separate subprocess per test)"
   )
 
-# 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.
 configure_file(
   lldb-dotest.in
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to