test-execute: check exit code before exit status

The meaning of the status changes depending on the code, hence let's
always compare the code first, status second.
This commit is contained in:
Lennart Poettering 2019-04-29 12:54:26 +02:00
parent 727a1a0607
commit 18f8c5d466
1 changed files with 8 additions and 6 deletions

View File

@ -62,18 +62,20 @@ static void check(const char *func, Manager *m, Unit *unit, int status_expected,
}
}
exec_status_dump(&service->main_exec_status, stdout, "\t");
if (service->main_exec_status.status != status_expected) {
log_error("%s: %s: exit status %d, expected %d",
func, unit->id,
service->main_exec_status.status, status_expected);
abort();
}
if (service->main_exec_status.code != code_expected) {
log_error("%s: %s: exit code %d, expected %d",
func, unit->id,
service->main_exec_status.code, code_expected);
abort();
}
if (service->main_exec_status.status != status_expected) {
log_error("%s: %s: exit status %d, expected %d",
func, unit->id,
service->main_exec_status.status, status_expected);
abort();
}
}
static bool check_nobody_user_and_group(void) {