test: kill all processes launched by test-execute before exiting

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.
This commit is contained in:
Evgeny Vereshchagin 2018-11-17 20:36:31 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 85b18dbec5
commit f7f8e8cbb9
1 changed files with 3 additions and 0 deletions

View 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);
}
}