[llvm] 4fe839e - [CMake] Rename EXCLUDE_FROM_ALL and make it an argument to add_lit_testsuite

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 6 15:40:08 PST 2020


Author: Jonas Devlieghere
Date: 2020-02-06T15:33:18-08:00
New Revision: 4fe839ef3a51e0ea2e72ea2f8e209790489407a2

URL: https://github.com/llvm/llvm-project/commit/4fe839ef3a51e0ea2e72ea2f8e209790489407a2
DIFF: https://github.com/llvm/llvm-project/commit/4fe839ef3a51e0ea2e72ea2f8e209790489407a2.diff

LOG: [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

Added: 
    

Modified: 
    clang/utils/perf-training/CMakeLists.txt
    compiler-rt/test/asan/CMakeLists.txt
    compiler-rt/test/fuzzer/CMakeLists.txt
    compiler-rt/test/tsan/CMakeLists.txt
    compiler-rt/test/ubsan/CMakeLists.txt
    lldb/test/Shell/CMakeLists.txt
    llvm/cmake/modules/AddLLVM.cmake
    llvm/test/CMakeLists.txt
    openmp/cmake/OpenMPTesting.cmake
    openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
    openmp/runtime/test/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/utils/perf-training/CMakeLists.txt b/clang/utils/perf-training/CMakeLists.txt
index 25bb7f49a5ef..1f8612206b7a 100644
--- a/clang/utils/perf-training/CMakeLists.txt
+++ b/clang/utils/perf-training/CMakeLists.txt
@@ -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
     )

diff  --git a/compiler-rt/test/asan/CMakeLists.txt b/compiler-rt/test/asan/CMakeLists.txt
index 316442e856ae..f756064f47e0 100644
--- a/compiler-rt/test/asan/CMakeLists.txt
+++ b/compiler-rt/test/asan/CMakeLists.txt
@@ -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()

diff  --git a/compiler-rt/test/fuzzer/CMakeLists.txt b/compiler-rt/test/fuzzer/CMakeLists.txt
index 2e6e859709be..5a027bd07b40 100644
--- a/compiler-rt/test/fuzzer/CMakeLists.txt
+++ b/compiler-rt/test/fuzzer/CMakeLists.txt
@@ -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()

diff  --git a/compiler-rt/test/tsan/CMakeLists.txt b/compiler-rt/test/tsan/CMakeLists.txt
index 87457ea4494d..35b0f417a6c6 100644
--- a/compiler-rt/test/tsan/CMakeLists.txt
+++ b/compiler-rt/test/tsan/CMakeLists.txt
@@ -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)

diff  --git a/compiler-rt/test/ubsan/CMakeLists.txt b/compiler-rt/test/ubsan/CMakeLists.txt
index 693f83291753..1ef554f0a88a 100644
--- a/compiler-rt/test/ubsan/CMakeLists.txt
+++ b/compiler-rt/test/ubsan/CMakeLists.txt
@@ -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"

diff  --git a/lldb/test/Shell/CMakeLists.txt b/lldb/test/Shell/CMakeLists.txt
index e02adb389db2..0c78e25d9cee 100644
--- a/lldb/test/Shell/CMakeLists.txt
+++ b/lldb/test/Shell/CMakeLists.txt
@@ -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)

diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index fce36ba21253..740523d6d70e 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -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}

diff  --git a/llvm/test/CMakeLists.txt b/llvm/test/CMakeLists.txt
index 82d5783f95bb..a20608d7fbc8 100644
--- a/llvm/test/CMakeLists.txt
+++ b/llvm/test/CMakeLists.txt
@@ -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}
   )
 

diff  --git a/openmp/cmake/OpenMPTesting.cmake b/openmp/cmake/OpenMPTesting.cmake
index e3d2c6b2c07f..9d613e361e11 100644
--- a/openmp/cmake/OpenMPTesting.cmake
+++ b/openmp/cmake/OpenMPTesting.cmake
@@ -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()

diff  --git a/openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt b/openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
index 33945d1672a1..1eabeb25ff98 100644
--- a/openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
+++ b/openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
@@ -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

diff  --git a/openmp/runtime/test/CMakeLists.txt b/openmp/runtime/test/CMakeLists.txt
index 851377f735cb..b5376d3efdfd 100644
--- a/openmp/runtime/test/CMakeLists.txt
+++ b/openmp/runtime/test/CMakeLists.txt
@@ -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!")


        


More information about the llvm-commits mailing list