[compiler-rt] r201513 - Simplify defining Clang compile flags in lit configs
Alexey Samsonov
samsonov at google.com
Mon Feb 17 05:08:10 PST 2014
Author: samsonov
Date: Mon Feb 17 07:08:10 2014
New Revision: 201513
URL: http://llvm.org/viewvc/llvm-project?rev=201513&view=rev
Log:
Simplify defining Clang compile flags in lit configs
Modified:
compiler-rt/trunk/test/asan/lit.cfg
compiler-rt/trunk/test/dfsan/lit.cfg
compiler-rt/trunk/test/lsan/AsanConfig/lit.cfg
compiler-rt/trunk/test/lsan/LsanConfig/lit.cfg
compiler-rt/trunk/test/lsan/lit.common.cfg
compiler-rt/trunk/test/msan/lit.cfg
compiler-rt/trunk/test/tsan/lit.cfg
compiler-rt/trunk/test/ubsan/AsanConfig/lit.cfg
compiler-rt/trunk/test/ubsan/UbsanConfig/lit.cfg
compiler-rt/trunk/test/ubsan/lit.common.cfg
Modified: compiler-rt/trunk/test/asan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/lit.cfg?rev=201513&r1=201512&r2=201513&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/lit.cfg (original)
+++ compiler-rt/trunk/test/asan/lit.cfg Mon Feb 17 07:08:10 2014
@@ -19,14 +19,14 @@ config.test_source_root = os.path.dirnam
# Setup default compiler flags used with -fsanitize=address option.
# FIXME: Review the set of required flags and check if it can be reduced.
-target_cflags = " " + config.target_cflags
-clang_asan_cflags = (" -fsanitize=address"
- + " -mno-omit-leaf-frame-pointer"
- + " -fno-omit-frame-pointer"
- + " -fno-optimize-sibling-calls"
- + " -g"
- + target_cflags)
-clang_asan_cxxflags = " --driver-mode=g++" + clang_asan_cflags
+target_cflags = [get_required_attr(config, "target_cflags")]
+target_cxxflags = ["--driver-mode=g++"] + target_cflags
+clang_asan_cflags = ["-fsanitize=address",
+ "-mno-omit-leaf-frame-pointer",
+ "-fno-omit-frame-pointer",
+ "-fno-optimize-sibling-calls",
+ "-g"] + target_cflags
+clang_asan_cxxflags = ["--driver-mode=g++"] + clang_asan_cflags
asan_lit_source_dir = get_required_attr(config, "asan_lit_source_dir")
if config.android == "TRUE":
@@ -36,15 +36,13 @@ if config.android == "TRUE":
else:
clang_wrapper = ""
-config.substitutions.append( ("%clang ", " " + clang_wrapper + config.clang + target_cflags + " "))
-config.substitutions.append( ("%clangxx ", (" " + clang_wrapper + config.clang +
- " --driver-mode=g++" +
- target_cflags + " ")) )
-config.substitutions.append( ("%clang_asan ", (" " + clang_wrapper + config.clang + " " +
- clang_asan_cflags + " ")) )
-config.substitutions.append( ("%clangxx_asan ", (" " + clang_wrapper + config.clang + " " +
- clang_asan_cxxflags + " ")) )
+def build_invocation(compile_flags):
+ return " " + " ".join([clang_wrapper, config.clang] + compile_flags) + " "
+config.substitutions.append( ("%clang ", build_invocation(target_cflags)) )
+config.substitutions.append( ("%clangxx ", build_invocation(target_cxxflags)) )
+config.substitutions.append( ("%clang_asan ", build_invocation(clang_asan_cflags)) )
+config.substitutions.append( ("%clangxx_asan ", build_invocation(clang_asan_cxxflags)) )
# FIXME: De-hardcode this path.
asan_source_dir = os.path.join(
Modified: compiler-rt/trunk/test/dfsan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/dfsan/lit.cfg?rev=201513&r1=201512&r2=201513&view=diff
==============================================================================
--- compiler-rt/trunk/test/dfsan/lit.cfg (original)
+++ compiler-rt/trunk/test/dfsan/lit.cfg Mon Feb 17 07:08:10 2014
@@ -10,13 +10,13 @@ config.test_source_root = os.path.dirnam
# Setup default compiler flags used with -fsanitize=dataflow option.
clang_dfsan_cflags = ["-fsanitize=dataflow"]
-clang_dfsan_cxxflags = ["--driver-mode=g++ "] + clang_dfsan_cflags
-config.substitutions.append( ("%clang_dfsan ",
- " ".join([config.clang] + clang_dfsan_cflags) +
- " ") )
-config.substitutions.append( ("%clangxx_dfsan ",
- " ".join([config.clang] + clang_dfsan_cxxflags) +
- " ") )
+clang_dfsan_cxxflags = ["--driver-mode=g++"] + clang_dfsan_cflags
+
+def build_invocation(compile_flags):
+ return " " + " ".join([config.clang] + compile_flags) + " "
+
+config.substitutions.append( ("%clang_dfsan ", build_invocation(clang_dfsan_cflags)) )
+config.substitutions.append( ("%clangxx_dfsan ", build_invocation(clang_dfsan_cxxflags)) )
# Default test suffixes.
config.suffixes = ['.c', '.cc', '.cpp']
Modified: compiler-rt/trunk/test/lsan/AsanConfig/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/AsanConfig/lit.cfg?rev=201513&r1=201512&r2=201513&view=diff
==============================================================================
--- compiler-rt/trunk/test/lsan/AsanConfig/lit.cfg (original)
+++ compiler-rt/trunk/test/lsan/AsanConfig/lit.cfg Mon Feb 17 07:08:10 2014
@@ -21,14 +21,13 @@ config.available_features.add('asan')
config.name = 'LeakSanitizer-AddressSanitizer'
-clang_lsan_cxxflags = config.clang_cxxflags + " -fsanitize=address "
+def build_invocation(compile_flags):
+ return " " + " ".join([config.clang] + compile_flags) + " "
-config.substitutions.append( ("%clangxx_lsan ", (" " + config.clang + " " +
- clang_lsan_cxxflags + " ")) )
+clang_lsan_cflags = config.clang_cflags + ["-fsanitize=address"]
+clang_lsan_cxxflags = config.clang_cxxflags + ["-fsanitize=address"]
-clang_lsan_cflags = config.clang_cflags + " -fsanitize=address "
-
-config.substitutions.append( ("%clang_lsan ", (" " + config.clang + " " +
- clang_lsan_cflags + " ")) )
+config.substitutions.append( ("%clang_lsan ", build_invocation(clang_lsan_cflags)) )
+config.substitutions.append( ("%clangxx_lsan ", build_invocation(clang_lsan_cxxflags)) )
config.environment['ASAN_OPTIONS'] = 'detect_leaks=1'
Modified: compiler-rt/trunk/test/lsan/LsanConfig/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/LsanConfig/lit.cfg?rev=201513&r1=201512&r2=201513&view=diff
==============================================================================
--- compiler-rt/trunk/test/lsan/LsanConfig/lit.cfg (original)
+++ compiler-rt/trunk/test/lsan/LsanConfig/lit.cfg Mon Feb 17 07:08:10 2014
@@ -19,12 +19,11 @@ lit_config.load_config(config, lsan_lit_
config.name = 'LeakSanitizer-Standalone'
-clang_lsan_cxxflags = config.clang_cxxflags + " -fsanitize=leak "
+def build_invocation(compile_flags):
+ return " " + " ".join([config.clang] + compile_flags) + " "
-config.substitutions.append( ("%clangxx_lsan ", (" " + config.clang + " " +
- clang_lsan_cxxflags + " ")) )
+clang_lsan_cflags = config.clang_cflags + ["-fsanitize=leak"]
+clang_lsan_cxxflags = config.clang_cxxflags + ["-fsanitize=leak"]
-clang_lsan_cflags = config.clang_cflags + " -fsanitize=leak "
-
-config.substitutions.append( ("%clang_lsan ", (" " + config.clang + " " +
- clang_lsan_cflags + " ")) )
+config.substitutions.append( ("%clang_lsan ", build_invocation(clang_lsan_cflags)) )
+config.substitutions.append( ("%clangxx_lsan ", build_invocation(clang_lsan_cxxflags)) )
Modified: compiler-rt/trunk/test/lsan/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/lit.common.cfg?rev=201513&r1=201512&r2=201513&view=diff
==============================================================================
--- compiler-rt/trunk/test/lsan/lit.common.cfg (original)
+++ compiler-rt/trunk/test/lsan/lit.common.cfg Mon Feb 17 07:08:10 2014
@@ -17,24 +17,17 @@ def get_required_attr(config, attr_name)
lsan_lit_src_root = get_required_attr(config, 'lsan_lit_src_root')
config.test_source_root = os.path.join(lsan_lit_src_root, 'TestCases')
-clang_cxxflags = ("--driver-mode=g++ "
- + "-g "
- + "-O0 "
- + "-m64 ")
-
-clang_cflags = ("-g "
- + "-O0 "
- + "-m64 ")
+clang_cflags = ["-g", "-O0", "-m64"]
+clang_cxxflags = ["--driver-mode=g++"] + clang_cflags
+config.clang_cflags = clang_cflags
config.clang_cxxflags = clang_cxxflags
-config.substitutions.append( ("%clangxx ", (" " + config.clang + " " +
- clang_cxxflags + " ")) )
-
-config.clang_cflags = clang_cflags
+def build_invocation(compile_flags):
+ return " " + " ".join([config.clang] + compile_flags) + " "
-config.substitutions.append( ("%clang ", (" " + config.clang + " " +
- clang_cflags + " ")) )
+config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) )
+config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )
# LeakSanitizer tests are currently supported on x86-64 Linux only.
if config.host_os not in ['Linux'] or config.host_arch not in ['x86_64']:
Modified: compiler-rt/trunk/test/msan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/lit.cfg?rev=201513&r1=201512&r2=201513&view=diff
==============================================================================
--- compiler-rt/trunk/test/msan/lit.cfg (original)
+++ compiler-rt/trunk/test/msan/lit.cfg Mon Feb 17 07:08:10 2014
@@ -15,13 +15,13 @@ clang_msan_cflags = ["-fsanitize=memory"
"-fno-optimize-sibling-calls",
"-g",
"-m64"]
-clang_msan_cxxflags = ["--driver-mode=g++ "] + clang_msan_cflags
-config.substitutions.append( ("%clang_msan ",
- " ".join([config.clang] + clang_msan_cflags) +
- " ") )
-config.substitutions.append( ("%clangxx_msan ",
- " ".join([config.clang] + clang_msan_cxxflags) +
- " ") )
+clang_msan_cxxflags = ["--driver-mode=g++"] + clang_msan_cflags
+
+def build_invocation(compile_flags):
+ return " " + " ".join([config.clang] + compile_flags) + " "
+
+config.substitutions.append( ("%clang_msan ", build_invocation(clang_msan_cflags)) )
+config.substitutions.append( ("%clangxx_msan ", build_invocation(clang_msan_cxxflags)) )
# Default test suffixes.
config.suffixes = ['.c', '.cc', '.cpp']
Modified: compiler-rt/trunk/test/tsan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/lit.cfg?rev=201513&r1=201512&r2=201513&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/lit.cfg (original)
+++ compiler-rt/trunk/test/tsan/lit.cfg Mon Feb 17 07:08:10 2014
@@ -24,17 +24,19 @@ config.environment['TSAN_OPTIONS'] = tsa
# Setup default compiler flags used with -fsanitize=thread option.
# FIXME: Review the set of required flags and check if it can be reduced.
-clang_tsan_cflags = ("-fsanitize=thread "
- + "-g "
- + "-Wall "
- + "-lpthread "
- + "-ldl "
- + "-m64 ")
-clang_tsan_cxxflags = "--driver-mode=g++ " + clang_tsan_cflags
-config.substitutions.append( ("%clangxx_tsan ", (" " + config.clang + " " +
- clang_tsan_cxxflags + " ")) )
-config.substitutions.append( ("%clang_tsan ", (" " + config.clang + " " +
- clang_tsan_cflags + " ")) )
+clang_tsan_cflags = ["-fsanitize=thread",
+ "-g",
+ "-Wall",
+ "-lpthread",
+ "-ldl",
+ "-m64"]
+clang_tsan_cxxflags = ["--driver-mode=g++"] + clang_tsan_cflags
+
+def build_invocation(compile_flags):
+ return " " + " ".join([config.clang] + compile_flags) + " "
+
+config.substitutions.append( ("%clang_tsan ", build_invocation(clang_tsan_cflags)) )
+config.substitutions.append( ("%clangxx_tsan ", build_invocation(clang_tsan_cxxflags)) )
# Define CHECK-%os to check for OS-dependent output.
config.substitutions.append( ('CHECK-%os', ("CHECK-" + config.host_os)))
Modified: compiler-rt/trunk/test/ubsan/AsanConfig/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/AsanConfig/lit.cfg?rev=201513&r1=201512&r2=201513&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/AsanConfig/lit.cfg (original)
+++ compiler-rt/trunk/test/ubsan/AsanConfig/lit.cfg Mon Feb 17 07:08:10 2014
@@ -17,9 +17,12 @@ lit_config.load_config(config, ubsan_lit
config.name = 'UndefinedBehaviorSanitizer-AddressSanitizer'
+def build_invocation(compile_flags):
+ return " " + " ".join([config.clang] + compile_flags) + " "
+
+clang_ubsan_cflags = ["-fsanitize=address"]
+clang_ubsan_cxxflags = ["--driver-mode=g++"] + clang_ubsan_cflags
+
# Define %clang and %clangxx substitutions to use in test RUN lines.
-config.substitutions.append( ("%clang ", (" " + config.clang +
- " -fsanitize=address ")) )
-config.substitutions.append( ("%clangxx ", (" " + config.clang +
- " -fsanitize=address" +
- " --driver-mode=g++ ")) )
+config.substitutions.append( ("%clang ", build_invocation(clang_ubsan_cflags)) )
+config.substitutions.append( ("%clangxx ", build_invocation(clang_ubsan_cxxflags)) )
Modified: compiler-rt/trunk/test/ubsan/UbsanConfig/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/UbsanConfig/lit.cfg?rev=201513&r1=201512&r2=201513&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/UbsanConfig/lit.cfg (original)
+++ compiler-rt/trunk/test/ubsan/UbsanConfig/lit.cfg Mon Feb 17 07:08:10 2014
@@ -17,7 +17,12 @@ lit_config.load_config(config, ubsan_lit
config.name = 'UndefinedBehaviorSanitizer-Standalone'
+def build_invocation(compile_flags):
+ return " " + " ".join([config.clang] + compile_flags) + " "
+
+clang_ubsan_cflags = []
+clang_ubsan_cxxflags = ["--driver-mode=g++"] + clang_ubsan_cflags
+
# Define %clang and %clangxx substitutions to use in test RUN lines.
-config.substitutions.append( ("%clang ", (" " + config.clang + " ")) )
-config.substitutions.append( ("%clangxx ", (" " + config.clang +
- " --driver-mode=g++ ")) )
+config.substitutions.append( ("%clang ", build_invocation(clang_ubsan_cflags)) )
+config.substitutions.append( ("%clangxx ", build_invocation(clang_ubsan_cxxflags)) )
Modified: compiler-rt/trunk/test/ubsan/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/lit.common.cfg?rev=201513&r1=201512&r2=201513&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/lit.common.cfg (original)
+++ compiler-rt/trunk/test/ubsan/lit.common.cfg Mon Feb 17 07:08:10 2014
@@ -15,11 +15,6 @@ def get_required_attr(config, attr_name)
ubsan_lit_tests_dir = get_required_attr(config, 'ubsan_lit_tests_dir')
config.test_source_root = os.path.join(ubsan_lit_tests_dir, 'TestCases')
-def DisplayNoConfigMessage():
- lit_config.fatal("No site specific configuration available! " +
- "Try running your test from the build tree or running " +
- "make check-ubsan")
-
# Default test suffixes.
config.suffixes = ['.c', '.cc', '.cpp']
More information about the llvm-commits
mailing list