1 set(MEMPROF_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
3 set(MEMPROF_TESTSUITES)
4 set(MEMPROF_DYNAMIC_TESTSUITES)
6 macro(get_bits_for_arch arch bits)
7 if (${arch} MATCHES "x86_64")
10 message(FATAL_ERROR "Unexpected target architecture: ${arch}")
14 set(MEMPROF_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS} memprof)
15 if(NOT COMPILER_RT_STANDALONE_BUILD AND COMPILER_RT_HAS_LLD AND TARGET lld)
16 list(APPEND MEMPROF_TEST_DEPS lld)
18 set(MEMPROF_DYNAMIC_TEST_DEPS ${MEMPROF_TEST_DEPS})
20 set(MEMPROF_TEST_ARCH ${MEMPROF_SUPPORTED_ARCH})
22 foreach(arch ${MEMPROF_TEST_ARCH})
23 set(MEMPROF_TEST_TARGET_ARCH ${arch})
24 string(TOLOWER "-${arch}-${OS_NAME}" MEMPROF_TEST_CONFIG_SUFFIX)
25 get_bits_for_arch(${arch} MEMPROF_TEST_BITS)
26 get_test_cc_for_arch(${arch} MEMPROF_TEST_TARGET_CC MEMPROF_TEST_TARGET_CFLAGS)
27 set(MEMPROF_TEST_DYNAMIC False)
28 string(TOUPPER ${arch} ARCH_UPPER_CASE)
29 set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
30 configure_lit_site_cfg(
31 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
32 ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py
34 list(APPEND MEMPROF_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
36 string(TOLOWER "-${arch}-${OS_NAME}-dynamic" MEMPROF_TEST_CONFIG_SUFFIX)
37 set(MEMPROF_TEST_DYNAMIC True)
38 set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}DynamicConfig)
39 configure_lit_site_cfg(
40 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
41 ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
42 list(APPEND MEMPROF_DYNAMIC_TESTSUITES
43 ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
47 foreach(arch ${MEMPROF_TEST_ARCH})
48 string(TOUPPER ${arch} ARCH_UPPER_CASE)
49 set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
50 configure_lit_site_cfg(
51 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
52 ${CMAKE_CURRENT_BINARY_DIR}/Unit/${CONFIG_NAME}/lit.site.cfg.py)
53 list(APPEND MEMPROF_TEST_DEPS MemProfUnitTests)
54 list(APPEND MEMPROF_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit/${CONFIG_NAME})
57 add_lit_testsuite(check-memprof "Running the MemProfiler tests"
59 DEPENDS ${MEMPROF_TEST_DEPS})
61 add_lit_testsuite(check-memprof-dynamic
62 "Running the MemProfiler tests with dynamic runtime"
63 ${MEMPROF_DYNAMIC_TESTSUITES}
64 ${exclude_from_check_all.g}
65 DEPENDS ${MEMPROF_DYNAMIC_TEST_DEPS})