[TableGen] Fix validateOperandClass for non Phyical Reg (#118146)
[llvm-project.git] / compiler-rt / lib / gwp_asan / tests / CMakeLists.txt
blob5de1af10eec36673a6e72af1ff0b0a000b2ce4f8
1 include(CompilerRTCompile)
3 set(GWP_ASAN_UNITTEST_CFLAGS
4   ${COMPILER_RT_UNITTEST_CFLAGS}
5   ${COMPILER_RT_GTEST_CFLAGS}
6   ${SANITIZER_TEST_CXX_CFLAGS}
7   -std=c++17
8   -I${COMPILER_RT_SOURCE_DIR}/lib/
9   -O2
10   -g
11   -fno-omit-frame-pointer)
13 file(GLOB GWP_ASAN_HEADERS ../*.h)
14 set(GWP_ASAN_UNITTESTS
15   platform_specific/printf_sanitizer_common.cpp
16   alignment.cpp
17   backtrace.cpp
18   basic.cpp
19   compression.cpp
20   iterate.cpp
21   crash_handler_api.cpp
22   driver.cpp
23   mutex_test.cpp
24   slot_reuse.cpp
25   thread_contention.cpp
26   harness.cpp
27   enable_disable.cpp
28   late_init.cpp
29   options.cpp
30   recoverable.cpp
31   never_allocated.cpp
32   utilities.cpp
35 set(GWP_ASAN_UNIT_TEST_HEADERS
36   ${GWP_ASAN_HEADERS}
37   harness.h)
39 add_custom_target(GwpAsanUnitTests)
40 set_target_properties(GwpAsanUnitTests PROPERTIES FOLDER "Compiler-RT/Tests")
42 set(GWP_ASAN_UNITTEST_LINK_FLAGS
43   ${COMPILER_RT_UNITTEST_LINK_FLAGS} -ldl
44   ${COMPILER_RT_UNWINDER_LINK_LIBS}
45   ${SANITIZER_TEST_CXX_LIBRARIES})
46 list(APPEND GWP_ASAN_UNITTEST_LINK_FLAGS --driver-mode=g++)
47 if(NOT WIN32)
48   list(APPEND GWP_ASAN_UNITTEST_LINK_FLAGS -pthread)
49 endif()
51 if(COMPILER_RT_DEFAULT_TARGET_ARCH IN_LIST GWP_ASAN_SUPPORTED_ARCH)
52   # GWP-ASan unit tests are only run on the host machine.
53   set(arch ${COMPILER_RT_DEFAULT_TARGET_ARCH})
55   set(GWP_ASAN_TEST_RUNTIME RTGwpAsanTest.${arch})
57   set(GWP_ASAN_TEST_RUNTIME_OBJECTS
58     $<TARGET_OBJECTS:RTGwpAsan.${arch}>
59     $<TARGET_OBJECTS:RTGwpAsanBacktraceSanitizerCommon.${arch}>
60     $<TARGET_OBJECTS:RTGwpAsanSegvHandler.${arch}>
61     $<TARGET_OBJECTS:RTGwpAsanOptionsParser.${arch}>
62     $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
63     $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
64     $<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
65     $<TARGET_OBJECTS:RTSanitizerCommonSymbolizerInternal.${arch}>)
67   add_library(${GWP_ASAN_TEST_RUNTIME} STATIC
68     ${GWP_ASAN_TEST_RUNTIME_OBJECTS})
70   set_target_properties(${GWP_ASAN_TEST_RUNTIME} PROPERTIES
71     ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
72     FOLDER "Compiler-RT/Tests/Runtime")
74   set(GwpAsanTestObjects)
75   generate_compiler_rt_tests(GwpAsanTestObjects
76     GwpAsanUnitTests "GwpAsan-${arch}-Test" ${arch}
77     SOURCES ${GWP_ASAN_UNITTESTS} ${COMPILER_RT_GTEST_SOURCE}
78     RUNTIME ${GWP_ASAN_TEST_RUNTIME}
79     DEPS ${GWP_ASAN_UNIT_TEST_HEADERS}
80     CFLAGS ${GWP_ASAN_UNITTEST_CFLAGS}
81     LINK_FLAGS ${GWP_ASAN_UNITTEST_LINK_FLAGS})
82   set_target_properties(GwpAsanUnitTests PROPERTIES
83     RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
84 endif()