summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CTest/cmProcess.cxx3
-rw-r--r--Tests/RunCMake/CTestTimeout/Fork-stdout.txt6
-rw-r--r--Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/CTestTimeout/TestTimeout.c7
4 files changed, 21 insertions, 3 deletions
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index 2ec9622..cdf899c 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -278,9 +278,6 @@ void cmProcess::OnTimeoutCB(uv_timer_t* timer)
void cmProcess::OnTimeout()
{
- if (this->ProcessState != cmProcess::State::Executing) {
- return;
- }
this->ProcessState = cmProcess::State::Expired;
bool const was_still_reading = !this->ReadHandleClosed;
if (!this->ReadHandleClosed) {
diff --git a/Tests/RunCMake/CTestTimeout/Fork-stdout.txt b/Tests/RunCMake/CTestTimeout/Fork-stdout.txt
new file mode 100644
index 0000000..284e4b1
--- /dev/null
+++ b/Tests/RunCMake/CTestTimeout/Fork-stdout.txt
@@ -0,0 +1,6 @@
+Test project [^
+]*/Tests/RunCMake/CTestTimeout/Fork-build
+ Start 1: TestTimeout
+1/1 Test #1: TestTimeout ......................\*\*\*Timeout +[0-9.]+ sec
++
+0% tests passed, 1 tests failed out of 1
diff --git a/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake b/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake
index 428d0b7..7e96b6d 100644
--- a/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake
@@ -12,3 +12,11 @@ function(run_ctest_timeout 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()
diff --git a/Tests/RunCMake/CTestTimeout/TestTimeout.c b/Tests/RunCMake/CTestTimeout/TestTimeout.c
index 52a5648..5a008a7 100644
--- a/Tests/RunCMake/CTestTimeout/TestTimeout.c
+++ b/Tests/RunCMake/CTestTimeout/TestTimeout.c
@@ -8,6 +8,13 @@
int main(void)
{
+#ifdef FORK
+ pid_t pid = fork();
+ if (pid != 0) {
+ return 0;
+ }
+#endif
+
#if defined(_WIN32)
Sleep((TIMEOUT + 4) * 1000);
#else