]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-journal-verify: Use a more thorough machine ID check
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 6 May 2023 09:34:34 +0000 (11:34 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 8 May 2023 21:09:43 +0000 (06:09 +0900)
Let's not only check if the file exists but also check if it contains
a valid machine ID.

src/journal/test-journal-verify.c

index f15071d81d31750b5b18d07596d502f9baf70c5e..97cc0b15145a9d91b8b83c56952ff519e07e859b 100644 (file)
@@ -80,8 +80,8 @@ static int run_test(const char *verification_key, ssize_t max_iterations) {
         assert_se(m != NULL);
 
         /* managed_journal_file_open requires a valid machine id */
-        if (access("/etc/machine-id", F_OK) != 0)
-                return log_tests_skipped("/etc/machine-id not found");
+        if (sd_id128_get_machine(NULL) < 0)
+                return log_tests_skipped("No valid machine ID found");
 
         test_setup_logging(LOG_DEBUG);