From: Daan De Meyer Date: Wed, 8 May 2024 08:20:20 +0000 (+0200) Subject: TEST-07-PID1: Fix race in aux-scope subtest X-Git-Tag: v256-rc2~72^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b438ebd7bc11d23e3cbdffa1935513d02e7b797c;p=thirdparty%2Fsystemd.git TEST-07-PID1: Fix race in aux-scope subtest Currently test-aux-scope.service can get killed by the test before it's had a chance to setup its signal handler. Make it Type=notify to fix the race. Fixes #32670 (hopefully) --- diff --git a/src/test/test-aux-scope.c b/src/test/test-aux-scope.c index 175757b1c18..c6a1d292730 100644 --- a/src/test/test-aux-scope.c +++ b/src/test/test-aux-scope.c @@ -10,6 +10,7 @@ #include "bus-error.h" #include "bus-message.h" #include "bus-wait-for-jobs.h" +#include "daemon-util.h" #include "fd-util.h" #include "log.h" #include "missing_syscall.h" @@ -152,6 +153,10 @@ int main(int argc, char *argv[]) { pids[i] = TAKE_PIDREF(pidref); } + r = sd_notify(false, NOTIFY_READY); + if (r < 0) + return log_error_errno(r, "Failed to send readiness notification: %m"); + r = sd_event_loop(event); if (r < 0) return log_error_errno(r, "Failed to run event loop: %m"); diff --git a/test/units/testsuite-07.aux-scope.sh b/test/units/testsuite-07.aux-scope.sh index 41c0617d4db..8e2a99ce027 100755 --- a/test/units/testsuite-07.aux-scope.sh +++ b/test/units/testsuite-07.aux-scope.sh @@ -11,7 +11,7 @@ if ! grep -q pidfd_open /proc/kallsyms; then fi systemd-run --unit test-aux-scope.service \ - -p Slice=aux.slice -p Type=exec -p TasksMax=99 -p CPUWeight=199 -p IPAccounting=yes \ + --service-type notify -p Slice=aux.slice -p TasksMax=99 -p CPUWeight=199 -p IPAccounting=yes \ /usr/lib/systemd/tests/unit-tests/manual/test-aux-scope kill -s USR1 "$(systemctl show --value --property MainPID test-aux-scope.service)"