ctest hangs when a test segfaults
If a test segfaults , then ctest hangs, instead of exiting with an error.
I just run this in command line:
$ /usr/local/bin/ctest --build-config Debug
... and with a test that segfaults (deference of NULL pointer), ctest does not detect the crash and hangs forever.
Of course it's a bug in the test which should not segfault, but ctest should not hang forever when a test crashes.
Running ctest with strace on Linux, I can see the SEGV in strace:
...snip...
select(20, [16 19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [16 19], NULL, NULL, {0, 99998}) = 1 (in [19], left {0, 19850})
read(19, "[2016-Dec-14 12:25:45.378501] <i"..., 1024) = 94
select(20, [16 19], NULL, NULL, {0, 19674}) = 0 (Timeout)
select(20, [16 19], NULL, NULL, {0, 99999}) = 1 (in [19], left {0, 24490})
read(19, "[2016-Dec-14 12:25:45.474044] <n"..., 1024) = 55
select(20, [16 19], NULL, NULL, {0, 24309}) = 1 (in [19], left {0, 23909})
read(19, "[2016-Dec-14 12:25:45.474695] <n"..., 1024) = 54
select(20, [16 19], NULL, NULL, {0, 23746}) = 0 (Timeout)
select(20, [16 19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [16 19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [16 19], NULL, NULL, {0, 99999}) = ? ERESTARTNOHAND (To be restarted if no handler)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_DUMPED, si_pid=29064, si_status=SIGSEGV, si_utime=6342, si_stime=465} ---
read(16, 0x7ffcc958e860, 1) = -1 EAGAIN (Resource temporarily unavailable)
write(18, "\1", 1) = 1
rt_sigreturn() = -1 EINTR (Interrupted system call)
select(20, [16 19], NULL, NULL, {0, 27997}) = 1 (in [16], left {0, 27996})
read(16, "\1", 1024) = 1
rt_sigprocmask(SIG_BLOCK, [INT TERM], [], 8) = 0
wait4(29064, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGSEGV && WCOREDUMP(s)}], WNOHANG, NULL) = 29064
close(18) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
select(20, [16 19], NULL, NULL, {0, 27279}) = 1 (in [16], left {0, 27277})
read(16, "", 1024) = 0
close(16) = 0
select(20, [19], NULL, NULL, {0, 27076}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99998}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99998}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99998}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99999}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99998}) = 0 (Timeout)
select(20, [19], NULL, NULL, {0, 99999}) = 0 (Timeout)
etc. ctest then prints such messages forever.
I see this with the latest cmake-3.7.1 (and older) as well as with latest version git (git SHA1 61001557).