[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
This commit is contained in:
Jonas Devlieghere 2020-02-06 15:26:10 -08:00
parent e0d1e83e23
commit 4fe839ef3a
11 changed files with 35 additions and 38 deletions

View file

@ -1,7 +1,3 @@
# All test suites added here should be excuded from check-all
set(EXCLUDE_FROM_ALL On)
if (CMAKE_CFG_INTDIR STREQUAL ".")
set(LLVM_BUILD_MODE ".")
else ()
@ -22,6 +18,7 @@ if(LLVM_BUILD_INSTRUMENTED)
add_lit_testsuite(generate-profraw "Generating clang PGO data"
${CMAKE_CURRENT_BINARY_DIR}/pgo-data/
EXCLUDE_FROM_CHECK_ALL
DEPENDS clang clear-profraw
)
@ -52,6 +49,7 @@ if(APPLE AND DTRACE)
add_lit_testsuite(generate-dtrace-logs "Generating clang dtrace data"
${CMAKE_CURRENT_BINARY_DIR}/order-files/
EXCLUDE_FROM_CHECK_ALL
ARGS -j 1
DEPENDS clang clear-dtrace-logs
)

View file

@ -13,10 +13,6 @@ if(OS_NAME MATCHES "Windows" AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND
message(WARNING "Disabling ASan tests because they are unreliable on Windows 7 and earlier")
endif()
if (SHADOW_MAPPING_UNRELIABLE)
set(EXCLUDE_FROM_ALL TRUE)
endif()
macro(get_bits_for_arch arch bits)
if (${arch} MATCHES "x86_64|powerpc64|powerpc64le|aarch64|arm64|mips64|mips64el|s390x|sparcv9")
set(${bits} 64)
@ -82,7 +78,6 @@ endforeach()
# variable to select which iOS device or simulator to use, e.g.:
# SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6"
if(APPLE)
set(EXCLUDE_FROM_ALL ON)
set(ASAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
set(ASAN_TEST_DYNAMIC True)
set(ASAN_APPLE_PLATFORMS ${SANITIZER_COMMON_SUPPORTED_OS})
@ -116,10 +111,10 @@ if(APPLE)
)
add_lit_testsuite(check-asan-${platform}-${arch} "AddressSanitizer ${platform} ${arch} tests"
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/
EXCLUDE_FROM_CHECK_ALL
DEPENDS ${ASAN_TEST_DEPS})
endforeach()
endforeach()
set(EXCLUDE_FROM_ALL OFF)
endif()
# Add unit tests.
@ -145,8 +140,15 @@ if(COMPILER_RT_INCLUDE_TESTS)
endif()
endif()
if (SHADOW_MAPPING_UNRELIABLE)
set(exclude_from_check_all.g "EXCLUDE_FROM_CHECK_ALL")
else()
set(exclude_from_check_all.g "")
endif()
add_lit_testsuite(check-asan "Running the AddressSanitizer tests"
${ASAN_TESTSUITES}
${exclude_from_check_all}
DEPENDS ${ASAN_TEST_DEPS})
set_target_properties(check-asan PROPERTIES FOLDER "Compiler-RT Misc")
@ -154,12 +156,8 @@ if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
add_lit_testsuite(check-asan-dynamic
"Running the AddressSanitizer tests with dynamic runtime"
${ASAN_DYNAMIC_TESTSUITES}
${exclude_from_check_all.g}
DEPENDS ${ASAN_DYNAMIC_TEST_DEPS})
set_target_properties(check-asan-dynamic
PROPERTIES FOLDER "Compiler-RT Misc")
endif()
# Reset EXCLUDE_FROM_ALL to its initial value.
if (SHADOW_MAPPING_UNRELIABLE)
set(EXCLUDE_FROM_ALL FALSE)
endif()

View file

@ -89,7 +89,6 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
endif()
if (APPLE)
set(EXCLUDE_FROM_ALL ON)
set(LIBFUZZER_TEST_COMPILER ${COMPILER_RT_TEST_COMPILER})
set(FUZZER_APPLE_PLATFORMS ${FUZZER_SUPPORTED_OS})
foreach(platform ${FUZZER_APPLE_PLATFORMS})
@ -119,9 +118,9 @@ if (APPLE)
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py
)
add_lit_testsuite(check-fuzzer-${platform}-${arch} "libFuzzer ${platform} ${arch} tests"
EXCLUDE_FROM_CHECK_ALL
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/
DEPENDS ${LIBFUZZER_TEST_DEPS})
endforeach()
endforeach()
set(EXCLUDE_FROM_ALL OFF)
endif()

View file

@ -49,7 +49,6 @@ endforeach()
# variable to select which iOS device or simulator to use, e.g.:
# SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6"
if(APPLE)
set(EXCLUDE_FROM_ALL ON)
set(TSAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
set(TSAN_APPLE_PLATFORMS ${TSAN_SUPPORTED_OS})
foreach(platform ${TSAN_APPLE_PLATFORMS})
@ -80,10 +79,10 @@ if(APPLE)
)
add_lit_testsuite(check-tsan-${platform}-${arch} "ThreadSanitizer ${platform} ${arch} tests"
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/
EXCLUDE_FROM_CHECK_ALL
DEPENDS ${TSAN_TEST_DEPS})
endforeach()
endforeach()
set(EXCLUDE_FROM_ALL OFF)
endif()
if(COMPILER_RT_INCLUDE_TESTS)

View file

@ -86,6 +86,7 @@ macro(add_ubsan_device_testsuite test_mode sanitizer platform arch)
add_lit_testsuite(check-ubsan-${test_mode}-${platform}-${arch}
"UBSan ${CONFIG_NAME} tests"
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/
EXCLUDE_FROM_CHECK_ALL
DEPENDS ${UBSAN_TEST_DEPS})
endmacro()
@ -102,7 +103,6 @@ if(APPLE)
# "check-asan-iossim-x86_64" and similar. They also require that an extra env
# variable to select which iOS device or simulator to use, e.g.:
# SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6"
set(EXCLUDE_FROM_ALL ON)
set(UBSAN_APPLE_PLATFORMS ${SANITIZER_COMMON_SUPPORTED_OS})
foreach(platform ${UBSAN_APPLE_PLATFORMS})
list_intersect(
@ -127,7 +127,6 @@ if(APPLE)
endif()
endforeach()
endforeach()
set(EXCLUDE_FROM_ALL OFF)
endif()
add_lit_testsuite(check-ubsan "Running UndefinedBehaviorSanitizer tests"

View file

@ -21,6 +21,7 @@ add_lit_testsuite(check-lldb-repro-capture
"Running lldb shell test suite with reproducer capture"
${CMAKE_CURRENT_BINARY_DIR}
PARAMS "lldb-run-with-repro=capture"
EXCLUDE_FROM_CHECK_ALL
DEPENDS lldb-test-deps)
# Add a lit test suite that runs the shell test by replaying a reproducer.
@ -28,5 +29,6 @@ add_lit_testsuite(check-lldb-repro
"Running lldb shell test suite with reproducer replay"
${CMAKE_CURRENT_BINARY_DIR}
PARAMS "lldb-run-with-repro=replay"
EXCLUDE_FROM_CHECK_ALL
DEPENDS lldb-test-deps)
add_dependencies(check-lldb-repro check-lldb-repro-capture)

View file

@ -1560,10 +1560,10 @@ endfunction()
# A function to add a set of lit test suites to be driven through 'check-*' targets.
function(add_lit_testsuite target comment)
cmake_parse_arguments(ARG "" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
# EXCLUDE_FROM_ALL excludes the test ${target} out of check-all.
if(NOT EXCLUDE_FROM_ALL)
if(NOT ARG_EXCLUDE_FROM_CHECK_ALL)
# Register the testsuites, params and depends for the global check rule.
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${ARG_UNPARSED_ARGUMENTS})
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${ARG_PARAMS})
@ -1582,7 +1582,7 @@ endfunction()
function(add_lit_testsuites project directory)
if (NOT LLVM_ENABLE_IDE)
cmake_parse_arguments(ARG "" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
# Search recursively for test directories by assuming anything not
# in a directory called Inputs contains tests.
@ -1605,6 +1605,7 @@ function(add_lit_testsuites project directory)
string(TOLOWER "${project}${name_dashes}" name_var)
add_lit_target("check-${name_var}" "Running lit suite ${lit_suite}"
${lit_suite}
${EXCLUDE_FROM_CHECK_ALL}
PARAMS ${ARG_PARAMS}
DEPENDS ${ARG_DEPENDS}
ARGS ${ARG_ARGS}

View file

@ -30,11 +30,6 @@ configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
)
# Don't include check-llvm into check-all without LLVM_BUILD_TOOLS.
if(NOT LLVM_BUILD_TOOLS)
set(EXCLUDE_FROM_ALL ON)
endif()
# Set the depends list as a variable so that it can grow conditionally.
# NOTE: Sync the substitutions in test/lit.cfg when adding to this list.
set(LLVM_TEST_DEPENDS
@ -173,13 +168,21 @@ endif()
add_custom_target(llvm-test-depends DEPENDS ${LLVM_TEST_DEPENDS})
set_target_properties(llvm-test-depends PROPERTIES FOLDER "Tests")
if(LLVM_BUILD_TOOLS)
set(exclude_from_check_all "EXCLUDE_FROM_CHECK_ALL")
else()
set(exclude_from_check_all "")
endif()
add_lit_testsuite(check-llvm "Running the LLVM regression tests"
${CMAKE_CURRENT_BINARY_DIR}
${exclude_from_check_all}
DEPENDS ${LLVM_TEST_DEPENDS}
)
set_target_properties(check-llvm PROPERTIES FOLDER "Tests")
add_lit_testsuites(LLVM ${CMAKE_CURRENT_SOURCE_DIR}
${exclude_from_check_all}
DEPENDS ${LLVM_TEST_DEPENDS}
)

View file

@ -163,9 +163,9 @@ function(add_openmp_testsuite target comment)
return()
endif()
cmake_parse_arguments(ARG "" "" "DEPENDS;ARGS" ${ARGN})
# EXCLUDE_FROM_ALL excludes the test ${target} out of check-openmp.
if (NOT EXCLUDE_FROM_ALL)
cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "" "DEPENDS;ARGS" ${ARGN})
# EXCLUDE_FROM_CHECK_ALL excludes the test ${target} out of check-openmp.
if (NOT ARG_EXCLUDE_FROM_CHECK_ALL)
# Register the testsuites and depends for the check-openmp rule.
set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_TESTSUITES ${ARG_UNPARSED_ARGUMENTS})
set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_DEPENDS ${ARG_DEPENDS})
@ -183,6 +183,7 @@ function(add_openmp_testsuite target comment)
add_lit_testsuite(${target}
${comment}
${ARG_UNPARSED_ARGUMENTS}
${ARG_EXCLUDE_FROM_CHECK_ALL}
DEPENDS clang clang-resource-headers FileCheck ${ARG_DEPENDS}
ARGS ${ARG_ARGS}
)
@ -194,6 +195,5 @@ function(construct_check_openmp_target)
get_property(OPENMP_LIT_DEPENDS GLOBAL PROPERTY OPENMP_LIT_DEPENDS)
# We already added the testsuites themselves, no need to do that again.
set(EXCLUDE_FROM_ALL True)
add_openmp_testsuite(check-openmp "Running OpenMP tests" ${OPENMP_LIT_TESTSUITES} DEPENDS ${OPENMP_LIT_DEPENDS})
add_openmp_testsuite(check-openmp "Running OpenMP tests" ${OPENMP_LIT_TESTSUITES} EXCLUDE_FROM_CHECK_ALL DEPENDS ${OPENMP_LIT_DEPENDS})
endfunction()

View file

@ -8,11 +8,10 @@ if(LIBOMPTARGET_NVPTX_ENABLE_BCLIB)
set(deps ${deps} omptarget-nvptx-bc)
endif()
# Don't run by default.
set(EXCLUDE_FROM_ALL True)
# Run with only one thread to only launch one application to the GPU at a time.
add_openmp_testsuite(check-libomptarget-nvptx
"Running libomptarget-nvptx tests" ${CMAKE_CURRENT_BINARY_DIR}
EXCLUDE_FROM_CHECK_ALL
DEPENDS ${deps} ARGS -j1)
set(LIBOMPTARGET_NVPTX_TEST_FLAGS "" CACHE STRING

View file

@ -32,8 +32,7 @@ pythonize_bool(LIBOMP_HAVE_LIBATOMIC)
add_openmp_testsuite(check-libomp "Running libomp tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS omp)
# Add target check-ompt, but make sure to not add the tests twice to check-openmp.
set(EXCLUDE_FROM_ALL True)
add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt DEPENDS omp)
add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt EXCLUDE_FROM_CHECK_ALL DEPENDS omp)
# Configure the lit.site.cfg.in file
set(AUTO_GEN_COMMENT "## Autogenerated by libomp configuration.\n# Do not edit!")