]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-test: Make sure child processes exit cleanly with SIGTERM
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 23 Jul 2021 12:45:03 +0000 (14:45 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 23 Jul 2021 12:49:04 +0000 (14:49 +0200)
It's normal behavior that the parent process kills the child process with
SIGTERM. This shouldn't result in the child process dying with SIGTERM, but
a clean exit. This was causing http-test-client-errors unit tests to fail
somewhat randomly, especially when running them only with 1 CPU.

src/lib-test/test-subprocess.c

index d92d22ef1098aafc85dcba2134d6381138ad7163..df0c8359d6b30421d05d72aa91696b6e02aa5894 100644 (file)
@@ -284,7 +284,10 @@ test_subprocess_terminate(const siginfo_t *si, void *context ATTR_UNUSED)
        test_subprocess_cleanup();
 
        (void)signal(signo, SIG_DFL);
-       raise(signo);
+       if (signo == SIGTERM)
+               _exit(0);
+       else
+               raise(signo);
 }
 
 static void test_atexit(void)