[llvm-commits] [compiler-rt] r171065 - in /compiler-rt/trunk/lib/msan/tests: CMakeLists.txt lit.cfg lit.site.cfg.in

Evgeniy Stepanov eugeni.stepanov at gmail.com
Tue Dec 25 05:10:15 PST 2012


Author: eugenis
Date: Tue Dec 25 07:10:15 2012
New Revision: 171065

URL: http://llvm.org/viewvc/llvm-project?rev=171065&view=rev
Log:
Add MSan unit tests to check-msan and check-all.

Added:
    compiler-rt/trunk/lib/msan/tests/lit.cfg
    compiler-rt/trunk/lib/msan/tests/lit.site.cfg.in
Modified:
    compiler-rt/trunk/lib/msan/tests/CMakeLists.txt

Modified: compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/CMakeLists.txt?rev=171065&r1=171064&r2=171065&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/msan/tests/CMakeLists.txt Tue Dec 25 07:10:15 2012
@@ -7,7 +7,6 @@
 include_directories(../..)
 
 # Instrumented libcxx sources and build flags.
-# FIXME: only do this if libcxx is checked out.
 set(MSAN_LIBCXX_PATH ${LLVM_MAIN_SRC_DIR}/projects/libcxx)
 file(GLOB MSAN_LIBCXX_SOURCES ${MSAN_LIBCXX_PATH}/src/*.cpp)
 set(MSAN_LIBCXX_CFLAGS
@@ -146,8 +145,21 @@
                 ${MSAN_INST_LIBCXX} ${MSANDR_TEST_SO})
 endmacro()
 
-if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}" AND UNIX AND NOT ANDROID)
+if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}" AND UNIX AND NOT ANDROID
+   AND EXISTS ${MSAN_LIBCXX_PATH}/)
   if(CAN_TARGET_X86_64)
     add_msan_tests_for_arch(x86_64)
   endif()
 endif()
+
+# Run unittests as a part of lit testsuite.
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+  )
+
+add_lit_testsuite(check-msan "Running MemorySanitizer unittests"
+  ${CMAKE_CURRENT_BINARY_DIR}
+  DEPENDS MsanUnitTests
+  )
+set_target_properties(check-msan PROPERTIES FOLDER "MemorySanitizer unittests")

Added: compiler-rt/trunk/lib/msan/tests/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/lit.cfg?rev=171065&view=auto
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/lit.cfg (added)
+++ compiler-rt/trunk/lib/msan/tests/lit.cfg Tue Dec 25 07:10:15 2012
@@ -0,0 +1,29 @@
+# -*- Python -*-
+
+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 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",
+                                        "lit.common.unit.cfg")
+lit.load_config(config, compiler_rt_lit_unit_cfg)
+
+# Setup config name.
+config.name = 'MemorySanitizer'
+
+# Setup test source and exec root. For unit tests, we define
+# it as build directory with sanitizer_common unit tests.
+llvm_obj_root = get_required_attr(config, "llvm_obj_root")
+config.test_exec_root = os.path.join(llvm_obj_root, "projects",
+                                     "compiler-rt", "lib",
+                                     "msan", "tests")
+config.test_source_root = config.test_exec_root

Added: compiler-rt/trunk/lib/msan/tests/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/lit.site.cfg.in?rev=171065&view=auto
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/lit.site.cfg.in (added)
+++ compiler-rt/trunk/lib/msan/tests/lit.site.cfg.in Tue Dec 25 07:10:15 2012
@@ -0,0 +1,9 @@
+## Autogenerated by LLVM/Clang configuration.
+# Do not edit!
+
+config.build_type = "@CMAKE_BUILD_TYPE@"
+config.llvm_obj_root = "@LLVM_BINARY_DIR@"
+config.llvm_src_root = "@LLVM_SOURCE_DIR@"
+
+# Let the main config do the real work.
+lit.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg")





More information about the llvm-commits mailing list