summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-11-16 10:16:14 +0000
committerAlexey Samsonov <samsonov@google.com>2012-11-16 10:16:14 +0000
commit038e3489d9669ba05dae613ddd3b573740b49b49 (patch)
tree431eeeae9908dc4a3d2f3b0a9737a2478347d2b6 /compiler-rt/lib
parentcc8990f6294f065d3006614337f3e9e9b9fc464d (diff)
downloadbcm5719-llvm-038e3489d9669ba05dae613ddd3b573740b49b49.tar.gz
bcm5719-llvm-038e3489d9669ba05dae613ddd3b573740b49b49.zip
[TSan] use llvm-symbolizer to run tsan tests
llvm-svn: 168146
Diffstat (limited to 'compiler-rt/lib')
-rw-r--r--compiler-rt/lib/tsan/lit_tests/CMakeLists.txt4
-rw-r--r--compiler-rt/lib/tsan/lit_tests/Unit/lit.cfg8
-rw-r--r--compiler-rt/lib/tsan/lit_tests/Unit/lit.site.cfg.in9
-rw-r--r--compiler-rt/lib/tsan/lit_tests/lit.cfg9
4 files changed, 27 insertions, 3 deletions
diff --git a/compiler-rt/lib/tsan/lit_tests/CMakeLists.txt b/compiler-rt/lib/tsan/lit_tests/CMakeLists.txt
index 1958ebf5781..6dc90e2367f 100644
--- a/compiler-rt/lib/tsan/lit_tests/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/lit_tests/CMakeLists.txt
@@ -12,7 +12,7 @@ if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}")
# Run TSan output tests only if we're not cross-compiling,
# and can be sure that clang would produce working binaries.
set(TSAN_TEST_DEPS
- clang clang-headers FileCheck count not
+ clang clang-headers FileCheck count not llvm-symbolizer
${TSAN_RUNTIME_LIBRARIES}
)
set(TSAN_TEST_PARAMS
@@ -31,6 +31,6 @@ elseif(LLVM_INCLUDE_TESTS)
# Otherwise run only TSan unit tests.
add_lit_testsuite(check-tsan "Running ThreadSanitizer tests"
${CMAKE_CURRENT_BINARY_DIR}/Unit
- DEPENDS TsanUnitTests)
+ DEPENDS TsanUnitTests llvm-symbolizer)
set_target_properties(check-tsan PROPERTIES FOLDER "TSan unittests")
endif()
diff --git a/compiler-rt/lib/tsan/lit_tests/Unit/lit.cfg b/compiler-rt/lib/tsan/lit_tests/Unit/lit.cfg
index 2fba57670c3..6688697c0c1 100644
--- a/compiler-rt/lib/tsan/lit_tests/Unit/lit.cfg
+++ b/compiler-rt/lib/tsan/lit_tests/Unit/lit.cfg
@@ -27,3 +27,11 @@ config.test_exec_root = os.path.join(llvm_obj_root, "projects",
"compiler-rt", "lib",
"tsan", "tests")
config.test_source_root = config.test_exec_root
+
+# Get path to external LLVM symbolizer to run ThreadSanitizer unit tests.
+llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
+if llvm_tools_dir:
+ llvm_symbolizer_path = os.path.join(llvm_tools_dir, "llvm-symbolizer")
+ config.environment['TSAN_OPTIONS'] = ("external_symbolizer_path=" +
+ llvm_symbolizer_path)
+
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 38c24bc2192..23654b9be2e 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
@@ -4,6 +4,15 @@
config.build_type = "@CMAKE_BUILD_TYPE@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
+
+# 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.
lit.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/Unit/lit.cfg")
diff --git a/compiler-rt/lib/tsan/lit_tests/lit.cfg b/compiler-rt/lib/tsan/lit_tests/lit.cfg
index 3a29edc5102..7e2db7b8fd0 100644
--- a/compiler-rt/lib/tsan/lit_tests/lit.cfg
+++ b/compiler-rt/lib/tsan/lit_tests/lit.cfg
@@ -57,7 +57,14 @@ if (not compiler_rt_lit_cfg) or (not os.path.exists(compiler_rt_lit_cfg)):
lit.load_config(config, compiler_rt_lit_cfg)
# Setup environment variables for running ThreadSanitizer.
-config.environment['TSAN_OPTIONS'] = "atexit_sleep_ms=0"
+tsan_options = "atexit_sleep_ms=0"
+# Get path to external LLVM symbolizer to run ThreadSanitizer output tests.
+llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
+if llvm_tools_dir:
+ llvm_symbolizer_path = os.path.join(llvm_tools_dir, "llvm-symbolizer")
+ tsan_options += " " + "external_symbolizer_path=" + llvm_symbolizer_path
+
+config.environment['TSAN_OPTIONS'] = tsan_options
# Setup default compiler flags used with -fsanitize=thread option.
# FIXME: Review the set of required flags and check if it can be reduced.
OpenPOWER on IntegriCloud