summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-06-04 04:23:20 +0000
committerBill Wendling <isanbard@gmail.com>2013-06-04 04:23:20 +0000
commit55865eeccc746f4cf917fe6543fb0c854af11c96 (patch)
tree65548d5101fdfd2c4feacea471efb5700f9c12bb
parent593c75f55d496290b5e039bff4ecfd192ffacc5e (diff)
downloadllvm-55865eeccc746f4cf917fe6543fb0c854af11c96.tar.gz
Merge r182726:
Improve support for compiler-rt tests in CMake build. Now compiler-rt tests run correctly if compiler-rt is checked out into arbitrary directory (not necessarily projects/compiler-rt). Patch by Greg Fitzgerald! llvm-svn: 183180
-rw-r--r--compiler-rt/lib/asan/lit_tests/Unit/lit.cfg5
-rw-r--r--compiler-rt/lib/asan/lit_tests/Unit/lit.site.cfg.in1
-rw-r--r--compiler-rt/lib/asan/lit_tests/lit.cfg21
-rw-r--r--compiler-rt/lib/asan/lit_tests/lit.site.cfg.in1
-rw-r--r--compiler-rt/lib/msan/lit_tests/Unit/lit.cfg5
-rw-r--r--compiler-rt/lib/msan/lit_tests/Unit/lit.site.cfg.in1
-rw-r--r--compiler-rt/lib/msan/lit_tests/lit.cfg21
-rw-r--r--compiler-rt/lib/msan/lit_tests/lit.site.cfg.in1
-rw-r--r--compiler-rt/lib/sanitizer_common/tests/lit.cfg5
-rw-r--r--compiler-rt/lib/sanitizer_common/tests/lit.site.cfg.in1
-rw-r--r--compiler-rt/lib/tsan/lit_tests/Unit/lit.cfg5
-rw-r--r--compiler-rt/lib/tsan/lit_tests/Unit/lit.site.cfg.in1
-rw-r--r--compiler-rt/lib/tsan/lit_tests/lit.cfg21
-rw-r--r--compiler-rt/lib/tsan/lit_tests/lit.site.cfg.in1
-rw-r--r--compiler-rt/lib/ubsan/lit_tests/lit.cfg21
-rw-r--r--compiler-rt/lib/ubsan/lit_tests/lit.site.cfg.in1
16 files changed, 60 insertions, 52 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/Unit/lit.cfg b/compiler-rt/lib/asan/lit_tests/Unit/lit.cfg
index 243eb7fbeec0..e24361b014e9 100644
--- a/compiler-rt/lib/asan/lit_tests/Unit/lit.cfg
+++ b/compiler-rt/lib/asan/lit_tests/Unit/lit.cfg
@@ -11,9 +11,8 @@ def get_required_attr(config, attr_name):
return attr_value
# Setup attributes common for all compiler-rt projects.
-llvm_src_root = get_required_attr(config, 'llvm_src_root')
-compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",
- "compiler-rt", "lib",
+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)
diff --git a/compiler-rt/lib/asan/lit_tests/Unit/lit.site.cfg.in b/compiler-rt/lib/asan/lit_tests/Unit/lit.site.cfg.in
index 07584a6fdf32..315d24d1ed09 100644
--- a/compiler-rt/lib/asan/lit_tests/Unit/lit.site.cfg.in
+++ b/compiler-rt/lib/asan/lit_tests/Unit/lit.site.cfg.in
@@ -3,6 +3,7 @@
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.asan_binary_dir = "@ASAN_BINARY_DIR@"
diff --git a/compiler-rt/lib/asan/lit_tests/lit.cfg b/compiler-rt/lib/asan/lit_tests/lit.cfg
index 7875281b1f2f..5daecd9e557d 100644
--- a/compiler-rt/lib/asan/lit_tests/lit.cfg
+++ b/compiler-rt/lib/asan/lit_tests/lit.cfg
@@ -2,6 +2,14 @@
import os
+def get_required_attr(config, attr_name):
+ attr_value = getattr(config, attr_name, None)
+ if not attr_value:
+ lit.fatal("No attribute %r in test configuration! You may need to run "
+ "tests from your build directory or add this attribute "
+ "to lit.site.cfg " % attr_name)
+ return attr_value
+
# Setup config name.
config.name = 'AddressSanitizer'
@@ -30,14 +38,6 @@ if llvm_src_root is None:
if not llvm_config:
DisplayNoConfigMessage()
- # Validate that llvm-config points to the same source tree.
- llvm_src_root = lit.util.capture(["llvm-config", "--src-root"]).strip()
- asan_test_src_root = os.path.join(llvm_src_root, "projects", "compiler-rt",
- "lib", "asan", "lit_tests")
- if (os.path.realpath(asan_test_src_root) !=
- os.path.realpath(config.test_source_root)):
- DisplayNoConfigMessage()
-
# Find out the presumed location of generated site config.
llvm_obj_root = lit.util.capture(["llvm-config", "--obj-root"]).strip()
asan_site_cfg = os.path.join(llvm_obj_root, "projects", "compiler-rt",
@@ -49,8 +49,9 @@ if llvm_src_root is None:
raise SystemExit
# Setup attributes common for all compiler-rt projects.
-compiler_rt_lit_cfg = os.path.join(llvm_src_root, "projects", "compiler-rt",
- "lib", "lit.common.cfg")
+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)
diff --git a/compiler-rt/lib/asan/lit_tests/lit.site.cfg.in b/compiler-rt/lib/asan/lit_tests/lit.site.cfg.in
index cf439309c6ad..a57a8fbe0c95 100644
--- a/compiler-rt/lib/asan/lit_tests/lit.site.cfg.in
+++ b/compiler-rt/lib/asan/lit_tests/lit.site.cfg.in
@@ -5,6 +5,7 @@ config.target_triple = "@TARGET_TRIPLE@"
config.host_os = "@HOST_OS@"
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
+config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.clang = "@LLVM_BINARY_DIR@/bin/clang"
diff --git a/compiler-rt/lib/msan/lit_tests/Unit/lit.cfg b/compiler-rt/lib/msan/lit_tests/Unit/lit.cfg
index afb30e0a855d..ee379d0deaed 100644
--- a/compiler-rt/lib/msan/lit_tests/Unit/lit.cfg
+++ b/compiler-rt/lib/msan/lit_tests/Unit/lit.cfg
@@ -11,9 +11,8 @@ def get_required_attr(config, attr_name):
return attr_value
# Setup attributes common for all compiler-rt projects.
-llvm_src_root = get_required_attr(config, 'llvm_src_root')
-compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",
- "compiler-rt", "lib",
+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)
diff --git a/compiler-rt/lib/msan/lit_tests/Unit/lit.site.cfg.in b/compiler-rt/lib/msan/lit_tests/Unit/lit.site.cfg.in
index 4ae84c42d718..a91f6713303a 100644
--- a/compiler-rt/lib/msan/lit_tests/Unit/lit.site.cfg.in
+++ b/compiler-rt/lib/msan/lit_tests/Unit/lit.site.cfg.in
@@ -3,6 +3,7 @@
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@"
diff --git a/compiler-rt/lib/msan/lit_tests/lit.cfg b/compiler-rt/lib/msan/lit_tests/lit.cfg
index e220c38ff17b..42381885fe8e 100644
--- a/compiler-rt/lib/msan/lit_tests/lit.cfg
+++ b/compiler-rt/lib/msan/lit_tests/lit.cfg
@@ -2,6 +2,14 @@
import os
+def get_required_attr(config, attr_name):
+ attr_value = getattr(config, attr_name, None)
+ if not attr_value:
+ lit.fatal("No attribute %r in test configuration! You may need to run "
+ "tests from your build directory or add this attribute "
+ "to lit.site.cfg " % attr_name)
+ return attr_value
+
# Setup config name.
config.name = 'MemorySanitizer'
@@ -30,14 +38,6 @@ if llvm_src_root is None:
if not llvm_config:
DisplayNoConfigMessage()
- # Validate that llvm-config points to the same source tree.
- llvm_src_root = lit.util.capture(["llvm-config", "--src-root"]).strip()
- msan_test_src_root = os.path.join(llvm_src_root, "projects", "compiler-rt",
- "lib", "msan", "lit_tests")
- if (os.path.realpath(msan_test_src_root) !=
- os.path.realpath(config.test_source_root)):
- DisplayNoConfigMessage()
-
# Find out the presumed location of generated site config.
llvm_obj_root = lit.util.capture(["llvm-config", "--obj-root"]).strip()
msan_site_cfg = os.path.join(llvm_obj_root, "projects", "compiler-rt",
@@ -49,8 +49,9 @@ if llvm_src_root is None:
raise SystemExit
# Setup attributes common for all compiler-rt projects.
-compiler_rt_lit_cfg = os.path.join(llvm_src_root, "projects", "compiler-rt",
- "lib", "lit.common.cfg")
+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)
diff --git a/compiler-rt/lib/msan/lit_tests/lit.site.cfg.in b/compiler-rt/lib/msan/lit_tests/lit.site.cfg.in
index cc7c7a0ecac9..3b969e0b0614 100644
--- a/compiler-rt/lib/msan/lit_tests/lit.site.cfg.in
+++ b/compiler-rt/lib/msan/lit_tests/lit.site.cfg.in
@@ -1,6 +1,7 @@
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"
diff --git a/compiler-rt/lib/sanitizer_common/tests/lit.cfg b/compiler-rt/lib/sanitizer_common/tests/lit.cfg
index d774753985ac..303d56c91079 100644
--- a/compiler-rt/lib/sanitizer_common/tests/lit.cfg
+++ b/compiler-rt/lib/sanitizer_common/tests/lit.cfg
@@ -11,9 +11,8 @@ def get_required_attr(config, attr_name):
return attr_value
# Setup attributes common for all compiler-rt projects.
-llvm_src_root = get_required_attr(config, 'llvm_src_root')
-compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",
- "compiler-rt", "lib",
+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)
diff --git a/compiler-rt/lib/sanitizer_common/tests/lit.site.cfg.in b/compiler-rt/lib/sanitizer_common/tests/lit.site.cfg.in
index ad0ff3c01a80..50485aa16ec2 100644
--- a/compiler-rt/lib/sanitizer_common/tests/lit.site.cfg.in
+++ b/compiler-rt/lib/sanitizer_common/tests/lit.site.cfg.in
@@ -3,6 +3,7 @@
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_build_mode = "@LLVM_BUILD_MODE@"
try:
diff --git a/compiler-rt/lib/tsan/lit_tests/Unit/lit.cfg b/compiler-rt/lib/tsan/lit_tests/Unit/lit.cfg
index 6688697c0c1b..0a0dbbfa5495 100644
--- a/compiler-rt/lib/tsan/lit_tests/Unit/lit.cfg
+++ b/compiler-rt/lib/tsan/lit_tests/Unit/lit.cfg
@@ -11,9 +11,8 @@ def get_required_attr(config, attr_name):
return attr_value
# Setup attributes common for all compiler-rt projects.
-llvm_src_root = get_required_attr(config, 'llvm_src_root')
-compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",
- "compiler-rt", "lib",
+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)
diff --git a/compiler-rt/lib/tsan/lit_tests/Unit/lit.site.cfg.in b/compiler-rt/lib/tsan/lit_tests/Unit/lit.site.cfg.in
index 420cdcaa60ae..6eedc2180876 100644
--- a/compiler-rt/lib/tsan/lit_tests/Unit/lit.site.cfg.in
+++ b/compiler-rt/lib/tsan/lit_tests/Unit/lit.site.cfg.in
@@ -3,6 +3,7 @@
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@"
diff --git a/compiler-rt/lib/tsan/lit_tests/lit.cfg b/compiler-rt/lib/tsan/lit_tests/lit.cfg
index a2206cc7036a..d483d2fcbdc6 100644
--- a/compiler-rt/lib/tsan/lit_tests/lit.cfg
+++ b/compiler-rt/lib/tsan/lit_tests/lit.cfg
@@ -2,6 +2,14 @@
import os
+def get_required_attr(config, attr_name):
+ attr_value = getattr(config, attr_name, None)
+ if not attr_value:
+ lit.fatal("No attribute %r in test configuration! You may need to run "
+ "tests from your build directory or add this attribute "
+ "to lit.site.cfg " % attr_name)
+ return attr_value
+
# Setup config name.
config.name = 'ThreadSanitizer'
@@ -30,14 +38,6 @@ if llvm_src_root is None:
if not llvm_config:
DisplayNoConfigMessage()
- # Validate that llvm-config points to the same source tree.
- llvm_src_root = lit.util.capture(["llvm-config", "--src-root"]).strip()
- tsan_test_src_root = os.path.join(llvm_src_root, "projects", "compiler-rt",
- "lib", "tsan", "lit_tests")
- if (os.path.realpath(tsan_test_src_root) !=
- os.path.realpath(config.test_source_root)):
- DisplayNoConfigMessage()
-
# Find out the presumed location of generated site config.
llvm_obj_root = lit.util.capture(["llvm-config", "--obj-root"]).strip()
tsan_site_cfg = os.path.join(llvm_obj_root, "projects", "compiler-rt",
@@ -49,8 +49,9 @@ if llvm_src_root is None:
raise SystemExit
# Setup attributes common for all compiler-rt projects.
-compiler_rt_lit_cfg = os.path.join(llvm_src_root, "projects", "compiler-rt",
- "lib", "lit.common.cfg")
+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)
diff --git a/compiler-rt/lib/tsan/lit_tests/lit.site.cfg.in b/compiler-rt/lib/tsan/lit_tests/lit.site.cfg.in
index b1c6ccf544ea..07b521af061f 100644
--- a/compiler-rt/lib/tsan/lit_tests/lit.site.cfg.in
+++ b/compiler-rt/lib/tsan/lit_tests/lit.site.cfg.in
@@ -4,6 +4,7 @@
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@"
diff --git a/compiler-rt/lib/ubsan/lit_tests/lit.cfg b/compiler-rt/lib/ubsan/lit_tests/lit.cfg
index 9fd3a1aeaa16..ea6ebdf9001f 100644
--- a/compiler-rt/lib/ubsan/lit_tests/lit.cfg
+++ b/compiler-rt/lib/ubsan/lit_tests/lit.cfg
@@ -2,6 +2,14 @@
import os
+def get_required_attr(config, attr_name):
+ attr_value = getattr(config, attr_name, None)
+ if not attr_value:
+ lit.fatal("No attribute %r in test configuration! You may need to run "
+ "tests from your build directory or add this attribute "
+ "to lit.site.cfg " % attr_name)
+ return attr_value
+
# Setup config name.
config.name = 'UndefinedBehaviorSanitizer'
@@ -30,14 +38,6 @@ if llvm_src_root is None:
if not llvm_config:
DisplayNoConfigMessage()
- # Validate that llvm-config points to the same source tree.
- llvm_src_root = lit.util.capture(["llvm-config", "--src-root"]).strip()
- ubsan_test_src_root = os.path.join(llvm_src_root, "projects", "compiler-rt",
- "lib", "ubsan", "lit_tests")
- if (os.path.realpath(ubsan_test_src_root) !=
- os.path.realpath(config.test_source_root)):
- DisplayNoConfigMessage()
-
# Find out the presumed location of generated site config.
llvm_obj_root = lit.util.capture(["llvm-config", "--obj-root"]).strip()
ubsan_site_cfg = os.path.join(llvm_obj_root, "projects", "compiler-rt",
@@ -49,8 +49,9 @@ if llvm_src_root is None:
raise SystemExit
# Setup attributes common for all compiler-rt projects.
-compiler_rt_lit_cfg = os.path.join(llvm_src_root, "projects", "compiler-rt",
- "lib", "lit.common.cfg")
+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)
diff --git a/compiler-rt/lib/ubsan/lit_tests/lit.site.cfg.in b/compiler-rt/lib/ubsan/lit_tests/lit.site.cfg.in
index b1c6ccf544ea..07b521af061f 100644
--- a/compiler-rt/lib/ubsan/lit_tests/lit.site.cfg.in
+++ b/compiler-rt/lib/ubsan/lit_tests/lit.site.cfg.in
@@ -4,6 +4,7 @@
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@"