mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-10 15:50:50 -06:00
When a test's process creates its own child and exits, the grandchild
may keep pipes open. Fix CTest logic to correctly timeout if the
grandchild does not exit and close the pipes before the timeout expires.
This was broken by commit b5e21d7d2e (CTest: Re-implement test process
handling using libuv, 2017-12-10, v3.11.0-rc1~117^2) which added an
unnecessary condition to the timeout handling.
Fixes: #20116
23 lines
538 B
CMake
23 lines
538 B
CMake
include(RunCTest)
|
|
|
|
if(NOT TIMEOUT)
|
|
# Give the process time to load and start running.
|
|
set(TIMEOUT 4)
|
|
endif()
|
|
|
|
function(run_ctest_timeout CASE_NAME)
|
|
configure_file(${RunCMake_SOURCE_DIR}/TestTimeout.c
|
|
${RunCMake_BINARY_DIR}/${CASE_NAME}/TestTimeout.c COPYONLY)
|
|
run_ctest(${CASE_NAME})
|
|
endfunction()
|
|
|
|
run_ctest_timeout(Basic)
|
|
|
|
if(UNIX)
|
|
string(CONCAT CASE_CMAKELISTS_SUFFIX_CODE [[
|
|
target_compile_definitions(TestTimeout PRIVATE FORK)
|
|
]])
|
|
run_ctest_timeout(Fork)
|
|
unset(CASE_CMAKELISTS_SUFFIX_CODE)
|
|
endif()
|