aboutsummaryrefslogtreecommitdiff
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.zip
llvm-55865eeccc746f4cf917fe6543fb0c854af11c96.tar.gz
llvm-55865eeccc746f4cf917fe6543fb0c854af11c96.tar.bz2
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 243eb7f..e24361b 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 07584a6..315d24d 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 7875281..5daecd9 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 cf439309..a57a8fb 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 afb30e0..ee379d0 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 4ae84c4..a91f671 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 e220c38..4238188 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 cc7c7a0..3b969e0 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 d774753..303d56c 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 ad0ff3c..50485aa 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 6688697..0a0dbbf 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 420cdca..6eedc21 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 a2206cc..d483d2f 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 b1c6ccf..07b521a 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 9fd3a1a..ea6ebdf 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 b1c6ccf..07b521a 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@"