[MemProf] Templatize CallStackRadixTreeBuilder (NFC) (#117014)
[llvm-project.git] / libc / test / integration / scudo / CMakeLists.txt
blobb4011e501b96b3c96ee7750f6e7a8f3ccb3471c3
1 if(NOT LLVM_LIBC_INCLUDE_SCUDO)
2   return()
3 endif()
5 # We use a special library consisting of only the SCUDO allocator
6 # functions to link to the integration tests below. We could instead
7 # link to libllvmlibc.a directly, but since libllvmlibc.a contains
8 # functions which depend on the LLVM libc startup system, the integration
9 # test will have to link to the LLVM libc startup system. LLVM libc's startup
10 # system is not complete enough to allow this. It is also desireable to
11 # keep the dependencies as minimal as possible.
13 add_entrypoint_library(
14   libc_for_scudo_integration_test
15   DEPENDS
16     libc.src.errno.errno
17     libc.src.fcntl.open
18     libc.src.sched.__sched_getcpucount
19     libc.src.stdlib.aligned_alloc
20     libc.src.stdlib.calloc
21     libc.src.stdlib.free
22     libc.src.stdlib.malloc
23     libc.src.stdlib.realloc
24     libc.src.sys.auxv.getauxval
25     libc.src.sys.mman.mmap
26     libc.src.sys.mman.munmap
27     libc.src.sys.prctl.prctl
28     libc.src.unistd.__llvm_libc_syscall
29     libc.src.unistd.close
30     libc.src.unistd.read
31     libc.src.unistd.sysconf
32     libc.src.unistd.write
35 add_executable(
36   libc-scudo-integration-test
37   integration_test.cpp
40 target_link_options(
41   libc-scudo-integration-test
42   PRIVATE
43   -pthread
46 target_link_libraries(libc-scudo-integration-test
47   PRIVATE
48   libc_for_scudo_integration_test
51 add_executable(
52   libc-gwp-asan-uaf-should-crash
53   gwp_asan_should_crash.cpp
56 target_link_options(
57   libc-gwp-asan-uaf-should-crash
58   PRIVATE
59   -pthread
62 target_link_libraries(libc-gwp-asan-uaf-should-crash
63   PRIVATE
64   libc_for_scudo_integration_test
67 add_custom_command(TARGET libc-scudo-integration-test
68                    POST_BUILD
69                    COMMAND $<TARGET_FILE:libc-scudo-integration-test>
70                    COMMENT "Run the test after it is built."
71                    VERBATIM)