Move ASan lit-tests under test/asan

llvm-svn: 201413
This commit is contained in:
Alexey Samsonov 2014-02-14 14:06:10 +00:00
parent 8434e60f7e
commit 9f20d67034
155 changed files with 80 additions and 113 deletions

View File

@ -231,6 +231,7 @@ endif()
# support only subset of these (e.g. TSan works on x86_64 only).
filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
x86_64 i386 powerpc64 arm)
filter_available_targets(ASAN_SUPPORTED_ARCH x86_64 i386 powerpc64)
filter_available_targets(DFSAN_SUPPORTED_ARCH x86_64)
filter_available_targets(LSAN_SUPPORTED_ARCH x86_64)
filter_available_targets(MSAN_SUPPORTED_ARCH x86_64)
@ -259,6 +260,6 @@ endif()
add_subdirectory(lib)
if(LLVM_INCLUDE_TESTS)
add_subdirectory(test)
add_subdirectory(unittests)
endif()
add_subdirectory(test)

View File

@ -46,10 +46,6 @@ if(ANDROID)
ASAN_LOW_MEMORY=1)
endif()
# Architectures supported by ASan.
filter_available_targets(ASAN_SUPPORTED_ARCH
x86_64 i386 powerpc64)
# Compile ASan sources into an object library.
if(APPLE)
foreach(os ${SANITIZER_COMMON_SUPPORTED_DARWIN_OS})
@ -145,5 +141,3 @@ add_custom_target(asan_runtime_libraries
if(LLVM_INCLUDE_TESTS)
add_subdirectory(tests)
endif()
add_subdirectory(lit_tests)

View File

@ -1,65 +0,0 @@
set(ASAN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
set(ASAN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/..)
if(COMPILER_RT_CAN_EXECUTE_TESTS)
set(ASAN_TESTSUITES)
if(CAN_TARGET_arm_android)
# This is only true if we are cross-compiling.
# Build all tests with host compiler and use host tools.
set(ASAN_TEST_TARGET_CC ${CMAKE_C_COMPILER})
get_filename_component(ASAN_TEST_LLVM_TOOLS_DIR ${CMAKE_C_COMPILER} PATH)
set(ASAN_TEST_CONFIG_SUFFIX "-arm-android")
set(ASAN_TEST_BITS "32")
get_target_flags_for_arch(arm_android ASAN_TEST_TARGET_CFLAGS)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/GenericConfig/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/ARMAndroidConfig/lit.site.cfg
)
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/ARMAndroidConfig)
endif()
if(CAN_TARGET_x86_64 OR CAN_TARGET_powerpc64)
set(ASAN_TEST_CONFIG_SUFFIX "64")
set(ASAN_TEST_BITS "64")
set(ASAN_TEST_TARGET_CFLAGS ${TARGET_64_BIT_CFLAGS})
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/GenericConfig/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/64bitConfig/lit.site.cfg
)
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/64bitConfig)
endif()
if(CAN_TARGET_i386)
set(ASAN_TEST_CONFIG_SUFFIX "32")
set(ASAN_TEST_BITS "32")
set(ASAN_TEST_TARGET_CFLAGS ${TARGET_32_BIT_CFLAGS})
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/GenericConfig/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/32bitConfig/lit.site.cfg
)
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/32bitConfig)
endif()
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
)
# Run ASan tests only if we're sure we may produce working binaries.
set(ASAN_TEST_DEPS
${SANITIZER_COMMON_LIT_TEST_DEPS}
asan_runtime_libraries)
set(ASAN_TEST_PARAMS
asan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
# FIXME: support unit test in the android test runner
if(LLVM_INCLUDE_TESTS AND NOT CAN_TARGET_arm_android)
list(APPEND ASAN_TEST_DEPS AsanUnitTests)
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit)
endif()
add_lit_testsuite(check-asan "Running the AddressSanitizer tests"
${ASAN_TESTSUITES}
PARAMS ${ASAN_TEST_PARAMS}
DEPENDS ${ASAN_TEST_DEPS})
set_target_properties(check-asan PROPERTIES FOLDER "ASan tests")
endif()

View File

