[lit] Don't require semicolon separator

This patch removes the requirement for a semicolon as a separator when
passing arguments to lit. It relies on the shlex module that is part of
Python to do simple lexical analysis, similar to what happens in a Unix
shell.

llvm-svn: 336290
This commit is contained in:
Jonas Devlieghere 2018-07-04 17:14:52 +00:00
parent ad32d22e13
commit 12543bd023
2 changed files with 11 additions and 4 deletions

View File

@ -3,6 +3,7 @@
# Configuration file for the 'lit' test runner.
import os
import shlex
import lit.formats
@ -14,13 +15,20 @@ config.suffixes = ['.py']
# test_source_root: The root path where tests are located.
# test_exec_root: The root path where tests should be run.
config.test_source_root = os.path.join(config.lldb_src_root, 'packages','Python','lldbsuite','test')
config.test_source_root = os.path.join(config.lldb_src_root, 'packages',
'Python', 'lldbsuite', 'test')
config.test_exec_root = config.test_source_root
# Build dotest command.
dotest_cmd = [config.dotest_path, '-q']
dotest_cmd.extend(config.dotest_args_str.split(';'))
# We don't want to force users passing arguments to lit to use `;` as a
# separator. We use Python's simple lexical analyzer to turn the args into a
# list.
if config.dotest_lit_args_str:
dotest_cmd.extend(shlex.split(config.dotest_lit_args_str))
# Load LLDB test format.
sys.path.append(os.path.join(config.lldb_src_root, "lit", "Suite"))
import lldbtest

View File

@ -14,14 +14,13 @@ config.python_executable = "@PYTHON_EXECUTABLE@"
config.dotest_path = "@LLDB_SOURCE_DIR@/test/dotest.py"
config.dotest_args_str = "@LLDB_DOTEST_ARGS@"
config.lldb_disable_python = @LLDB_DISABLE_PYTHON@
config.dotest_lit_args_str = None
# Additional dotest arguments can be passed to lit by providing a
# semicolon-separates list: --param dotest-args="arg;arg".
dotest_lit_args_str = lit_config.params.get('dotest-args', None)
if dotest_lit_args_str:
config.dotest_args_str += ';'
config.dotest_args_str += dotest_lit_args_str
config.dotest_lit_args_str = dotest_lit_args_str
# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.