chiark / gitweb /
importd: add new bus calls for importing local tar and raw images
[elogind.git] / src / journal / test-journal-verify.c
index 6b7414a4b1bff8ba0a10e6f580492a1010a694bb..de9cd9c8b8c8c35e50dadbe4f582089bdf53a416 100644 (file)
@@ -27,7 +27,6 @@
 #include "log.h"
 #include "journal-file.h"
 #include "journal-verify.h"
-#include "journal-authenticate.h"
 
 #define N_ENTRIES 6000
 #define RANDOM_RANGE 77
@@ -38,17 +37,17 @@ static void bit_toggle(const char *fn, uint64_t p) {
         int fd;
 
         fd = open(fn, O_RDWR|O_CLOEXEC);
-        assert(fd >= 0);
+        assert_se(fd >= 0);
 
         r = pread(fd, &b, 1, p/8);
-        assert(r == 1);
+        assert_se(r == 1);
 
         b ^= 1 << (p % 8);
 
         r = pwrite(fd, &b, 1, p/8);
-        assert(r == 1);
+        assert_se(r == 1);
 
-        close_nointr_nofail(fd);
+        safe_close(fd);
 }
 
 static int raw_verify(const char *fn, const char *verification_key) {
@@ -77,6 +76,10 @@ int main(int argc, char *argv[]) {
         struct stat st;
         uint64_t p;
 
+        /* journal_file_open requires a valid machine id */
+        if (access("/etc/machine-id", F_OK) != 0)
+                return EXIT_TEST_SKIP;
+
         log_set_max_level(LOG_DEBUG);
 
         assert_se(mkdtemp(t));