[X86] Improve F16C CVT schedules on SNB/HSW/BDW
[llvm-project.git] / compiler-rt / test / CMakeLists.txt
blobf9e23710d3e4f7aec9110c6bf03610646a1114ce
1 # Needed for lit support in standalone builds.
2 include(AddLLVM)
4 pythonize_bool(COMPILER_RT_TEST_STANDALONE_BUILD_LIBS)
6 pythonize_bool(LLVM_ENABLE_EXPENSIVE_CHECKS)
8 pythonize_bool(ZLIB_FOUND)
9 pythonize_bool(COMPILER_RT_BUILD_STANDALONE_LIBATOMIC)
11 pythonize_bool(COMPILER_RT_ENABLE_INTERNAL_SYMBOLIZER)
13 pythonize_bool(COMPILER_RT_HAS_AARCH64_SME)
15 pythonize_bool(COMPILER_RT_HAS_NO_DEFAULT_CONFIG_FLAG)
17 configure_compiler_rt_lit_site_cfg(
18   ${CMAKE_CURRENT_SOURCE_DIR}/lit.common.configured.in
19   ${CMAKE_CURRENT_BINARY_DIR}/lit.common.configured)
21 # BlocksRuntime (and most of builtins) testsuites are not yet ported to lit.
22 # add_subdirectory(BlocksRuntime)
24 set(SANITIZER_COMMON_LIT_TEST_DEPS)
26 if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
27   list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)
28 endif()
30 # When ANDROID, we build tests with the host compiler (i.e. CMAKE_C_COMPILER),
31 # and run tests with tools from the host toolchain.
32 if(NOT ANDROID)
33   if(NOT COMPILER_RT_STANDALONE_BUILD AND NOT LLVM_RUNTIMES_BUILD)
34     # Use LLVM utils and Clang from the same build tree.
35     list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS
36       clang clang-resource-headers FileCheck count not llvm-config llvm-nm 
37       llvm-objdump llvm-readelf llvm-readobj llvm-size llvm-symbolizer 
38       compiler-rt-headers sancov split-file llvm-strip)
39     if (WIN32)
40       list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor)
41     endif()
42   endif()
43   # Tests use C++ standard library headers.
44   if (TARGET cxx-headers OR HAVE_LIBCXX)
45     list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS cxx-headers)
46   endif()
47 endif()
49 umbrella_lit_testsuite_begin(check-compiler-rt)
51 function(compiler_rt_test_runtime runtime)
52   string(TOUPPER ${runtime} runtime_uppercase)
53   if(COMPILER_RT_HAS_${runtime_uppercase} AND COMPILER_RT_INCLUDE_TESTS)
54     if (${runtime} STREQUAL cfi AND NOT COMPILER_RT_HAS_UBSAN)
55       # CFI tests require diagnostic mode, which is implemented in UBSan.
56     elseif (${runtime} STREQUAL scudo_standalone)
57       add_subdirectory(scudo/standalone)
58     else()
59       add_subdirectory(${runtime})
60     endif()
61   endif()
62 endfunction()
64 # Run sanitizer tests only if we're sure that clang would produce
65 # working binaries.
66 if(COMPILER_RT_CAN_EXECUTE_TESTS)
67   if(COMPILER_RT_BUILD_BUILTINS)
68     add_subdirectory(builtins)
69   endif()
70   if(COMPILER_RT_BUILD_SANITIZERS)
71     compiler_rt_test_runtime(interception)
73     compiler_rt_test_runtime(lsan)
74     compiler_rt_test_runtime(ubsan)
75     compiler_rt_test_runtime(sanitizer_common)
77     # OpenBSD not supporting asan, cannot run the tests
78     if(COMPILER_RT_BUILD_LIBFUZZER AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD" AND NOT ANDROID)
79       compiler_rt_test_runtime(fuzzer)
81       # These tests don't need an additional runtime but use asan runtime.
82       add_subdirectory(metadata)
83     endif()
85     foreach(sanitizer ${COMPILER_RT_SANITIZERS_TO_BUILD})
86       compiler_rt_test_runtime(${sanitizer})
87     endforeach()
88   endif()
89   if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
90     compiler_rt_test_runtime(profile)
91   endif()
92   if(COMPILER_RT_BUILD_CTX_PROFILE)
93     compiler_rt_test_runtime(ctx_profile)
94   endif()
95   if(COMPILER_RT_BUILD_MEMPROF)
96     compiler_rt_test_runtime(memprof)
97   endif()
98   if(COMPILER_RT_BUILD_XRAY)
99     compiler_rt_test_runtime(xray)
100   endif()
101   if(COMPILER_RT_BUILD_ORC)
102     compiler_rt_Test_runtime(orc)
103   endif()
104   # ShadowCallStack does not yet provide a runtime with compiler-rt, the tests
105   # include their own minimal runtime
106   add_subdirectory(shadowcallstack)
107 endif()
109 # Now that we've traversed all the directories and know all the lit testsuites,
110 # introduce a rule to run to run all of them.
111 get_property(LLVM_COMPILER_RT_LIT_DEPENDS GLOBAL PROPERTY LLVM_COMPILER_RT_LIT_DEPENDS)
112 add_custom_target(compiler-rt-test-depends)
113 set_target_properties(compiler-rt-test-depends PROPERTIES FOLDER "Compiler-RT/Tests")
114 if(LLVM_COMPILER_RT_LIT_DEPENDS)
115   add_dependencies(compiler-rt-test-depends ${LLVM_COMPILER_RT_LIT_DEPENDS})
116 endif()
117 umbrella_lit_testsuite_end(check-compiler-rt)
119 if(COMPILER_RT_STANDALONE_BUILD)
120   if(NOT TARGET check-all)
121     add_custom_target(check-all)
122   endif()
123   add_dependencies(check-all check-compiler-rt)
124 endif()