mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 14:20:06 -06:00
Tests: Improve RunCMake.ExternalProject rebuild case robustness
The `CONFIGURE_HANDLED_BY_BUILD` case occasionally fails on builds with the `Borland Makefiles` generator due to the `make` tool's 1s file timestamp resolution. Somehow the 1.125s delay is not enough. Several other tests use a 3s delay for Borland tools for the same reason.
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
include(ExternalProject)
|
||||
|
||||
if(CMAKE_GENERATOR STREQUAL "Borland Makefiles" OR
|
||||
CMAKE_GENERATOR STREQUAL "Watcom WMake")
|
||||
set(fs_delay 3)
|
||||
else()
|
||||
set(fs_delay 1.125)
|
||||
endif()
|
||||
|
||||
# Given this setup, on the first build, both configure steps and both build
|
||||
# steps will run. On a noop rebuild, only the build steps will run. Without
|
||||
# CONFIGURE_HANDLED_BY_BUILD, the configure step of proj2 would also run on a
|
||||
@@ -11,7 +18,7 @@ ExternalProject_Add(proj1
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "Doing something"
|
||||
# file(TIMESTAMP) gives back the timestamp in seconds so we sleep a second to
|
||||
# make sure we get a different timestamp on the stamp file
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -E sleep 1.125
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -E sleep ${fs_delay}
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_ALWAYS ON
|
||||
STAMP_DIR "stamp"
|
||||
@@ -20,7 +27,7 @@ ExternalProject_Add(proj2
|
||||
DOWNLOAD_COMMAND ""
|
||||
SOURCE_DIR ""
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "Doing something"
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -E sleep 1.125
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -E sleep ${fs_delay}
|
||||
INSTALL_COMMAND ""
|
||||
CONFIGURE_HANDLED_BY_BUILD ON
|
||||
DEPENDS proj1
|
||||
|
||||
Reference in New Issue
Block a user