From af3e934e335900d6f411a7aa1a0e8317e6034ff1 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 23 Jul 2021 14:45:03 +0200 Subject: [PATCH] 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. --- src/lib-test/test-subprocess.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- 2.47.3