tests/lit: Split options into two groups, so we don't get driver warnings about
unused linker arguments for compile only tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113935 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/lit.cfg b/test/lit.cfg
index 87f6c89..f70d595 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -18,9 +18,10 @@
FOO.fail.cpp - Negative test case which is expected to fail compilation.
"""
- def __init__(self, cxx_under_test, options):
+ def __init__(self, cxx_under_test, cpp_flags, ld_flags):
self.cxx_under_test = cxx_under_test
- self.options = list(options)
+ self.cpp_flags = list(cpp_flags)
+ self.ld_flags = list(ld_flags)
def execute_command(self, command):
p = subprocess.Popen(command, stdin=subprocess.PIPE,
@@ -45,7 +46,7 @@
# If this is a compile (failure) test, build it and check for failure.
if expected_compile_fail:
cmd = [self.cxx_under_test, '-c',
- '-o', '/dev/null', source_path] + self.options
+ '-o', '/dev/null', source_path] + self.cpp_flags
out, err, exitCode = self.execute_command(cmd)
if exitCode == 1:
return lit.Test.PASS, ""
@@ -58,7 +59,7 @@
if err:
report += """Standard Error:\n--\n%s--""" % err
report += "\n\nExpected compilation to fail!"
- return Test.FAIL, report
+ return lit.Test.FAIL, report
else:
exec_file = tempfile.NamedTemporaryFile(suffix="exe", delete=False)
exec_path = exec_file.name
@@ -66,7 +67,7 @@
try:
cmd = [self.cxx_under_test, '-o', exec_path,
- source_path] + self.options
+ source_path] + self.cpp_flags + self.ld_flags
out, err, exitCode = self.execute_command(cmd)
if exitCode != 0:
report = """Command: %s\n""" % ' '.join(["'%s'" % a
@@ -113,9 +114,9 @@
lit.fatal('must specify user parameter cxx_under_test '
'(e.g., --param=cxx_under_test=clang++)')
config.test_format = LibcxxTestFormat(cxx_under_test,
- ['-nostdinc++',
- '-I/usr/include/c++/v1',
- '-nodefaultlibs', '-lc++',
- '-lSystem'])
+ cpp_flags = ['-nostdinc++',
+ '-I/usr/include/c++/v1'],
+ ld_flags = ['-nodefaultlibs', '-lc++',
+ '-lSystem'])
config.target_triple = None