[llvm-commits] [compiler-rt] r168146 - in /compiler-rt/trunk/lib/tsan/lit_tests: CMakeLists.txt Unit/lit.cfg Unit/lit.site.cfg.in lit.cfg

Alexey Samsonov samsonov at google.com
Fri Nov 16 02:16:14 PST 2012


Author: samsonov
Date: Fri Nov 16 04:16:14 2012
New Revision: 168146

URL: http://llvm.org/viewvc/llvm-project?rev=168146&view=rev
Log:
[TSan] use llvm-symbolizer to run tsan tests

Modified:
    compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt
    compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.cfg
    compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.site.cfg.in
    compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg

Modified: compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt?rev=168146&r1=168145&r2=168146&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt Fri Nov 16 04:16:14 2012
@@ -12,7 +12,7 @@
   # 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 @@
   # 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()

Modified: compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.cfg?rev=168146&r1=168145&r2=168146&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.cfg (original)
+++ compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.cfg Fri Nov 16 04:16:14 2012
@@ -27,3 +27,11 @@
                                      "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)
+

Modified: compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.site.cfg.in?rev=168146&r1=168145&r2=168146&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.site.cfg.in (original)
+++ compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.site.cfg.in Fri Nov 16 04:16:14 2012
@@ -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")

Modified: compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg?rev=168146&r1=168145&r2=168146&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg (original)
+++ compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg Fri Nov 16 04:16:14 2012
@@ -57,7 +57,14 @@
 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.





More information about the llvm-commits mailing list