1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 05:26:58 +08:00

Tests/RunCMake/Configure: Split ninja-specific RerunCMake case

Split the test case from commit f50fb77a4f (Ninja: Regenerate when test
or install scripts are missing, 2024-10-29, v4.0.0-rc1~516^2) into a
dedicated case.
This commit is contained in:
Brad King
2025-03-04 11:09:51 -05:00
committed by Ben Boeckel
parent fb8872653c
commit a30cf4a66a
4 changed files with 24 additions and 11 deletions

View File

@@ -1,4 +0,0 @@
file(READ ${stamp} content)
if(NOT content STREQUAL 5)
set(RunCMake_TEST_FAILED "Expected stamp '5' but got: '${content}'")
endif()

View File

@@ -0,0 +1,4 @@
file(READ ${stamp} content)
if(NOT content STREQUAL 1)
set(RunCMake_TEST_FAILED "Expected stamp '1' but got: '${content}'")
endif()

View File

@@ -0,0 +1,4 @@
set(input ${CMAKE_CURRENT_BINARY_DIR}/input.txt)
set(stamp ${CMAKE_CURRENT_BINARY_DIR}/stamp.txt)
file(READ ${input} content)
file(WRITE ${stamp} "${content}")

View File

@@ -37,16 +37,25 @@ block()
set(RunCMake_TEST_OUTPUT_MERGE 0)
run_cmake_command(RerunCMake-build4 ${CMAKE_COMMAND} --build .)
endif()
if(RunCMake_GENERATOR MATCHES "^Ninja")
file(REMOVE "${error}")
run_cmake(RerunCMake)
endblock()
if(RunCMake_GENERATOR MATCHES "^Ninja")
block()
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RerunCMakeNinja-build)
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
set(input "${RunCMake_TEST_BINARY_DIR}/input.txt")
set(stamp "${RunCMake_TEST_BINARY_DIR}/stamp.txt")
file(WRITE "${input}" "0")
run_cmake(RerunCMakeNinja)
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
# remove cmake_install.cmake to trigger rerun
file(REMOVE "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake")
file(WRITE "${input}" "5")
run_cmake_command(RerunCMake-build5 ${CMAKE_COMMAND} --build .)
endif()
endblock()
file(WRITE "${input}" "1")
run_cmake_command(RerunCMakeNinja-build1 ${CMAKE_COMMAND} --build .)
endblock()
endif()
block()
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RemoveCache-build)