@ -9,6 +9,9 @@ configure_lit_site_cfg(
# Run sanitizer tests only if we're sure that clang would produce
# working binaries.
if(COMPILER_RT_CAN_EXECUTE_TESTS)
if(ASAN_SUPPORTED_ARCH)
add_subdirectory(asan)
endif()
if(DFSAN_SUPPORTED_ARCH)
add_subdirectory(dfsan)
endif()

View File

@ -0,0 +1,64 @@
set(ASAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(ASAN_TESTSUITES)
if(CAN_TARGET_arm_android)
# This is only true if we are cross-compiling.
# Build all tests with host compiler and use host tools.
set(ASAN_TEST_TARGET_CC ${CMAKE_C_COMPILER})
get_filename_component(ASAN_TEST_LLVM_TOOLS_DIR ${CMAKE_C_COMPILER} PATH)
set(ASAN_TEST_CONFIG_SUFFIX "-arm-android")
set(ASAN_TEST_BITS "32")
get_target_flags_for_arch(arm_android ASAN_TEST_TARGET_CFLAGS)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/GenericConfig/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/ARMAndroidConfig/lit.site.cfg
)
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/ARMAndroidConfig)
endif()
if(CAN_TARGET_x86_64 OR CAN_TARGET_powerpc64)
set(ASAN_TEST_CONFIG_SUFFIX "64")
set(ASAN_TEST_BITS "64")
set(ASAN_TEST_TARGET_CFLAGS ${TARGET_64_BIT_CFLAGS})
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/GenericConfig/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/64bitConfig/lit.site.cfg
)
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/64bitConfig)
endif()
if(CAN_TARGET_i386)
set(ASAN_TEST_CONFIG_SUFFIX "32")
set(ASAN_TEST_BITS "32")
set(ASAN_TEST_TARGET_CFLAGS ${TARGET_32_BIT_CFLAGS})
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/GenericConfig/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/32bitConfig/lit.site.cfg
)
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/32bitConfig)
endif()
if(LLVM_INCLUDE_TESTS)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
)
endif()
# Run ASan tests only if we're sure we may produce working binaries.
set(ASAN_TEST_DEPS
${SANITIZER_COMMON_LIT_TEST_DEPS}
asan_runtime_libraries)
set(ASAN_TEST_PARAMS
asan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
# FIXME: support unit test in the android test runner
if(LLVM_INCLUDE_TESTS AND NOT CAN_TARGET_arm_android)
list(APPEND ASAN_TEST_DEPS AsanUnitTests)
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit)
endif()
add_lit_testsuite(check-asan "Running the AddressSanitizer tests"
${ASAN_TESTSUITES}
PARAMS ${ASAN_TEST_PARAMS}
DEPENDS ${ASAN_TEST_DEPS})
set_target_properties(check-asan PROPERTIES FOLDER "ASan tests")

View File

@ -3,7 +3,7 @@
# Tool-specific config options.
config.name_suffix = "@ASAN_TEST_CONFIG_SUFFIX@"
config.asan_source_dir = "@ASAN_SOURCE_DIR@"
config.asan_lit_source_dir = "@ASAN_LIT_SOURCE_DIR@"
config.target_cflags = "@ASAN_TEST_TARGET_CFLAGS@"
config.clang = "@ASAN_TEST_TARGET_CC@"
config.llvm_tools_dir = "@ASAN_TEST_LLVM_TOOLS_DIR@"
@ -14,4 +14,4 @@ config.android = "@CAN_TARGET_arm_android@"
lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
# Load tool-specific config that would do the real work.
lit_config.load_config(config, "@ASAN_SOURCE_DIR@/lit_tests/lit.cfg")
lit_config.load_config(config, "@ASAN_LIT_SOURCE_DIR@/lit.cfg")

View File

@ -15,7 +15,7 @@
// RUN: | grep -v "__asan_default_options" \
// RUN: | grep -v "__asan_on_error" > %t.symbols
// RUN: cat %p/../../../asan_interface_internal.h \
// RUN: cat %p/../../../../lib/asan/asan_interface_internal.h \
// RUN: | sed "s/\/\/.*//" | sed "s/typedef.*//" \
// RUN: | grep -v "OPTIONAL" \
// RUN: | grep "__asan_.*(" | sed "s/.* __asan_/__asan_/;s/(.*//" \

View File

@ -8,7 +8,7 @@
// RUN: | grep -v "__asan_default_options" \
// RUN: | grep -v "__asan_stack_" \
// RUN: | grep -v "__asan_on_error" > %t.symbols
// RUN: cat %p/../../../asan_interface_internal.h \
// RUN: cat %p/../../../../lib/asan/asan_interface_internal.h \
// RUN: | sed "s/\/\/.*//" | sed "s/typedef.*//" \
// RUN: | grep -v "OPTIONAL" \
// RUN: | grep "__asan_.*(" | sed "s/.* __asan_/__asan_/;s/(.*//" \

Some files were not shown because too many files have changed in this diff Show More