blob: 397092ce0707a65d4f383a2b3b54151175e05cd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
include_directories(..)
add_custom_target(ScudoUnitTests)
set_target_properties(ScudoUnitTests PROPERTIES
FOLDER "Compiler-RT Tests")
set(SCUDO_UNITTEST_CFLAGS
${COMPILER_RT_UNITTEST_CFLAGS}
${COMPILER_RT_GTEST_CFLAGS}
-I${COMPILER_RT_SOURCE_DIR}/include
-I${COMPILER_RT_SOURCE_DIR}/lib
-I${COMPILER_RT_SOURCE_DIR}/lib/scudo/standalone
-DGTEST_HAS_RTTI=0)
set(SCUDO_TEST_ARCH ${SCUDO_STANDALONE_SUPPORTED_ARCH})
# gtests requires c++
set(LINK_FLAGS ${COMPILER_RT_UNITTEST_LINK_FLAGS})
foreach(lib ${SANITIZER_TEST_CXX_LIBRARIES})
list(APPEND LINK_FLAGS -l${lib})
endforeach()
list(APPEND LINK_FLAGS -pthread)
set(TEST_HEADERS)
foreach (header ${SCUDO_HEADERS})
list(APPEND TEST_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../${header})
endforeach()
# add_scudo_unittest(<name>
# SOURCES <sources list>
# HEADERS <extra headers list>)
macro(add_scudo_unittest testname)
cmake_parse_arguments(TEST "" "" "SOURCES;HEADERS" ${ARGN})
if(COMPILER_RT_HAS_SCUDO_STANDALONE)
foreach(arch ${SCUDO_TEST_ARCH})
set(ScudoUnitTestsObjects)
add_library("RTScudoStandalone.test.${arch}" STATIC
$<TARGET_OBJECTS:RTScudoStandalone.${arch}>)
generate_compiler_rt_tests(ScudoUnitTestsObjects ScudoUnitTests
"${testname}-${arch}-Test" ${arch}
SOURCES ${TEST_SOURCES} ${COMPILER_RT_GTEST_SOURCE}
COMPILE_DEPS ${TEST_HEADERS}
DEPS gtest scudo_standalone
RUNTIME RTScudoStandalone.test.${arch}
CFLAGS ${SCUDO_UNITTEST_CFLAGS}
LINK_FLAGS ${LINK_FLAGS})
endforeach()
endif()
endmacro()
set(SCUDO_UNIT_TEST_SOURCES
atomic_test.cc
bytemap_test.cc
checksum_test.cc
chunk_test.cc
flags_test.cc
list_test.cc
map_test.cc
mutex_test.cc
primary_test.cc
quarantine_test.cc
release_test.cc
report_test.cc
secondary_test.cc
size_class_map_test.cc
stats_test.cc
strings_test.cc
tsd_test.cc
vector_test.cc
scudo_unit_test_main.cc)
add_scudo_unittest(ScudoUnitTest
SOURCES ${SCUDO_UNIT_TEST_SOURCES})
|