Skip to content

Commit 3a481d4

Browse files
petrhosektru
authored andcommitted
[runtimes] Use a response file for runtimes test suites
We don't know which test suites are going to be included by runtimes builds so we cannot include those before running the sub-build, but that's not possible during the LLVM build configuration. We instead use a response file that's populated by the runtimes build as a level of indirection. This addresses the issue described in: https://discourse.llvm.org/t/cmake-regeneration-is-broken/62788 Differential Revision: https://reviews.llvm.org/D132438 (cherry picked from commit 992e10a)
1 parent 427e1ea commit 3a481d4

File tree

3 files changed

+8
-23
lines changed

3 files changed

+8
-23
lines changed

llvm/runtimes/CMakeLists.txt

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,7 @@ function(runtime_default_target)
219219
endforeach()
220220

221221
if(LLVM_INCLUDE_TESTS)
222-
include(${LLVM_BINARY_DIR}/runtimes/Tests.cmake OPTIONAL RESULT_VARIABLE have_tests)
223-
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
224-
if(have_tests)
225-
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES ${SUB_LIT_TESTSUITES})
226-
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_PARAMS ${SUB_LIT_PARAMS})
227-
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_EXTRA_ARGS ${SUB_LIT_EXTRA_ARGS})
228-
endif()
222+
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES "@${LLVM_BINARY_DIR}/runtimes/Tests.rsp")
229223
list(APPEND test_targets runtimes-test-depends check-runtimes)
230224
endif()
231225

@@ -301,13 +295,7 @@ function(runtime_register_target name target)
301295
endforeach()
302296

303297
if(LLVM_INCLUDE_TESTS)
304-
include(${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake OPTIONAL RESULT_VARIABLE have_tests)
305-
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake)
306-
if(have_tests)
307-
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES ${SUB_LIT_TESTSUITES})
308-
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_PARAMS ${SUB_LIT_PARAMS})
309-
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_EXTRA_ARGS ${SUB_LIT_EXTRA_ARGS})
310-
endif()
298+
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES "@${LLVM_BINARY_DIR}/runtimes/${name}/Tests.rsp")
311299
set(runtimes-test-depends-${name} runtimes-test-depends)
312300
set(check-runtimes-${name} check-runtimes)
313301
list(APPEND ${name}_test_targets runtimes-test-depends-${name} check-runtimes-${name})
@@ -497,5 +485,7 @@ if(runtimes)
497485
foreach(target ${test_targets} ${SUB_CHECK_TARGETS})
498486
add_dependencies(${target} ${RUNTIMES_TEST_DEPENDS})
499487
endforeach()
488+
489+
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_ADDITIONAL_TEST_TARGETS runtimes ${RUNTIMES_TEST_DEPENDS})
500490
endif()
501491
endif()

runtimes/CMakeLists.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,12 @@ if(LLVM_INCLUDE_TESTS)
244244
${CMAKE_CURRENT_BINARY_DIR}/llvm-lit)
245245
endif()
246246

247+
get_property(LLVM_RUNTIMES_LIT_TESTSUITES GLOBAL PROPERTY LLVM_RUNTIMES_LIT_TESTSUITES)
248+
string(REPLACE ";" "\n" LLVM_RUNTIMES_LIT_TESTSUITES "${LLVM_RUNTIMES_LIT_TESTSUITES}")
247249
if(LLVM_RUNTIMES_TARGET)
248-
configure_file(
249-
${CMAKE_CURRENT_SOURCE_DIR}/Tests.cmake.in
250-
${LLVM_BINARY_DIR}/runtimes/${LLVM_RUNTIMES_TARGET}/Tests.cmake)
250+
file(WRITE ${LLVM_BINARY_DIR}/runtimes/${LLVM_RUNTIMES_TARGET}/Tests.rsp ${LLVM_RUNTIMES_LIT_TESTSUITES})
251251
else()
252-
configure_file(
253-
${CMAKE_CURRENT_SOURCE_DIR}/Tests.cmake.in
254-
${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
252+
file(WRITE ${LLVM_BINARY_DIR}/runtimes/Tests.rsp ${LLVM_RUNTIMES_LIT_TESTSUITES})
255253
endif()
256254
endif()
257255

runtimes/Tests.cmake.in

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)