2012-06-25 20:57:43 +08:00
|
|
|
# Testing rules for AddressSanitizer.
|
|
|
|
#
|
|
|
|
# These are broken into two buckets. One set of tests directly interacts with
|
|
|
|
# the runtime library and checks its functionality. These are the
|
|
|
|
# no-instrumentation tests.
|
|
|
|
#
|
|
|
|
# Another group of tests relies upon the ability to compile the test with
|
|
|
|
# address sanitizer instrumentation pass. These tests form "integration" tests
|
|
|
|
# and have some elements of version skew -- they test the *host* compiler's
|
|
|
|
# instrumentation against the just-built runtime library.
|
|
|
|
|
|
|
|
include(CheckCXXCompilerFlag)
|
2012-12-19 20:33:39 +08:00
|
|
|
include(CompilerRTCompile)
|
2012-06-25 20:57:43 +08:00
|
|
|
|
|
|
|
include_directories(..)
|
|
|
|
include_directories(../..)
|
|
|
|
|
2012-12-21 22:04:52 +08:00
|
|
|
set(ASAN_UNITTEST_HEADERS
|
|
|
|
asan_mac_test.h
|
|
|
|
asan_test_config.h
|
|
|
|
asan_test_utils.h)
|
|
|
|
|
2012-06-28 21:12:07 +08:00
|
|
|
set(ASAN_UNITTEST_COMMON_CFLAGS
|
2014-03-24 21:29:20 +08:00
|
|
|
${COMPILER_RT_GTEST_CFLAGS}
|
2012-12-19 20:33:39 +08:00
|
|
|
-I${COMPILER_RT_SOURCE_DIR}/include
|
|
|
|
-I${COMPILER_RT_SOURCE_DIR}/lib
|
|
|
|
-I${COMPILER_RT_SOURCE_DIR}/lib/asan
|
2013-02-14 16:12:26 +08:00
|
|
|
-I${COMPILER_RT_SOURCE_DIR}/lib/sanitizer_common/tests
|
2014-05-28 16:38:13 +08:00
|
|
|
-fno-rtti
|
|
|
|
-O2
|
2012-06-28 21:12:07 +08:00
|
|
|
-Wno-format
|
2014-05-28 16:38:13 +08:00
|
|
|
-Werror=sign-compare)
|
2014-03-13 17:31:36 +08:00
|
|
|
append_if(COMPILER_RT_HAS_WNO_VARIADIC_MACROS_FLAG -Wno-variadic-macros ASAN_UNITTEST_COMMON_CFLAGS)
|
2012-09-12 20:07:36 +08:00
|
|
|
|
2014-05-28 16:38:13 +08:00
|
|
|
# -gline-tables-only must be enough for ASan, so use it if possible.
|
|
|
|
if(COMPILER_RT_TEST_COMPILER_ID MATCHES "Clang")
|
|
|
|
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -gline-tables-only)
|
|
|
|
else()
|
|
|
|
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -g)
|
|
|
|
endif()
|
|
|
|
|
2014-05-13 18:33:42 +08:00
|
|
|
if(MSVC)
|
|
|
|
# MSVC system headers and gtest use a lot of deprecated stuff.
|
|
|
|
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS
|
|
|
|
-Wno-deprecated-declarations)
|
|
|
|
|
2014-05-28 16:38:13 +08:00
|
|
|
# clang doesn't support exceptions on Windows yet.
|
2014-05-13 18:33:42 +08:00
|
|
|
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS
|
|
|
|
-D_HAS_EXCEPTIONS=0)
|
|
|
|
|
2014-05-28 16:38:13 +08:00
|
|
|
# We should teach clang to understand more pragmas.
|
2014-05-13 18:33:42 +08:00
|
|
|
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS
|
|
|
|
-Wno-unknown-pragmas
|
|
|
|
-Wno-undefined-inline)
|
|
|
|
endif()
|
|
|
|
|
2012-09-11 19:55:45 +08:00
|
|
|
# Use -D instead of definitions to please custom compile command.
|
2013-01-21 18:51:18 +08:00
|
|
|
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS
|
|
|
|
-DASAN_HAS_BLACKLIST=1
|
|
|
|
-DASAN_HAS_EXCEPTIONS=1
|
|
|
|
-DASAN_UAR=0)
|
2012-09-11 19:55:45 +08:00
|
|
|
|
2012-10-19 23:18:14 +08:00
|
|
|
set(ASAN_BLACKLIST_FILE "${CMAKE_CURRENT_SOURCE_DIR}/asan_test.ignore")
|
2012-06-29 18:23:31 +08:00
|
|
|
set(ASAN_UNITTEST_INSTRUMENTED_CFLAGS
|
|
|
|
${ASAN_UNITTEST_COMMON_CFLAGS}
|
2012-11-06 10:31:42 +08:00
|
|
|
-fsanitize=address
|
2013-01-22 18:30:17 +08:00
|
|
|
"-fsanitize-blacklist=${ASAN_BLACKLIST_FILE}"
|
2014-05-21 16:21:14 +08:00
|
|
|
-mllvm -asan-instrument-assembly
|
2012-06-29 18:23:31 +08:00
|
|
|
)
|
|
|
|
|
2014-05-13 18:33:42 +08:00
|
|
|
if(NOT MSVC)
|
2014-05-13 20:57:50 +08:00
|
|
|
list(APPEND ASAN_UNITTEST_COMMON_LINKFLAGS --driver-mode=g++)
|
2014-05-13 18:33:42 +08:00
|
|
|
endif()
|
|
|
|
|
2014-04-28 18:33:01 +08:00
|
|
|
# x86_64 FreeBSD 9.2 additionally requires libc++ to build the tests.
|
|
|
|
if(CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE")
|
|
|
|
list(APPEND ASAN_UNITTEST_COMMON_LINKFLAGS "-lc++")
|
|
|
|
endif()
|
|
|
|
|
2013-09-16 23:50:53 +08:00
|
|
|
# Unit tests on Mac depend on Foundation.
|
|
|
|
if(APPLE)
|
|
|
|
list(APPEND ASAN_UNITTEST_COMMON_LINKFLAGS -framework Foundation)
|
|
|
|
endif()
|
2014-01-16 21:11:37 +08:00
|
|
|
if(ANDROID)
|
2013-09-17 15:50:12 +08:00
|
|
|
list(APPEND ASAN_UNITTEST_COMMON_LINKFLAGS -pie)
|
|
|
|
endif()
|
2013-09-16 23:50:53 +08:00
|
|
|
|
|
|
|
set(ASAN_UNITTEST_INSTRUMENTED_LINKFLAGS
|
|
|
|
${ASAN_UNITTEST_COMMON_LINKFLAGS})
|
|
|
|
# On Android, we link with ASan runtime manually. On other platforms we depend
|
|
|
|
# on Clang driver behavior, passing -fsanitize=address flag.
|
|
|
|
if(NOT ANDROID)
|
|
|
|
list(APPEND ASAN_UNITTEST_INSTRUMENTED_LINKFLAGS -fsanitize=address)
|
|
|
|
endif()
|
|
|
|
|
2014-04-01 21:16:30 +08:00
|
|
|
set(ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINKFLAGS
|
|
|
|
${ASAN_UNITTEST_INSTRUMENTED_LINKFLAGS}
|
|
|
|
-shared-libasan)
|
|
|
|
|
2014-05-13 18:33:42 +08:00
|
|
|
set(ASAN_UNITTEST_NOINST_LINKFLAGS ${ASAN_UNITTEST_COMMON_LINKFLAGS})
|
|
|
|
append_if(COMPILER_RT_HAS_LIBM -lm ASAN_UNITTEST_NOINST_LINKFLAGS)
|
2014-03-13 17:31:36 +08:00
|
|
|
append_if(COMPILER_RT_HAS_LIBDL -ldl ASAN_UNITTEST_NOINST_LINKFLAGS)
|
|
|
|
append_if(COMPILER_RT_HAS_LIBPTHREAD -lpthread ASAN_UNITTEST_NOINST_LINKFLAGS)
|
2014-04-01 21:16:30 +08:00
|
|
|
append_if(COMPILER_RT_HAS_LIBPTHREAD -lpthread
|
|
|
|
ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINKFLAGS)
|
2013-09-16 23:50:53 +08:00
|
|
|
|
2012-12-19 23:17:23 +08:00
|
|
|
# Compile source for the given architecture, using compiler
|
|
|
|
# options in ${ARGN}, and add it to the object list.
|
2014-04-21 18:31:35 +08:00
|
|
|
macro(asan_compile obj_list source arch kind)
|
2012-12-19 20:33:39 +08:00
|
|
|
get_filename_component(basename ${source} NAME)
|
2014-04-21 18:31:35 +08:00
|
|
|
set(output_obj "${obj_list}.${basename}.${arch}${kind}.o")
|
2012-12-19 23:17:23 +08:00
|
|
|
get_target_flags_for_arch(${arch} TARGET_CFLAGS)
|
2014-02-20 20:03:56 +08:00
|
|
|
set(COMPILE_DEPS ${ASAN_UNITTEST_HEADERS} ${ASAN_BLACKLIST_FILE})
|
|
|
|
if(NOT COMPILER_RT_STANDALONE_BUILD)
|
|
|
|
list(APPEND COMPILE_DEPS gtest asan)
|
|
|
|
endif()
|
2012-12-19 20:33:39 +08:00
|
|
|
clang_compile(${output_obj} ${source}
|
2012-12-19 23:17:23 +08:00
|
|
|
CFLAGS ${ARGN} ${TARGET_CFLAGS}
|
2014-02-20 20:03:56 +08:00
|
|
|
DEPS ${COMPILE_DEPS})
|
2012-12-19 20:33:39 +08:00
|
|
|
list(APPEND ${obj_list} ${output_obj})
|
|
|
|
endmacro()
|
|
|
|
|
2012-12-19 23:17:23 +08:00
|
|
|
# Link ASan unit test for a given architecture from a set
|
2013-09-16 23:50:53 +08:00
|
|
|
# of objects in with given linker flags.
|
2014-04-21 18:31:35 +08:00
|
|
|
macro(add_asan_test test_suite test_name arch kind)
|
2013-09-16 23:50:53 +08:00
|
|
|
parse_arguments(TEST "OBJECTS;LINKFLAGS" "WITH_TEST_RUNTIME" ${ARGN})
|
2012-12-19 23:17:23 +08:00
|
|
|
get_target_flags_for_arch(${arch} TARGET_LINK_FLAGS)
|
2014-02-20 20:03:56 +08:00
|
|
|
set(TEST_DEPS ${TEST_OBJECTS})
|
|
|
|
if(NOT COMPILER_RT_STANDALONE_BUILD)
|
|
|
|
list(APPEND TEST_DEPS asan)
|
|
|
|
endif()
|
2013-09-16 23:50:53 +08:00
|
|
|
if(TEST_WITH_TEST_RUNTIME)
|
|
|
|
list(APPEND TEST_DEPS ${ASAN_TEST_RUNTIME})
|
2014-05-13 18:33:42 +08:00
|
|
|
if(NOT MSVC)
|
|
|
|
list(APPEND TEST_OBJECTS lib${ASAN_TEST_RUNTIME}.a)
|
|
|
|
else()
|
|
|
|
list(APPEND TEST_OBJECTS ${ASAN_TEST_RUNTIME}.lib)
|
|
|
|
endif()
|
2013-09-16 23:50:53 +08:00
|
|
|
endif()
|
2012-12-19 20:33:39 +08:00
|
|
|
add_compiler_rt_test(${test_suite} ${test_name}
|
2013-09-16 23:50:53 +08:00
|
|
|
OBJECTS ${TEST_OBJECTS}
|
|
|
|
DEPS ${TEST_DEPS}
|
|
|
|
LINK_FLAGS ${TEST_LINKFLAGS}
|
2012-12-19 23:17:23 +08:00
|
|
|
${TARGET_LINK_FLAGS})
|
2012-12-19 20:33:39 +08:00
|
|
|
endmacro()
|
2012-06-28 20:19:52 +08:00
|
|
|
|
2012-12-19 20:33:39 +08:00
|
|
|
# Main AddressSanitizer unit tests.
|
|
|
|
add_custom_target(AsanUnitTests)
|
|
|
|
set_target_properties(AsanUnitTests PROPERTIES FOLDER "ASan unit tests")
|
|
|
|
# ASan benchmarks (not actively used now).
|
|
|
|
add_custom_target(AsanBenchmarks)
|
|
|
|
set_target_properties(AsanBenchmarks PROPERTIES FOLDER "Asan benchmarks")
|
2012-07-24 16:26:19 +08:00
|
|
|
|
2013-09-12 17:46:56 +08:00
|
|
|
set(ASAN_NOINST_TEST_SOURCES
|
2013-09-16 23:50:53 +08:00
|
|
|
${COMPILER_RT_GTEST_SOURCE}
|
2013-09-17 16:40:32 +08:00
|
|
|
asan_fake_stack_test.cc
|
2013-09-12 17:46:56 +08:00
|
|
|
asan_noinst_test.cc
|
|
|
|
asan_test_main.cc)
|
|
|
|
|
2013-01-22 15:31:28 +08:00
|
|
|
set(ASAN_INST_TEST_SOURCES
|
2013-09-16 23:50:53 +08:00
|
|
|
${COMPILER_RT_GTEST_SOURCE}
|
2014-02-19 17:14:39 +08:00
|
|
|
asan_asm_test.cc
|
2013-01-22 15:31:28 +08:00
|
|
|
asan_globals_test.cc
|
2013-09-16 23:50:53 +08:00
|
|
|
asan_interface_test.cc
|
2013-01-22 15:31:28 +08:00
|
|
|
asan_test.cc
|
|
|
|
asan_oob_test.cc
|
|
|
|
asan_mem_test.cc
|
2013-09-16 23:50:53 +08:00
|
|
|
asan_str_test.cc
|
|
|
|
asan_test_main.cc)
|
|
|
|
if(APPLE)
|
|
|
|
list(APPEND ASAN_INST_TEST_SOURCES asan_mac_test.cc)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(ASAN_BENCHMARKS_SOURCES
|
|
|
|
${COMPILER_RT_GTEST_SOURCE}
|
2014-04-21 18:31:35 +08:00
|
|
|
asan_benchmarks_test.cc)
|
2013-01-22 15:31:28 +08:00
|
|
|
|
2012-12-19 23:17:23 +08:00
|
|
|
# Adds ASan unit tests and benchmarks for architecture.
|
2014-04-21 18:31:35 +08:00
|
|
|
macro(add_asan_tests_for_arch_and_kind arch kind)
|
2012-12-19 20:33:39 +08:00
|
|
|
# Instrumented tests.
|
|
|
|
set(ASAN_INST_TEST_OBJECTS)
|
2013-01-22 15:31:28 +08:00
|
|
|
foreach(src ${ASAN_INST_TEST_SOURCES})
|
2014-04-21 18:31:35 +08:00
|
|
|
asan_compile(ASAN_INST_TEST_OBJECTS ${src} ${arch} ${kind}
|
|
|
|
${ASAN_UNITTEST_INSTRUMENTED_CFLAGS} ${ARGN})
|
2013-01-22 15:31:28 +08:00
|
|
|
endforeach()
|
2012-06-28 20:19:52 +08:00
|
|
|
if (APPLE)
|
2013-09-16 23:50:53 +08:00
|
|
|
# Add Mac-specific helper.
|
2014-04-21 18:31:35 +08:00
|
|
|
asan_compile(ASAN_INST_TEST_OBJECTS asan_mac_test_helpers.mm ${arch} ${kind}
|
|
|
|
${ASAN_UNITTEST_INSTRUMENTED_CFLAGS} -ObjC ${ARGN})
|
2012-06-28 20:19:52 +08:00
|
|
|
endif()
|
2014-04-21 18:31:35 +08:00
|
|
|
add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Test" ${arch} ${kind}
|
2013-09-16 23:50:53 +08:00
|
|
|
OBJECTS ${ASAN_INST_TEST_OBJECTS}
|
|
|
|
LINKFLAGS ${ASAN_UNITTEST_INSTRUMENTED_LINKFLAGS})
|
2014-04-01 21:16:30 +08:00
|
|
|
if(COMPILER_RT_BUILD_SHARED_ASAN)
|
2014-04-21 18:31:35 +08:00
|
|
|
add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Dynamic-Test" ${arch} ${kind}
|
2014-04-01 21:16:30 +08:00
|
|
|
OBJECTS ${ASAN_INST_TEST_OBJECTS}
|
|
|
|
LINKFLAGS ${ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINKFLAGS})
|
|
|
|
endif()
|
2013-09-16 23:50:53 +08:00
|
|
|
|
|
|
|
# Add static ASan runtime that will be linked with uninstrumented tests.
|
2014-04-21 18:31:35 +08:00
|
|
|
set(ASAN_TEST_RUNTIME RTAsanTest.${arch}${kind})
|
2013-09-16 23:50:53 +08:00
|
|
|
if(APPLE)
|
|
|
|
set(ASAN_TEST_RUNTIME_OBJECTS
|
|
|
|
$<TARGET_OBJECTS:RTAsan.osx>
|
|
|
|
$<TARGET_OBJECTS:RTInterception.osx>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.osx>
|
|
|
|
$<TARGET_OBJECTS:RTLSanCommon.osx>)
|
|
|
|
else()
|
|
|
|
set(ASAN_TEST_RUNTIME_OBJECTS
|
|
|
|
$<TARGET_OBJECTS:RTAsan.${arch}>
|
2014-05-13 02:39:22 +08:00
|
|
|
$<TARGET_OBJECTS:RTAsan_cxx.${arch}>
|
2013-09-16 23:50:53 +08:00
|
|
|
$<TARGET_OBJECTS:RTInterception.${arch}>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>)
|
2014-05-13 18:33:42 +08:00
|
|
|
if(NOT MSVC)
|
|
|
|
list(APPEND ASAN_TEST_RUNTIME_OBJECTS
|
|
|
|
$<TARGET_OBJECTS:RTLSanCommon.${arch}>)
|
|
|
|
endif()
|
2013-09-16 23:50:53 +08:00
|
|
|
endif()
|
|
|
|
add_library(${ASAN_TEST_RUNTIME} STATIC ${ASAN_TEST_RUNTIME_OBJECTS})
|
|
|
|
set_target_properties(${ASAN_TEST_RUNTIME} PROPERTIES
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
2012-12-19 20:33:39 +08:00
|
|
|
# Uninstrumented tests.
|
|
|
|
set(ASAN_NOINST_TEST_OBJECTS)
|
2013-01-22 15:31:28 +08:00
|
|
|
foreach(src ${ASAN_NOINST_TEST_SOURCES})
|
2014-04-21 18:31:35 +08:00
|
|
|
asan_compile(ASAN_NOINST_TEST_OBJECTS ${src} ${arch} ${kind}
|
|
|
|
${ASAN_UNITTEST_COMMON_CFLAGS} ${ARGN})
|
2013-01-22 15:31:28 +08:00
|
|
|
endforeach()
|
2014-04-21 18:31:35 +08:00
|
|
|
add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Noinst-Test" ${arch} ${kind}
|
2013-09-16 23:50:53 +08:00
|
|
|
OBJECTS ${ASAN_NOINST_TEST_OBJECTS}
|
|
|
|
LINKFLAGS ${ASAN_UNITTEST_NOINST_LINKFLAGS}
|
|
|
|
WITH_TEST_RUNTIME)
|
2012-12-19 20:33:39 +08:00
|
|
|
|
2013-09-16 23:50:53 +08:00
|
|
|
# Benchmarks.
|
2012-12-19 20:33:39 +08:00
|
|
|
set(ASAN_BENCHMARKS_OBJECTS)
|
2013-09-16 23:50:53 +08:00
|
|
|
foreach(src ${ASAN_BENCHMARKS_SOURCES})
|
2014-04-21 18:31:35 +08:00
|
|
|
asan_compile(ASAN_BENCHMARKS_OBJECTS ${src} ${arch} ${kind}
|
|
|
|
${ASAN_UNITTEST_INSTRUMENTED_CFLAGS} ${ARGN})
|
2013-09-16 23:50:53 +08:00
|
|
|
endforeach()
|
2014-04-21 18:31:35 +08:00
|
|
|
add_asan_test(AsanBenchmarks "Asan-${arch}${kind}-Benchmark" ${arch} ${kind}
|
2013-09-16 23:50:53 +08:00
|
|
|
OBJECTS ${ASAN_BENCHMARKS_OBJECTS}
|
|
|
|
LINKFLAGS ${ASAN_UNITTEST_INSTRUMENTED_LINKFLAGS})
|
2014-04-01 21:16:30 +08:00
|
|
|
if(COMPILER_RT_BUILD_SHARED_ASAN)
|
2014-04-21 18:31:35 +08:00
|
|
|
add_asan_test(AsanBenchmarks "Asan-${arch}${kind}-Dynamic-Benchmark" ${arch} ${kind}
|
2014-04-01 21:16:30 +08:00
|
|
|
OBJECTS ${ASAN_BENCHMARKS_OBJECTS}
|
|
|
|
LINKFLAGS ${ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINKFLAGS})
|
|
|
|
endif()
|
2012-12-19 23:17:23 +08:00
|
|
|
endmacro()
|
|
|
|
|
2012-12-27 21:19:23 +08:00
|
|
|
if(COMPILER_RT_CAN_EXECUTE_TESTS)
|
2013-01-21 22:31:45 +08:00
|
|
|
foreach(arch ${ASAN_SUPPORTED_ARCH})
|
2014-04-21 18:31:35 +08:00
|
|
|
add_asan_tests_for_arch_and_kind(${arch} "-inline")
|
|
|
|
add_asan_tests_for_arch_and_kind(${arch} "-with-calls"
|
|
|
|
-mllvm -asan-instrumentation-with-call-threshold=0)
|
2013-01-21 22:31:45 +08:00
|
|
|
endforeach()
|
2012-06-27 17:01:24 +08:00
|
|
|
endif()
|
2012-06-29 18:23:31 +08:00
|
|
|
|
2012-09-11 19:55:45 +08:00
|
|
|
if(ANDROID)
|
2012-12-19 20:33:39 +08:00
|
|
|
# We assume that unit tests on Android are built in a build
|
|
|
|
# tree with fresh Clang as a host compiler.
|
2013-09-16 23:50:53 +08:00
|
|
|
|
|
|
|
# Test w/o ASan instrumentation. Link it with ASan statically.
|
|
|
|
add_executable(AsanNoinstTest
|
|
|
|
$<TARGET_OBJECTS:RTAsan.arm.android>
|
|
|
|
$<TARGET_OBJECTS:RTInterception.arm.android>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.arm.android>
|
|
|
|
${COMPILER_RT_GTEST_SOURCE}
|
|
|
|
${ASAN_NOINST_TEST_SOURCES})
|
|
|
|
set_target_compile_flags(AsanNoinstTest ${ASAN_UNITTEST_COMMON_CFLAGS})
|
|
|
|
set_target_link_flags(AsanNoinstTest ${ASAN_UNITTEST_NOINST_LINKFLAGS})
|
2014-01-23 19:34:41 +08:00
|
|
|
target_link_libraries(AsanNoinstTest log)
|
2013-09-16 23:50:53 +08:00
|
|
|
|
|
|
|
# Test with ASan instrumentation. Link with ASan dynamic runtime.
|
2012-12-19 20:33:39 +08:00
|
|
|
add_executable(AsanTest
|
2013-09-16 23:50:53 +08:00
|
|
|
${COMPILER_RT_GTEST_SOURCE}
|
|
|
|
${ASAN_INST_TEST_SOURCES})
|
|
|
|
set_target_compile_flags(AsanTest ${ASAN_UNITTEST_INSTRUMENTED_CFLAGS})
|
|
|
|
set_target_link_flags(AsanTest ${ASAN_UNITTEST_INSTRUMENTED_LINKFLAGS})
|
|
|
|
target_link_libraries(AsanTest clang_rt.asan-arm-android)
|
|
|
|
|
2012-12-19 20:33:39 +08:00
|
|
|
# Setup correct output directory and link flags.
|
2013-09-16 23:50:53 +08:00
|
|
|
set_target_properties(AsanNoinstTest AsanTest PROPERTIES
|
2013-01-28 15:16:22 +08:00
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
2012-12-19 21:46:58 +08:00
|
|
|
# Add unit test to test suite.
|
2013-09-16 23:50:53 +08:00
|
|
|
add_dependencies(AsanUnitTests AsanNoinstTest AsanTest)
|
2012-09-11 19:55:45 +08:00
|
|
|
endif()
|