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
This commit is contained in:
parent
26a43c25d7
commit
611581b853
19
test/lit.cfg
19
test/lit.cfg
@ -18,9 +18,10 @@ class LibcxxTestFormat(lit.formats.FileBasedTest):
|
||||
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 @@ class LibcxxTestFormat(lit.formats.FileBasedTest):
|
||||
# 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 @@ class LibcxxTestFormat(lit.formats.FileBasedTest):
|
||||
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 @@ class LibcxxTestFormat(lit.formats.FileBasedTest):
|
||||
|
||||
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 @@ if cxx_under_test is None:
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user