]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: kill all processes launched by test-execute before exiting
authorEvgeny Vereshchagin <evvers@ya.ru>
Sat, 17 Nov 2018 19:36:31 +0000 (20:36 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 19 Nov 2018 08:24:22 +0000 (09:24 +0100)
As was shown in https://github.com/systemd/systemd/issues/10696#issuecomment-439613204,
currently `meson` waits for 1080 seconds (which is three times the global timeout) for the
test to fail completely even though it takes just two minutes for it to really fail. This
happens because the test itself leaves the services it has launched behind, which, in turn, makes
meson think that the test is still in progress. KILL_ALL with SIGKILL should make the issue
go away.

src/test/test-execute.c

index e6715f9574994818e03cf87a8ee93a34afa2a48a..0e378f68c01dc28b5e74a28bd5731c75c7198c98 100644 (file)
@@ -54,6 +54,9 @@ static void check(Manager *m, Unit *unit, int status_expected, int code_expected
                 n = now(CLOCK_MONOTONIC);
                 if (ts + timeout < n) {
                         log_error("Test timeout when testing %s", unit->id);
+                        r = UNIT_VTABLE(unit)->kill(unit, KILL_ALL, 9, NULL);
+                        if (r < 0)
+                                log_error_errno(r, "Failed to kill %s: %m", unit->id);
                         exit(EXIT_FAILURE);
                 }
         }