Author: Petr Hosek Date: 2022-03-10T12:50:54-08:00 New Revision: e54a7bf0c0f14115ec3bd7738850ee83f8428319
URL: https://github.com/llvm/llvm-project/commit/e54a7bf0c0f14115ec3bd7738850ee83f8428319 DIFF: https://github.com/llvm/llvm-project/commit/e54a7bf0c0f14115ec3bd7738850ee83f8428319.diff LOG: [CMake] Include runtimes test suites in check-all Prior to this change, we would make check-all depend on check-runtimes which is a target that runs tests in the runtimes build. This means that the runtimes tests are going to run prior to other test suites in check-all, and if one of them fails, we won't run the other test suites at all. To address this issue, we instead collect the list of test suites and their dependencies from the runtimes subbuild, and include them in check-all, so a failure of runtimes test suite doesn't prevent other test suites from being executed. This addresses https://github.com/llvm/llvm-project/issues/54154. Differential Revision: https://reviews.llvm.org/D121276 (cherry picked from commit f39a971d821097df1936469b3fd5ba6a9b8e4b69) Added: runtimes/Tests.cmake.in Modified: llvm/CMakeLists.txt llvm/runtimes/CMakeLists.txt runtimes/CMakeLists.txt Removed: ################################################################################ diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index 00d01f4ddbbd2..123998df34c84 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -1138,9 +1138,6 @@ if( LLVM_INCLUDE_TESTS ) DEPENDS ${LLVM_LIT_DEPENDS} ${LLVM_ADDITIONAL_TEST_TARGETS} ARGS ${LLVM_LIT_EXTRA_ARGS} ) - if(TARGET check-runtimes) - add_dependencies(check-all check-runtimes) - endif() add_custom_target(test-depends DEPENDS ${LLVM_LIT_DEPENDS} ${LLVM_ADDITIONAL_TEST_DEPENDS}) set_target_properties(test-depends PROPERTIES FOLDER "Tests") diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt index 05567b5234eea..d7918c211e40e 100644 --- a/llvm/runtimes/CMakeLists.txt +++ b/llvm/runtimes/CMakeLists.txt @@ -220,6 +220,13 @@ function(runtime_default_target) endforeach() if(LLVM_INCLUDE_TESTS) + include(${LLVM_BINARY_DIR}/runtimes/Tests.cmake OPTIONAL RESULT_VARIABLE have_tests) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Tests.cmake) + if(have_tests) + set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${RUNTIMES_LIT_TESTSUITES}) + set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${RUNTIMES_LIT_PARAMS}) + set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${RUNTIMES_LIT_EXTRA_ARGS}) + endif() list(APPEND test_targets runtimes-test-depends check-runtimes) endif() @@ -296,6 +303,13 @@ function(runtime_register_target name target) endforeach() if(LLVM_INCLUDE_TESTS) + include(${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake OPTIONAL RESULT_VARIABLE have_tests) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake) + if(have_tests) + set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${RUNTIMES_LIT_TESTSUITES}) + set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${RUNTIMES_LIT_PARAMS}) + set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${RUNTIMES_LIT_EXTRA_ARGS}) + endif() set(runtimes-test-depends-${name} runtimes-test-depends) set(check-runtimes-${name} check-runtimes) list(APPEND ${name}_test_targets runtimes-test-depends-${name} check-runtimes-${name}) @@ -468,7 +482,6 @@ if(runtimes) if(LLVM_INCLUDE_TESTS) set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_DEPENDS runtimes-test-depends) - set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-runtimes) set(RUNTIMES_TEST_DEPENDS FileCheck diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index 1400233b73f6d..945d3de9ec44b 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -221,6 +221,16 @@ if(LLVM_INCLUDE_TESTS) add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit) endif() + + if(LLVM_RUNTIMES_TARGET) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/Tests.cmake.in + ${LLVM_BINARY_DIR}/runtimes/${LLVM_RUNTIMES_TARGET}/Tests.cmake) + else() + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/Tests.cmake.in + ${LLVM_BINARY_DIR}/runtimes/Tests.cmake) + endif() endif() get_property(SUB_COMPONENTS GLOBAL PROPERTY SUB_COMPONENTS) diff --git a/runtimes/Tests.cmake.in b/runtimes/Tests.cmake.in new file mode 100644 index 0000000000000..4df40f237b3f5 --- /dev/null +++ b/runtimes/Tests.cmake.in @@ -0,0 +1,3 @@ +set(RUNTIMES_LIT_TESTSUITES @RUNTIMES_LIT_TESTSUITES@) +set(RUNTIMES_LIT_PARAMS @RUNTIMES_LIT_PARAMS@) +set(RUNTIMES_LIT_EXTRA_ARGS @RUNTIMES_LIT_EXTRA_ARGS@) _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
