@@ -46,75 +46,81 @@ if(NOT ANDROID)
4646 endif ()
4747endif ()
4848
49- umbrella_lit_testsuite_begin(check-compiler-rt)
50-
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} )
49+ # XXX: Maybe more precise conditions to enable/disable tests
50+ # But now the below code is broken at least with LLVM_USE_SANITIZER=Undefined
51+ if (NOT LLVM_USE_SANITIZER)
52+
53+ umbrella_lit_testsuite_begin(check-compiler-rt)
54+
55+ function (compiler_rt_test_runtime runtime)
56+ string (TOUPPER ${runtime} runtime_uppercase)
57+ if (COMPILER_RT_HAS_${runtime_uppercase} AND COMPILER_RT_INCLUDE_TESTS)
58+ if (${runtime} STREQUAL cfi AND NOT COMPILER_RT_HAS_UBSAN)
59+ # CFI tests require diagnostic mode, which is implemented in UBSan.
60+ elseif (${runtime} STREQUAL scudo_standalone)
61+ add_subdirectory (scudo/standalone)
62+ else ()
63+ add_subdirectory (${runtime} )
64+ endif ()
6065 endif ()
61- endif ()
62- endfunction ()
66+ endfunction ()
6367
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)
68+ # Run sanitizer tests only if we're sure that clang would produce
69+ # working binaries.
70+ if (COMPILER_RT_CAN_EXECUTE_TESTS)
71+ if (COMPILER_RT_BUILD_BUILTINS)
72+ add_subdirectory (builtins)
73+ endif ()
74+ if (COMPILER_RT_BUILD_SANITIZERS)
75+ compiler_rt_test_runtime(interception)
7276
73- compiler_rt_test_runtime(lsan)
74- compiler_rt_test_runtime(ubsan)
75- compiler_rt_test_runtime(sanitizer_common)
77+ compiler_rt_test_runtime(lsan)
78+ compiler_rt_test_runtime(ubsan)
79+ compiler_rt_test_runtime(sanitizer_common)
7680
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+ # OpenBSD not supporting asan, cannot run the tests
82+ if (COMPILER_RT_BUILD_LIBFUZZER AND NOT "${CMAKE_SYSTEM_NAME} " STREQUAL "OpenBSD" AND NOT ANDROID)
83+ compiler_rt_test_runtime(fuzzer)
8084
81- # These tests don't need an additional runtime but use asan runtime.
82- add_subdirectory (metadata)
83- endif ()
85+ # These tests don't need an additional runtime but use asan runtime.
86+ add_subdirectory (metadata)
87+ endif ()
8488
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)
89+ foreach (sanitizer ${COMPILER_RT_SANITIZERS_TO_BUILD} )
90+ compiler_rt_test_runtime(${sanitizer} )
91+ endforeach ()
92+ endif ()
93+ if (COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
94+ compiler_rt_test_runtime(profile)
95+ endif ()
96+ if (COMPILER_RT_BUILD_CTX_PROFILE)
97+ compiler_rt_test_runtime(ctx_profile)
98+ endif ()
99+ if (COMPILER_RT_BUILD_MEMPROF)
100+ compiler_rt_test_runtime(memprof)
101+ endif ()
102+ if (COMPILER_RT_BUILD_XRAY)
103+ compiler_rt_test_runtime(xray)
104+ endif ()
105+ if (COMPILER_RT_BUILD_ORC)
106+ compiler_rt_Test_runtime(orc)
107+ endif ()
108+ # ShadowCallStack does not yet provide a runtime with compiler-rt, the tests
109+ # include their own minimal runtime
110+ add_subdirectory (shadowcallstack)
100111 endif ()
101- if (COMPILER_RT_BUILD_ORC)
102- compiler_rt_Test_runtime(orc)
112+
113+ # Now that we've traversed all the directories and know all the lit testsuites,
114+ # introduce a rule to run to run all of them.
115+ get_property (LLVM_COMPILER_RT_LIT_DEPENDS GLOBAL PROPERTY LLVM_COMPILER_RT_LIT_DEPENDS)
116+ add_custom_target (compiler-rt-test -depends )
117+ set_target_properties (compiler-rt-test -depends PROPERTIES FOLDER "Compiler-RT/Tests" )
118+ if (LLVM_COMPILER_RT_LIT_DEPENDS)
119+ add_dependencies (compiler-rt-test -depends ${LLVM_COMPILER_RT_LIT_DEPENDS} )
103120 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 ()
121+ umbrella_lit_testsuite_end(check-compiler-rt)
108122
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)
123+ endif (LLVM_USE_SANITIZER)
118124
119125if (COMPILER_RT_STANDALONE_BUILD)
120126 if (NOT TARGET check-all )
0 commit comments