diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-03-21 11:13:56 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-03-21 11:13:56 +0000 |
commit | ecc8aee652d66dd2a9db575a66d13b477582bcb2 (patch) | |
tree | f0eecadc189f3353f65e11bceef38a9b62408799 | |
parent | 03a77e9a3909037e88d5479557a61275702b7f7c (diff) | |
download | bcm5719-llvm-ecc8aee652d66dd2a9db575a66d13b477582bcb2.tar.gz bcm5719-llvm-ecc8aee652d66dd2a9db575a66d13b477582bcb2.zip |
[dotest] Use subprocess.call to forward arguments in wrapper
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.
Differential revision: https://reviews.llvm.org/D44728
llvm-svn: 328089
-rw-r--r-- | lldb/test/CMakeLists.txt | 3 | ||||
-rwxr-xr-x | lldb/test/lldb-dotest.in | 22 |
2 files changed, 11 insertions, 14 deletions
diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt index 862bd4d7629..2bf7ff0d9b8 100644 --- a/lldb/test/CMakeLists.txt +++ b/lldb/test/CMakeLists.txt @@ -136,8 +136,7 @@ add_python_test_target(check-lldb ) # 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 diff --git a/lldb/test/lldb-dotest.in b/lldb/test/lldb-dotest.in index 08ae092d523..7e89e6226a4 100755 --- a/lldb/test/lldb-dotest.in +++ b/lldb/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) |