forked from OSchip/llvm-project
Add MSan unit tests to check-msan and check-all.
llvm-svn: 171065
This commit is contained in:
parent
81b5a8fd2e
commit
a57662d7c4
|
@ -7,7 +7,6 @@ include_directories(..)
|
|||
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 @@ macro(add_msan_tests_for_arch arch)
|
|||
${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")
|
||||
|
|
|
@ -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
|
|
@ -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")
|
Loading…
Reference in New Issue