mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
Tests/RunCMake/Codegen: Fix rebuild cases on make tools with 1s resolution
Revise a test from commit 36fcfb3e01 (Tests/RunCMake/Codegen: Extend
coverage, 2026-10-25, v4.5.0-rc2~4^2) to pass more reliably on such
`make` tools.
This commit is contained in:
1 parent
9e1c78ad92
commit
4daf96a1eb
1 file changed
+9
-1
@@ -1,5 +1,12 @@
|
||||
include(RunCMake)
|
||||
|
||||
if(RunCMake_GENERATOR STREQUAL "Borland Makefiles" OR
|
||||
RunCMake_GENERATOR STREQUAL "Watcom WMake")
|
||||
set(fs_delay 3)
|
||||
else()
|
||||
set(fs_delay 1.125)
|
||||
endif()
|
||||
|
||||
function(run_codegen case)
|
||||
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build)
|
||||
|
||||
@@ -65,10 +72,11 @@ block()
|
||||
set(RunCMake_TEST_NO_CLEAN 1)
|
||||
run_cmake_command(rebuild-build1 ${CMAKE_COMMAND} --build . --target codegen --config Debug)
|
||||
# Make the output newer than its input but with different content.
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${fs_delay})
|
||||
file(WRITE ${RunCMake_TEST_BINARY_DIR}/generated.h "stale")
|
||||
run_cmake_command(rebuild-build2 ${CMAKE_COMMAND} --build . --target codegen --config Debug)
|
||||
# Ensure the input is newer than the output.
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${fs_delay})
|
||||
file(WRITE ${RunCMake_TEST_BINARY_DIR}/input.txt "2")
|
||||
run_cmake_command(rebuild-build3 ${CMAKE_COMMAND} --build . --target codegen --config Debug)
|
||||
endblock()
|
||||
|
||||
Reference in new issue
Block a user