summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CTestTimeout/TestTimeout.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-01-13 21:17:19 (GMT)
committerBrad King <brad.king@kitware.com>2020-01-14 15:29:05 (GMT)
commitd1976cd1f226a6da00dbab1b851202f0c69341db (patch)
tree355a7627df350bb5f3612c84d6e537d4d0a3c104 /Tests/RunCMake/CTestTimeout/TestTimeout.c
parent2f5eb1800b76288ad3fbd6404b6b08ab26fb9158 (diff)
downloadCMake-d1976cd1f226a6da00dbab1b851202f0c69341db.zip
CMake-d1976cd1f226a6da00dbab1b851202f0c69341db.tar.gz
CMake-d1976cd1f226a6da00dbab1b851202f0c69341db.tar.bz2
CTest: Fix timeout when grandchild keeps pipes open
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
Diffstat (limited to 'Tests/RunCMake/CTestTimeout/TestTimeout.c')
-rw-r--r--Tests/RunCMake/CTestTimeout/TestTimeout.c7
1 files changed, 7 insertions, 0 deletions
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