From 5f09d9e00a4fac27ebbffe6df54b867248c62289 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 15 Sep 2010 04:31:58 +0000 Subject: [PATCH] tests/lit: Split options into two groups, so we don't get driver warnings about unused linker arguments for compile only tests. llvm-svn: 113935 --- libcxx/test/lit.cfg | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libcxx/test/lit.cfg b/libcxx/test/lit.cfg index 87f6c8956af8..f70d595ab2e5 100644 --- a/libcxx/test/lit.cfg +++ b/libcxx/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