Skip to content

Commit f39a971

Browse files
committed
[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 llvm#54154. Differential Revision: https://reviews.llvm.org/D121276
1 parent c8e6d68 commit f39a971

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

llvm/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,9 +1138,6 @@ if( LLVM_INCLUDE_TESTS )
11381138
DEPENDS ${LLVM_LIT_DEPENDS} ${LLVM_ADDITIONAL_TEST_TARGETS}
11391139
ARGS ${LLVM_LIT_EXTRA_ARGS}
11401140
)
1141-
if(TARGET check-runtimes)
1142-
add_dependencies(check-all check-runtimes)
1143-
endif()
11441141
add_custom_target(test-depends
11451142
DEPENDS ${LLVM_LIT_DEPENDS} ${LLVM_ADDITIONAL_TEST_DEPENDS})
11461143
set_target_properties(test-depends PROPERTIES FOLDER "Tests")

llvm/runtimes/CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,13 @@ function(runtime_default_target)
220220
endforeach()
221221

222222
if(LLVM_INCLUDE_TESTS)
223+
include(${LLVM_BINARY_DIR}/runtimes/Tests.cmake OPTIONAL RESULT_VARIABLE have_tests)
224+
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
225+
if(have_tests)
226+
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${RUNTIMES_LIT_TESTSUITES})
227+
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${RUNTIMES_LIT_PARAMS})
228+
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${RUNTIMES_LIT_EXTRA_ARGS})
229+
endif()
223230
list(APPEND test_targets runtimes-test-depends check-runtimes)
224231
endif()
225232

@@ -296,6 +303,13 @@ function(runtime_register_target name target)
296303
endforeach()
297304

298305
if(LLVM_INCLUDE_TESTS)
306+
include(${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake OPTIONAL RESULT_VARIABLE have_tests)
307+
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake)
308+
if(have_tests)
309+
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${RUNTIMES_LIT_TESTSUITES})
310+
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${RUNTIMES_LIT_PARAMS})
311+
set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${RUNTIMES_LIT_EXTRA_ARGS})
312+
endif()
299313
set(runtimes-test-depends-${name} runtimes-test-depends)
300314
set(check-runtimes-${name} check-runtimes)
301315
list(APPEND ${name}_test_targets runtimes-test-depends-${name} check-runtimes-${name})
@@ -468,7 +482,6 @@ if(runtimes)
468482

469483
if(LLVM_INCLUDE_TESTS)
470484
set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_DEPENDS runtimes-test-depends)
471-
set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-runtimes)
472485

473486
set(RUNTIMES_TEST_DEPENDS
474487
FileCheck

runtimes/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,16 @@ if(LLVM_INCLUDE_TESTS)
238238
add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit
239239
${CMAKE_CURRENT_BINARY_DIR}/llvm-lit)
240240
endif()
241+
242+
if(LLVM_RUNTIMES_TARGET)
243+
configure_file(
244+
${CMAKE_CURRENT_SOURCE_DIR}/Tests.cmake.in
245+
${LLVM_BINARY_DIR}/runtimes/${LLVM_RUNTIMES_TARGET}/Tests.cmake)
246+
else()
247+
configure_file(
248+
${CMAKE_CURRENT_SOURCE_DIR}/Tests.cmake.in
249+
${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
250+
endif()
241251
endif()
242252

243253
get_property(SUB_COMPONENTS GLOBAL PROPERTY SUB_COMPONENTS)

runtimes/Tests.cmake.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
set(RUNTIMES_LIT_TESTSUITES @RUNTIMES_LIT_TESTSUITES@)
2+
set(RUNTIMES_LIT_PARAMS @RUNTIMES_LIT_PARAMS@)
3+
set(RUNTIMES_LIT_EXTRA_ARGS @RUNTIMES_LIT_EXTRA_ARGS@)

0 commit comments

Comments
 (0)