Index: test/lit.cfg |
diff --git a/test/lit.cfg b/test/lit.cfg |
index ec05d1c7cffd73f20b611d73ab539254726fdf50..62a8a28d2e4be85a99bd3a993774ffa97ac67943 100644 |
--- a/test/lit.cfg |
+++ b/test/lit.cfg |
@@ -29,12 +29,18 @@ class LibcxxTestFormat(lit.formats.FileBasedTest): |
""" |
def __init__(self, cxx_under_test, use_verify_for_fail, |
- cpp_flags, ld_flags, exec_env): |
+ cpp_flags, ld_flags, exec_env, |
+ # @LOCALMOD |
+ exe_suffix, shell_prefix): |
self.cxx_under_test = cxx_under_test |
self.use_verify_for_fail = use_verify_for_fail |
self.cpp_flags = list(cpp_flags) |
self.ld_flags = list(ld_flags) |
self.exec_env = dict(exec_env) |
+ # @LOCALMOD-START |
+ self.exe_suffix = exe_suffix |
+ self.shell_prefix = shell_prefix |
+ # @LOCALMOD-END |
def execute(self, test, lit_config): |
while True: |
@@ -116,6 +122,10 @@ class LibcxxTestFormat(lit.formats.FileBasedTest): |
cmd.extend('%s=%s' % (name, value) |
for name,value in self.exec_env.items()) |
cmd.append(exec_path) |
+ # @LOCALMOD-START |
+ if self.shell_prefix: |
+ cmd = self.shell_prefix + cmd |
+ # @LOCALMOD-END |
if lit_config.useValgrind: |
cmd = lit_config.valgrindArgs + cmd |
out, err, exitCode = lit.util.executeCommand(cmd, cwd=in_dir) |
@@ -149,7 +159,10 @@ class LibcxxTestFormat(lit.formats.FileBasedTest): |
report += "\n\nExpected compilation to fail!" |
return lit.Test.FAIL, report |
else: |
- exec_file = tempfile.NamedTemporaryFile(suffix="exe", delete=False) |
+ # @LOCALMOD-START |
+ exec_file = tempfile.NamedTemporaryFile( |
+ suffix=self.exe_suffix, delete=False) |
+ # @LOCALMOD-END |
exec_path = exec_file.name |
exec_file.close() |
@@ -195,6 +208,10 @@ class Configuration(object): |
def __init__(self, lit_config, config): |
self.lit_config = lit_config |
self.config = config |
+ # @LOCALMOD-START |
+ self.exe_suffix = None |
+ self.shell_prefix = None |
+ # @LOCALMOD-END |
self.cxx = None |
self.src_root = None |
self.obj_root = None |
@@ -227,6 +244,8 @@ class Configuration(object): |
"parameter '{}' should be true or false".format(name)) |
def configure(self): |
+ # @LOCALMOD |
+ self.configure_exe_wrappers() |
self.configure_cxx() |
self.configure_triple() |
self.configure_src_root() |
@@ -239,6 +258,13 @@ class Configuration(object): |
self.configure_link_flags() |
self.configure_sanitizer() |
self.configure_features() |
+ # @LOCALMOD-START -- filter out nostdinc++ and nodefaultlibs if needed. |
+ if self.use_system_lib: |
+ self.compile_flags = [flag for flag in self.compile_flags |
+ if flag != '-nostdinc++'] |
+ self.link_flags = [flag for flag in self.link_flags |
+ if flag != '-nodefaultlibs'] |
+ # @LOCALMOD-END |
# Print the final compile and link flags. |
self.lit_config.note('Using compile flags: %s' % self.compile_flags) |
self.lit_config.note('Using link flags: %s' % self.link_flags) |
@@ -252,7 +278,21 @@ class Configuration(object): |
self.use_clang_verify, |
cpp_flags=self.compile_flags, |
ld_flags=self.link_flags, |
- exec_env=self.env) |
+ exec_env=self.env, |
+ # @LOCALMOD |
+ exe_suffix=self.exe_suffix, |
+ shell_prefix=self.shell_prefix) |
+ |
+ # @LOCALMOD-START |
+ def configure_exe_wrappers(self): |
+ # Allow customizing the resulting executable's suffix |
+ # as well as an wrapper around how to run the executable |
+ # via a shell_prefix. |
+ self.exe_suffix = self.get_lit_conf('exe_suffix', 'exe') |
+ self.shell_prefix = self.get_lit_conf('shell_prefix', None) |
+ if self.shell_prefix: |
+ self.shell_prefix = shlex.split(self.shell_prefix) |
+ # @LOCALMOD-END |
def configure_cxx(self): |
# Gather various compiler parameters. |