summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-06-06 13:28:37 +0000
committerAlexey Samsonov <samsonov@google.com>2013-06-06 13:28:37 +0000
commitad785cb2d7f2ab80d2f6bfd7f05d4898807592ad (patch)
tree7d5e22eca51072fa7cd1f5f4d051ff16b42cf6b6
parent4a95e33cbfe350c50f6d2c224f7d1b036d680382 (diff)
downloadcompiler-rt-ad785cb2d7f2ab80d2f6bfd7f05d4898807592ad.tar.gz
compiler-rt-ad785cb2d7f2ab80d2f6bfd7f05d4898807592ad.tar.bz2
compiler-rt-ad785cb2d7f2ab80d2f6bfd7f05d4898807592ad.tar.xz
Remove a bunch of copy-paste: use common config for sanitizer lit/unit tests
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@183407 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/lit.common.configured.in2
-rw-r--r--lib/lit.common.unit.configured.in5
-rw-r--r--lib/lsan/lit_tests/AsanConfig/lit.site.cfg.in23
-rw-r--r--lib/lsan/lit_tests/LsanConfig/lit.site.cfg.in23
-rw-r--r--lib/lsan/lit_tests/Unit/lit.cfg6
-rw-r--r--lib/lsan/lit_tests/Unit/lit.site.cfg.in16
-rw-r--r--lib/lsan/lit_tests/lit.common.cfg8
-rw-r--r--lib/msan/lit_tests/Unit/lit.cfg6
-rw-r--r--lib/msan/lit_tests/Unit/lit.site.cfg.in16
-rw-r--r--lib/msan/lit_tests/lit.cfg9
-rw-r--r--lib/msan/lit_tests/lit.site.cfg.in19
-rw-r--r--lib/tsan/lit_tests/Unit/lit.cfg6
-rw-r--r--lib/tsan/lit_tests/Unit/lit.site.cfg.in18
-rw-r--r--lib/tsan/lit_tests/lit.cfg9
-rw-r--r--lib/tsan/lit_tests/lit.site.cfg.in18
-rw-r--r--lib/ubsan/lit_tests/lit.cfg9
-rw-r--r--lib/ubsan/lit_tests/lit.site.cfg.in18
17 files changed, 39 insertions, 172 deletions
diff --git a/lib/lit.common.configured.in b/lib/lit.common.configured.in
index 5ca9b1bd..f7c29f62 100644
--- a/lib/lit.common.configured.in
+++ b/lib/lit.common.configured.in
@@ -3,7 +3,9 @@
# Generic config options for all compiler-rt lit tests.
config.target_triple = "@TARGET_TRIPLE@"
+config.host_arch = "@HOST_ARCH@"
config.host_os = "@HOST_OS@"
+config.llvm_build_mode = "@LLVM_BUILD_MODE@"
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
diff --git a/lib/lit.common.unit.configured.in b/lib/lit.common.unit.configured.in
index c726bba2..1eac25b2 100644
--- a/lib/lit.common.unit.configured.in
+++ b/lib/lit.common.unit.configured.in
@@ -4,10 +4,15 @@
# Generic config options for all compiler-rt unit tests.
config.target_triple = "@TARGET_TRIPLE@"
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
+config.llvm_obj_root = "@LLVM_BINARY_DIR@"
+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
config.llvm_build_mode = "@LLVM_BUILD_MODE@"
+# LLVM tools dir and build mode can be passed in lit parameters,
+# so try to apply substitution.
try:
+ config.llvm_tools_dir = config.llvm_tools_dir % lit.params
config.llvm_build_mode = config.llvm_build_mode % lit.params
except KeyError,e:
key, = e.args
diff --git a/lib/lsan/lit_tests/AsanConfig/lit.site.cfg.in b/lib/lsan/lit_tests/AsanConfig/lit.site.cfg.in
index d57c67d6..4557d790 100644
--- a/lib/lsan/lit_tests/AsanConfig/lit.site.cfg.in
+++ b/lib/lsan/lit_tests/AsanConfig/lit.site.cfg.in
@@ -1,21 +1,8 @@
-config.host_os = "@HOST_OS@"
-config.host_arch = "@HOST_ARCH@"
-config.llvm_build_mode = "@LLVM_BUILD_MODE@"
-config.llvm_src_root = "@LLVM_SOURCE_DIR@"
-config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
-config.llvm_obj_root = "@LLVM_BINARY_DIR@"
-config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
-config.clang = "@LLVM_BINARY_DIR@/bin/clang"
-config.compiler_rt_arch = "@COMPILER_RT_SUPPORTED_ARCH@"
-config.lsan_lit_src_root = "@LSAN_LIT_SOURCE_DIR@"
+# Load common config for all compiler-rt lit tests.
+lit.load_config(config, "@COMPILER_RT_BINARY_DIR@/lib/lit.common.configured")
-# LLVM tools dir can be passed in lit parameters, so try to
-# apply substitution.
-try:
- config.llvm_tools_dir = config.llvm_tools_dir % lit.params
-except KeyError,e:
- key, = e.args
- lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
+# Tool-specific config options.
+config.lsan_lit_src_root = "@LSAN_LIT_SOURCE_DIR@"
-# Let the main config do the real work.
+# Load tool-specific config that would do the real work.
lit.load_config(config, "@LSAN_LIT_SOURCE_DIR@/AsanConfig/lit.cfg")
diff --git a/lib/lsan/lit_tests/LsanConfig/lit.site.cfg.in b/lib/lsan/lit_tests/LsanConfig/lit.site.cfg.in
index 2aa93319..8bc5c41b 100644
--- a/lib/lsan/lit_tests/LsanConfig/lit.site.cfg.in
+++ b/lib/lsan/lit_tests/LsanConfig/lit.site.cfg.in
@@ -1,21 +1,8 @@
-config.host_os = "@HOST_OS@"
-config.host_arch = "@HOST_ARCH@"
-config.llvm_build_mode = "@LLVM_BUILD_MODE@"
-config.llvm_src_root = "@LLVM_SOURCE_DIR@"
-config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
-config.llvm_obj_root = "@LLVM_BINARY_DIR@"
-config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
-config.clang = "@LLVM_BINARY_DIR@/bin/clang"
-config.compiler_rt_arch = "@COMPILER_RT_SUPPORTED_ARCH@"
-config.lsan_lit_src_root = "@LSAN_LIT_SOURCE_DIR@"
+# Load common config for all compiler-rt lit tests.
+lit.load_config(config, "@COMPILER_RT_BINARY_DIR@/lib/lit.common.configured")
-# LLVM tools dir can be passed in lit parameters, so try to
-# apply substitution.
-try:
- config.llvm_tools_dir = config.llvm_tools_dir % lit.params
-except KeyError,e:
- key, = e.args
- lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
+# Tool-specific config options.
+config.lsan_lit_src_root = "@LSAN_LIT_SOURCE_DIR@"
-# Let the main config do the real work.
+# Load tool-specific config that would do the real work.
lit.load_config(config, "@LSAN_LIT_SOURCE_DIR@/LsanConfig/lit.cfg")
diff --git a/lib/lsan/lit_tests/Unit/lit.cfg b/lib/lsan/lit_tests/Unit/lit.cfg
index bcd1de44..46b36122 100644
--- a/lib/lsan/lit_tests/Unit/lit.cfg
+++ b/lib/lsan/lit_tests/Unit/lit.cfg
@@ -10,12 +10,6 @@ def get_required_attr(config, attr_name):
"to lit.site.cfg " % attr_name)
return attr_value
-# Setup attributes common for all compiler-rt projects.
-compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
-compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",
- "lit.common.unit.cfg")
-lit.load_config(config, compiler_rt_lit_unit_cfg)
-
# Setup config name.
config.name = 'LeakSanitizer-Unit'
diff --git a/lib/lsan/lit_tests/Unit/lit.site.cfg.in b/lib/lsan/lit_tests/Unit/lit.site.cfg.in
index 90c88c95..f4a554c1 100644
--- a/lib/lsan/lit_tests/Unit/lit.site.cfg.in
+++ b/lib/lsan/lit_tests/Unit/lit.site.cfg.in
@@ -1,17 +1,11 @@
## Autogenerated by LLVM/Clang configuration.
# Do not edit!
-config.target_triple = "@TARGET_TRIPLE@"
-config.llvm_src_root = "@LLVM_SOURCE_DIR@"
-config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
-config.llvm_build_mode = "@LLVM_BUILD_MODE@"
-config.lsan_binary_dir = "@LSAN_BINARY_DIR@"
+# Load common config for all compiler-rt unit tests.
+lit.load_config(config, "@COMPILER_RT_BINARY_DIR@/lib/lit.common.unit.configured")
-try:
- config.llvm_build_mode = config.llvm_build_mode % lit.params
-except KeyError,e:
- key, = e.args
- lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
+# Tool-specific config options.
+config.lsan_binary_dir = "@LSAN_BINARY_DIR@"
-# Let the main config do the real work.
+# Load tool-specific config that would do the real work.
lit.load_config(config, "@LSAN_SOURCE_DIR@/lit_tests/Unit/lit.cfg")
diff --git a/lib/lsan/lit_tests/lit.common.cfg b/lib/lsan/lit_tests/lit.common.cfg
index b3edc9bb..dfae8db4 100644
--- a/lib/lsan/lit_tests/lit.common.cfg
+++ b/lib/lsan/lit_tests/lit.common.cfg
@@ -16,14 +16,6 @@ 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')
-# Setup attributes common for all compiler-rt projects.
-compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
-compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib", "lit.common.cfg")
-if (not compiler_rt_lit_cfg) or (not os.path.exists(compiler_rt_lit_cfg)):
- lit.fatal("Can't find common compiler-rt lit config at: %r"
- % compiler_rt_lit_cfg)
-lit.load_config(config, compiler_rt_lit_cfg)
-
clang_cxxflags = ("-ccc-cxx "
+ "-g "
+ "-O0 "
diff --git a/lib/msan/lit_tests/Unit/lit.cfg b/lib/msan/lit_tests/Unit/lit.cfg
index ee379d0d..0b8043aa 100644
--- a/lib/msan/lit_tests/Unit/lit.cfg
+++ b/lib/msan/lit_tests/Unit/lit.cfg
@@ -10,12 +10,6 @@ def get_required_attr(config, attr_name):
"to lit.site.cfg " % attr_name)
return attr_value
-# Setup attributes common for all compiler-rt projects.
-compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
-compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",
- "lit.common.unit.cfg")
-lit.load_config(config, compiler_rt_lit_unit_cfg)
-
# Setup config name.
config.name = 'MemorySanitizer-Unit'
diff --git a/lib/msan/lit_tests/Unit/lit.site.cfg.in b/lib/msan/lit_tests/Unit/lit.site.cfg.in
index a91f6713..370b1a07 100644
--- a/lib/msan/lit_tests/Unit/lit.site.cfg.in
+++ b/lib/msan/lit_tests/Unit/lit.site.cfg.in
@@ -1,17 +1,11 @@
## Autogenerated by LLVM/Clang configuration.
# Do not edit!
-config.target_triple = "@TARGET_TRIPLE@"
-config.llvm_src_root = "@LLVM_SOURCE_DIR@"
-config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
-config.llvm_build_mode = "@LLVM_BUILD_MODE@"
-config.msan_binary_dir = "@MSAN_BINARY_DIR@"
+# Load common config for all compiler-rt unit tests.
+lit.load_config(config, "@COMPILER_RT_BINARY_DIR@/lib/lit.common.unit.configured")
-try:
- config.llvm_build_mode = config.llvm_build_mode % lit.params
-except KeyError,e:
- key, = e.args
- lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
+# Tool-specific config options.
+config.msan_binary_dir = "@MSAN_BINARY_DIR@"
-# Let the main config do the real work.
+# Load tool-specific config that would do the real work.
lit.load_config(config, "@MSAN_SOURCE_DIR@/lit_tests/Unit/lit.cfg")
diff --git a/lib/msan/lit_tests/lit.cfg b/lib/msan/lit_tests/lit.cfg
index 42381885..e047a261 100644
--- a/lib/msan/lit_tests/lit.cfg
+++ b/lib/msan/lit_tests/lit.cfg
@@ -48,15 +48,6 @@ if llvm_src_root is None:
lit.load_config(config, msan_site_cfg)
raise SystemExit
-# Setup attributes common for all compiler-rt projects.
-compiler_rt_src_root = get_required_attr(config, "compiler_rt_src_root")
-compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib",
- "lit.common.cfg")
-if (not compiler_rt_lit_cfg) or (not os.path.exists(compiler_rt_lit_cfg)):
- lit.fatal("Can't find common compiler-rt lit config at: %r"
- % compiler_rt_lit_cfg)
-lit.load_config(config, compiler_rt_lit_cfg)
-
# Setup default compiler flags used with -fsanitize=memory option.
clang_msan_cflags = ["-fsanitize=memory",
"-mno-omit-leaf-frame-pointer",
diff --git a/lib/msan/lit_tests/lit.site.cfg.in b/lib/msan/lit_tests/lit.site.cfg.in
index 3b969e0b..25d378fa 100644
--- a/lib/msan/lit_tests/lit.site.cfg.in
+++ b/lib/msan/lit_tests/lit.site.cfg.in
@@ -1,18 +1,5 @@
-config.target_triple = "@TARGET_TRIPLE@"
-config.host_os = "@HOST_OS@"
-config.llvm_src_root = "@LLVM_SOURCE_DIR@"
-config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
-config.llvm_obj_root = "@LLVM_BINARY_DIR@"
-config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
-config.clang = "@LLVM_BINARY_DIR@/bin/clang"
+# Load common config for all compiler-rt lit tests.
+lit.load_config(config, "@COMPILER_RT_BINARY_DIR@/lib/lit.common.configured")
-# LLVM tools dir can be passed in lit parameters, so try to
-# apply substitution.
-try:
- config.llvm_tools_dir = config.llvm_tools_dir % lit.params
-except KeyError,e:
- key, = e.args
- lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
-
-# Let the main config do the real work.
+# Load tool-specific config that would do the real work.
lit.load_config(config, "@MSAN_SOURCE_DIR@/lit_tests/lit.cfg")
diff --git a/lib/tsan/lit_tests/Unit/lit.cfg b/lib/tsan/lit_tests/Unit/lit.cfg
index 0a0dbbfa..1b8d1758 100644
--- a/lib/tsan/lit_tests/Unit/lit.cfg
+++ b/lib/tsan/lit_tests/Unit/lit.cfg
@@ -10,12 +10,6 @@ def get_required_attr(config, attr_name):
"to lit.site.cfg " % attr_name)
return attr_value
-# Setup attributes common for all compiler-rt projects.
-compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
-compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",
- "lit.common.unit.cfg")
-lit.load_config(config, compiler_rt_lit_unit_cfg)
-
# Setup config name.
config.name = 'ThreadSanitizer-Unit'
diff --git a/lib/tsan/lit_tests/Unit/lit.site.cfg.in b/lib/tsan/lit_tests/Unit/lit.site.cfg.in
index 6eedc218..964da91e 100644
--- a/lib/tsan/lit_tests/Unit/lit.site.cfg.in
+++ b/lib/tsan/lit_tests/Unit/lit.site.cfg.in
@@ -1,20 +1,8 @@
## Autogenerated by LLVM/Clang configuration.
# Do not edit!
-config.llvm_obj_root = "@LLVM_BINARY_DIR@"
-config.llvm_src_root = "@LLVM_SOURCE_DIR@"
-config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
-config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
-config.llvm_build_mode = "@LLVM_BUILD_MODE@"
+# Load common config for all compiler-rt unit tests.
+lit.load_config(config, "@COMPILER_RT_BINARY_DIR@/lib/lit.common.unit.configured")
-# LLVM tools dir can be passed in lit parameters, so try to
-# apply substitution.
-try:
- config.llvm_tools_dir = config.llvm_tools_dir % lit.params
- config.llvm_build_mode = config.llvm_build_mode % lit.params
-except KeyError,e:
- key, = e.args
- lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
-
-# Let the main config do the real work.
+# Load tool-specific config that would do the real work.
lit.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/Unit/lit.cfg")
diff --git a/lib/tsan/lit_tests/lit.cfg b/lib/tsan/lit_tests/lit.cfg
index d483d2fc..6dc46543 100644
--- a/lib/tsan/lit_tests/lit.cfg
+++ b/lib/tsan/lit_tests/lit.cfg
@@ -48,15 +48,6 @@ if llvm_src_root is None:
lit.load_config(config, tsan_site_cfg)
raise SystemExit
-# Setup attributes common for all compiler-rt projects.
-compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
-compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib",
- "lit.common.cfg")
-if (not compiler_rt_lit_cfg) or (not os.path.exists(compiler_rt_lit_cfg)):
- lit.fatal("Can't find common compiler-rt lit config at: %r"
- % compiler_rt_lit_cfg)
-lit.load_config(config, compiler_rt_lit_cfg)
-
# Setup environment variables for running ThreadSanitizer.
tsan_options = "atexit_sleep_ms=0"
# Get path to external LLVM symbolizer to run ThreadSanitizer output tests.
diff --git a/lib/tsan/lit_tests/lit.site.cfg.in b/lib/tsan/lit_tests/lit.site.cfg.in
index 07b521af..a212393a 100644
--- a/lib/tsan/lit_tests/lit.site.cfg.in
+++ b/lib/tsan/lit_tests/lit.site.cfg.in
@@ -1,20 +1,8 @@
## Autogenerated by LLVM/Clang configuration.
# Do not edit!
-config.clang = "@LLVM_BINARY_DIR@/bin/clang"
-config.host_os = "@HOST_OS@"
-config.llvm_src_root = "@LLVM_SOURCE_DIR@"
-config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
-config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
-config.target_triple = "@TARGET_TRIPLE@"
+# Load common config for all compiler-rt lit tests.
+lit.load_config(config, "@COMPILER_RT_BINARY_DIR@/lib/lit.common.configured")
-# LLVM tools dir can be passed in lit parameters, so try to
-# apply substitution.
-try:
- config.llvm_tools_dir = config.llvm_tools_dir % lit.params
-except KeyError,e:
- key, = e.args
- lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
-
-# Let the main config do the real work.
+# Load tool-specific config that would do the real work.
lit.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg")
diff --git a/lib/ubsan/lit_tests/lit.cfg b/lib/ubsan/lit_tests/lit.cfg
index ea6ebdf9..fbefdf2d 100644
--- a/lib/ubsan/lit_tests/lit.cfg
+++ b/lib/ubsan/lit_tests/lit.cfg
@@ -48,15 +48,6 @@ if llvm_src_root is None:
lit.load_config(config, ubsan_site_cfg)
raise SystemExit
-# Setup attributes common for all compiler-rt projects.
-compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
-compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib",
- "lit.common.cfg")
-if not compiler_rt_lit_cfg or not os.path.exists(compiler_rt_lit_cfg):
- lit.fatal("Can't find common compiler-rt lit config at: %r"
- % compiler_rt_lit_cfg)
-lit.load_config(config, compiler_rt_lit_cfg)
-
# Default test suffixes.
config.suffixes = ['.c', '.cc', '.cpp']
diff --git a/lib/ubsan/lit_tests/lit.site.cfg.in b/lib/ubsan/lit_tests/lit.site.cfg.in
index 07b521af..a212393a 100644
--- a/lib/ubsan/lit_tests/lit.site.cfg.in
+++ b/lib/ubsan/lit_tests/lit.site.cfg.in
@@ -1,20 +1,8 @@
## Autogenerated by LLVM/Clang configuration.
# Do not edit!
-config.clang = "@LLVM_BINARY_DIR@/bin/clang"
-config.host_os = "@HOST_OS@"
-config.llvm_src_root = "@LLVM_SOURCE_DIR@"
-config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
-config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
-config.target_triple = "@TARGET_TRIPLE@"
+# Load common config for all compiler-rt lit tests.
+lit.load_config(config, "@COMPILER_RT_BINARY_DIR@/lib/lit.common.configured")
-# LLVM tools dir can be passed in lit parameters, so try to
-# apply substitution.
-try:
- config.llvm_tools_dir = config.llvm_tools_dir % lit.params
-except KeyError,e:
- key, = e.args
- lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
-
-# Let the main config do the real work.
+# Load tool-specific config that would do the real work.
lit.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg")