Skip to content

Commit 4fe839e

Browse files
committed
[CMake] Rename EXCLUDE_FROM_ALL and make it an argument to add_lit_testsuite
EXCLUDE_FROM_ALL means something else for add_lit_testsuite as it does for something like add_executable. Distinguish between the two by renaming the variable and making it an argument to add_lit_testsuite. Differential revision: https://reviews.llvm.org/D74168
1 parent e0d1e83 commit 4fe839e

File tree

11 files changed

+35
-38
lines changed

11 files changed

+35
-38
lines changed

clang/utils/perf-training/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
2-
# All test suites added here should be excuded from check-all
3-
set(EXCLUDE_FROM_ALL On)
4-
51
if (CMAKE_CFG_INTDIR STREQUAL ".")
62
set(LLVM_BUILD_MODE ".")
73
else ()
@@ -22,6 +18,7 @@ if(LLVM_BUILD_INSTRUMENTED)
2218

2319
add_lit_testsuite(generate-profraw "Generating clang PGO data"
2420
${CMAKE_CURRENT_BINARY_DIR}/pgo-data/
21+
EXCLUDE_FROM_CHECK_ALL
2522
DEPENDS clang clear-profraw
2623
)
2724

@@ -52,6 +49,7 @@ if(APPLE AND DTRACE)
5249

5350
add_lit_testsuite(generate-dtrace-logs "Generating clang dtrace data"
5451
${CMAKE_CURRENT_BINARY_DIR}/order-files/
52+
EXCLUDE_FROM_CHECK_ALL
5553
ARGS -j 1
5654
DEPENDS clang clear-dtrace-logs
5755
)

compiler-rt/test/asan/CMakeLists.txt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ if(OS_NAME MATCHES "Windows" AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND
1313
message(WARNING "Disabling ASan tests because they are unreliable on Windows 7 and earlier")
1414
endif()
1515

16-
if (SHADOW_MAPPING_UNRELIABLE)
17-
set(EXCLUDE_FROM_ALL TRUE)
18-
endif()
19-
2016
macro(get_bits_for_arch arch bits)
2117
if (${arch} MATCHES "x86_64|powerpc64|powerpc64le|aarch64|arm64|mips64|mips64el|s390x|sparcv9")
2218
set(${bits} 64)
@@ -82,7 +78,6 @@ endforeach()
8278
# variable to select which iOS device or simulator to use, e.g.:
8379
# SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6"
8480
if(APPLE)
85-
set(EXCLUDE_FROM_ALL ON)
8681
set(ASAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
8782
set(ASAN_TEST_DYNAMIC True)
8883
set(ASAN_APPLE_PLATFORMS ${SANITIZER_COMMON_SUPPORTED_OS})
@@ -116,10 +111,10 @@ if(APPLE)
116111
)
117112
add_lit_testsuite(check-asan-${platform}-${arch} "AddressSanitizer ${platform} ${arch} tests"
118113
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/
114+
EXCLUDE_FROM_CHECK_ALL
119115
DEPENDS ${ASAN_TEST_DEPS})
120116
endforeach()
121117
endforeach()
122-
set(EXCLUDE_FROM_ALL OFF)
123118
endif()
124119

125120
# Add unit tests.
@@ -145,21 +140,24 @@ if(COMPILER_RT_INCLUDE_TESTS)
145140
endif()
146141
endif()
147142

143+
if (SHADOW_MAPPING_UNRELIABLE)
144+
set(exclude_from_check_all.g "EXCLUDE_FROM_CHECK_ALL")
145+
else()
146+
set(exclude_from_check_all.g "")
147+
endif()
148+
148149
add_lit_testsuite(check-asan "Running the AddressSanitizer tests"
149150
${ASAN_TESTSUITES}
151+
${exclude_from_check_all}
150152
DEPENDS ${ASAN_TEST_DEPS})
151153
set_target_properties(check-asan PROPERTIES FOLDER "Compiler-RT Misc")
152154

153155
if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
154156
add_lit_testsuite(check-asan-dynamic
155157
"Running the AddressSanitizer tests with dynamic runtime"
156158
${ASAN_DYNAMIC_TESTSUITES}
159+
${exclude_from_check_all.g}
157160
DEPENDS ${ASAN_DYNAMIC_TEST_DEPS})
158161
set_target_properties(check-asan-dynamic
159162
PROPERTIES FOLDER "Compiler-RT Misc")
160163
endif()
161-
162-
# Reset EXCLUDE_FROM_ALL to its initial value.
163-
if (SHADOW_MAPPING_UNRELIABLE)
164-
set(EXCLUDE_FROM_ALL FALSE)
165-
endif()

compiler-rt/test/fuzzer/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
8989
endif()
9090

9191
if (APPLE)
92-
set(EXCLUDE_FROM_ALL ON)
9392
set(LIBFUZZER_TEST_COMPILER ${COMPILER_RT_TEST_COMPILER})
9493
set(FUZZER_APPLE_PLATFORMS ${FUZZER_SUPPORTED_OS})
9594
foreach(platform ${FUZZER_APPLE_PLATFORMS})
@@ -119,9 +118,9 @@ if (APPLE)
119118
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py
120119
)
121120
add_lit_testsuite(check-fuzzer-${platform}-${arch} "libFuzzer ${platform} ${arch} tests"
121+
EXCLUDE_FROM_CHECK_ALL
122122
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/
123123
DEPENDS ${LIBFUZZER_TEST_DEPS})
124124
endforeach()
125125
endforeach()
126-
set(EXCLUDE_FROM_ALL OFF)
127126
endif()

compiler-rt/test/tsan/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ endforeach()
4949
# variable to select which iOS device or simulator to use, e.g.:
5050
# SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6"
5151
if(APPLE)
52-
set(EXCLUDE_FROM_ALL ON)
5352
set(TSAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
5453
set(TSAN_APPLE_PLATFORMS ${TSAN_SUPPORTED_OS})
5554
foreach(platform ${TSAN_APPLE_PLATFORMS})
@@ -80,10 +79,10 @@ if(APPLE)
8079
)
8180
add_lit_testsuite(check-tsan-${platform}-${arch} "ThreadSanitizer ${platform} ${arch} tests"
8281
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/
82+
EXCLUDE_FROM_CHECK_ALL
8383
DEPENDS ${TSAN_TEST_DEPS})
8484
endforeach()
8585
endforeach()
86-
set(EXCLUDE_FROM_ALL OFF)
8786
endif()
8887

8988
if(COMPILER_RT_INCLUDE_TESTS)

compiler-rt/test/ubsan/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ macro(add_ubsan_device_testsuite test_mode sanitizer platform arch)
8686
add_lit_testsuite(check-ubsan-${test_mode}-${platform}-${arch}
8787
"UBSan ${CONFIG_NAME} tests"
8888
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/
89+
EXCLUDE_FROM_CHECK_ALL
8990
DEPENDS ${UBSAN_TEST_DEPS})
9091
endmacro()
9192

@@ -102,7 +103,6 @@ if(APPLE)
102103
# "check-asan-iossim-x86_64" and similar. They also require that an extra env
103104
# variable to select which iOS device or simulator to use, e.g.:
104105
# SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6"
105-
set(EXCLUDE_FROM_ALL ON)
106106
set(UBSAN_APPLE_PLATFORMS ${SANITIZER_COMMON_SUPPORTED_OS})
107107
foreach(platform ${UBSAN_APPLE_PLATFORMS})
108108
list_intersect(
@@ -127,7 +127,6 @@ if(APPLE)
127127
endif()
128128
endforeach()
129129
endforeach()
130-
set(EXCLUDE_FROM_ALL OFF)
131130
endif()
132131

133132
add_lit_testsuite(check-ubsan "Running UndefinedBehaviorSanitizer tests"

lldb/test/Shell/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ add_lit_testsuite(check-lldb-repro-capture
2121
"Running lldb shell test suite with reproducer capture"
2222
${CMAKE_CURRENT_BINARY_DIR}
2323
PARAMS "lldb-run-with-repro=capture"
24+
EXCLUDE_FROM_CHECK_ALL
2425
DEPENDS lldb-test-deps)
2526

2627
# Add a lit test suite that runs the shell test by replaying a reproducer.
2728
add_lit_testsuite(check-lldb-repro
2829
"Running lldb shell test suite with reproducer replay"
2930
${CMAKE_CURRENT_BINARY_DIR}
3031
PARAMS "lldb-run-with-repro=replay"
32+
EXCLUDE_FROM_CHECK_ALL
3133
DEPENDS lldb-test-deps)
3234
add_dependencies(check-lldb-repro check-lldb-repro-capture)

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,10 +1560,10 @@ endfunction()
15601560

15611561
# A function to add a set of lit test suites to be driven through 'check-*' targets.
15621562
function(add_lit_testsuite target comment)
1563-
cmake_parse_arguments(ARG "" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
1563+
cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
15641564

15651565
# EXCLUDE_FROM_ALL excludes the test ${target} out of check-all.
1566-
if(NOT EXCLUDE_FROM_ALL)
1566+
if(NOT ARG_EXCLUDE_FROM_CHECK_ALL)
15671567
# Register the testsuites, params and depends for the global check rule.
15681568
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${ARG_UNPARSED_ARGUMENTS})
15691569
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${ARG_PARAMS})
@@ -1582,7 +1582,7 @@ endfunction()
15821582

15831583
function(add_lit_testsuites project directory)
15841584
if (NOT LLVM_ENABLE_IDE)
1585-
cmake_parse_arguments(ARG "" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
1585+
cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
15861586

15871587
# Search recursively for test directories by assuming anything not
15881588
# in a directory called Inputs contains tests.
@@ -1605,6 +1605,7 @@ function(add_lit_testsuites project directory)
16051605
string(TOLOWER "${project}${name_dashes}" name_var)
16061606
add_lit_target("check-${name_var}" "Running lit suite ${lit_suite}"
16071607
${lit_suite}
1608+
${EXCLUDE_FROM_CHECK_ALL}
16081609
PARAMS ${ARG_PARAMS}
16091610
DEPENDS ${ARG_DEPENDS}
16101611
ARGS ${ARG_ARGS}

llvm/test/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ configure_lit_site_cfg(
3030
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
3131
)
3232

33-
# Don't include check-llvm into check-all without LLVM_BUILD_TOOLS.
34-
if(NOT LLVM_BUILD_TOOLS)
35-
set(EXCLUDE_FROM_ALL ON)
36-
endif()
37-
3833
# Set the depends list as a variable so that it can grow conditionally.
3934
# NOTE: Sync the substitutions in test/lit.cfg when adding to this list.
4035
set(LLVM_TEST_DEPENDS
@@ -173,13 +168,21 @@ endif()
173168
add_custom_target(llvm-test-depends DEPENDS ${LLVM_TEST_DEPENDS})
174169
set_target_properties(llvm-test-depends PROPERTIES FOLDER "Tests")
175170

171+
if(LLVM_BUILD_TOOLS)
172+
set(exclude_from_check_all "EXCLUDE_FROM_CHECK_ALL")
173+
else()
174+
set(exclude_from_check_all "")
175+
endif()
176+
176177
add_lit_testsuite(check-llvm "Running the LLVM regression tests"
177178
${CMAKE_CURRENT_BINARY_DIR}
179+
${exclude_from_check_all}
178180
DEPENDS ${LLVM_TEST_DEPENDS}
179181
)
180182
set_target_properties(check-llvm PROPERTIES FOLDER "Tests")
181183

182184
add_lit_testsuites(LLVM ${CMAKE_CURRENT_SOURCE_DIR}
185+
${exclude_from_check_all}
183186
DEPENDS ${LLVM_TEST_DEPENDS}
184187
)
185188

openmp/cmake/OpenMPTesting.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ function(add_openmp_testsuite target comment)
163163
return()
164164
endif()
165165

166-
cmake_parse_arguments(ARG "" "" "DEPENDS;ARGS" ${ARGN})
167-
# EXCLUDE_FROM_ALL excludes the test ${target} out of check-openmp.
168-
if (NOT EXCLUDE_FROM_ALL)
166+
cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "" "DEPENDS;ARGS" ${ARGN})
167+
# EXCLUDE_FROM_CHECK_ALL excludes the test ${target} out of check-openmp.
168+
if (NOT ARG_EXCLUDE_FROM_CHECK_ALL)
169169
# Register the testsuites and depends for the check-openmp rule.
170170
set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_TESTSUITES ${ARG_UNPARSED_ARGUMENTS})
171171
set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_DEPENDS ${ARG_DEPENDS})
@@ -183,6 +183,7 @@ function(add_openmp_testsuite target comment)
183183
add_lit_testsuite(${target}
184184
${comment}
185185
${ARG_UNPARSED_ARGUMENTS}
186+
${ARG_EXCLUDE_FROM_CHECK_ALL}
186187
DEPENDS clang clang-resource-headers FileCheck ${ARG_DEPENDS}
187188
ARGS ${ARG_ARGS}
188189
)
@@ -194,6 +195,5 @@ function(construct_check_openmp_target)
194195
get_property(OPENMP_LIT_DEPENDS GLOBAL PROPERTY OPENMP_LIT_DEPENDS)
195196

196197
# We already added the testsuites themselves, no need to do that again.
197-
set(EXCLUDE_FROM_ALL True)
198-
add_openmp_testsuite(check-openmp "Running OpenMP tests" ${OPENMP_LIT_TESTSUITES} DEPENDS ${OPENMP_LIT_DEPENDS})
198+
add_openmp_testsuite(check-openmp "Running OpenMP tests" ${OPENMP_LIT_TESTSUITES} EXCLUDE_FROM_CHECK_ALL DEPENDS ${OPENMP_LIT_DEPENDS})
199199
endfunction()

openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ if(LIBOMPTARGET_NVPTX_ENABLE_BCLIB)
88
set(deps ${deps} omptarget-nvptx-bc)
99
endif()
1010

11-
# Don't run by default.
12-
set(EXCLUDE_FROM_ALL True)
1311
# Run with only one thread to only launch one application to the GPU at a time.
1412
add_openmp_testsuite(check-libomptarget-nvptx
1513
"Running libomptarget-nvptx tests" ${CMAKE_CURRENT_BINARY_DIR}
14+
EXCLUDE_FROM_CHECK_ALL
1615
DEPENDS ${deps} ARGS -j1)
1716

1817
set(LIBOMPTARGET_NVPTX_TEST_FLAGS "" CACHE STRING

0 commit comments

Comments
 (0)