From: Timo Sirainen Date: Fri, 23 Jul 2021 12:45:03 +0000 (+0200) Subject: lib-test: Make sure child processes exit cleanly with SIGTERM X-Git-Tag: 2.3.17~270 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=af3e934e335900d6f411a7aa1a0e8317e6034ff1;p=thirdparty%2Fdovecot%2Fcore.git lib-test: Make sure child processes exit cleanly with SIGTERM 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. --- diff --git a/src/lib-test/test-subprocess.c b/src/lib-test/test-subprocess.c index d92d22ef10..df0c8359d6 100644 --- a/src/lib-test/test-subprocess.c +++ b/src/lib-test/test-subprocess.c @@ -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)