]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-log: move logging call where we can still see it
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 3 Aug 2021 14:09:52 +0000 (16:09 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 7 Aug 2021 06:50:27 +0000 (08:50 +0200)
We crank the level up in the loop, so we wouldn't see message
from log_info_errno().

Also move the loop iterator declaration inline.

src/test/test-log.c

index 861309eb3aa869035576b1cf965c05c79f5f6710..de8399dea8a1714d47f6ce66b969f4b5c58f91ae 100644 (file)
@@ -66,11 +66,11 @@ static void test_log_syntax(void) {
 }
 
 int main(int argc, char* argv[]) {
-        int target;
-
         test_file();
 
-        for (target = 0; target < _LOG_TARGET_MAX; target++) {
+        assert_se(log_info_errno(SYNTHETIC_ERRNO(EUCLEAN), "foo") == -EUCLEAN);
+
+        for (int target = 0; target < _LOG_TARGET_MAX; target++) {
                 log_set_target(target);
                 log_open();
 
@@ -79,7 +79,5 @@ int main(int argc, char* argv[]) {
                 test_log_syntax();
         }
 
-        assert_se(log_info_errno(SYNTHETIC_ERRNO(EUCLEAN), "foo") == -EUCLEAN);
-
         return 0;
 }