]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-execute: check exit code before exit status
authorLennart Poettering <lennart@poettering.net>
Mon, 29 Apr 2019 10:54:26 +0000 (12:54 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 24 May 2019 08:48:28 +0000 (10:48 +0200)
The meaning of the status changes depending on the code, hence let's
always compare the code first, status second.

src/test/test-execute.c

index 9f1cb0ca38945e1a5fcaba2ab20f98a64e7d1441..a27de296a4dfe7359ccb0b07ef96862eab28c437 100644 (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) {