chiark / gitweb /
log: rearrange log function naming
[elogind.git] / src / journal / test-journal-interleaving.c
index 1a058eaedd2838d498648292ab3f3cb8c8b02c8a..23a26c43f633814042e83cfae38fd691efb77f60 100644 (file)
@@ -23,7 +23,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#include <systemd/sd-journal.h>
+#include "systemd/sd-journal.h"
 
 #include "journal-file.h"
 #include "journal-internal.h"
 
 static bool arg_keep = false;
 
-_noreturn_ static void log_assert_errno(const char *text, int eno, const char *file, int line, const char *func) {
-        log_meta(LOG_CRIT, file, line, func,
-                 "'%s' failed at %s:%u (%s): %s.",
-                 text, file, line, func, strerror(eno));
+noreturn static void log_assert_errno(const char *text, int eno, const char *file, int line, const char *func) {
+        log_internal(LOG_CRIT, 0, file, line, func,
+                     "'%s' failed at %s:%u (%s): %s.",
+                     text, file, line, func, strerror(eno));
         abort();
 }
 
@@ -50,20 +50,17 @@ _noreturn_ static void log_assert_errno(const char *text, int eno, const char *f
                         log_assert_errno(#expr, -_r_, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
         } while (false)
 
-static JournalFile *test_open (const char *name)
-{
+static JournalFile *test_open(const char *name) {
         JournalFile *f;
         assert_ret(journal_file_open(name, O_RDWR|O_CREAT, 0644, true, false, NULL, NULL, NULL, &f));
         return f;
 }
 
-static void test_close (JournalFile *f)
-{
+static void test_close(JournalFile *f) {
         journal_file_close (f);
 }
 
-static void append_number(JournalFile *f, int n, uint64_t *seqnum)
-{
+static void append_number(JournalFile *f, int n, uint64_t *seqnum) {
         char *p;
         dual_timestamp ts;
         struct iovec iovec[1];
@@ -74,13 +71,12 @@ static void append_number(JournalFile *f, int n, uint64_t *seqnum)
         iovec[0].iov_base = p;
         iovec[0].iov_len = strlen(p);
         assert_ret(journal_file_append_entry(f, &ts, iovec, 1, seqnum, NULL, NULL));
-        free (p);
+        free(p);
 }
 
-static void test_check_number (sd_journal *j, int n)
-{
+static void test_check_number (sd_journal *j, int n) {
         const void *d;
-        char *k;
+        _cleanup_free_ char *k;
         size_t l;
         int x;
 
@@ -92,9 +88,10 @@ static void test_check_number (sd_journal *j, int n)
         assert_se(n == x);
 }
 
-static void test_check_numbers_down (sd_journal *j, int count)
-{
-        for (int i = 1; i <= count; i++) {
+static void test_check_numbers_down (sd_journal *j, int count) {
+        int i;
+
+        for (i = 1; i <= count; i++) {
                 int r;
                 test_check_number(j, i);
                 assert_ret(r = sd_journal_next(j));
@@ -106,8 +103,7 @@ static void test_check_numbers_down (sd_journal *j, int count)
 
 }
 
-static void test_check_numbers_up (sd_journal *j, int count)
-{
+static void test_check_numbers_up (sd_journal *j, int count) {
         for (int i = count; i >= 1; i--) {
                 int r;
                 test_check_number(j, i);
@@ -144,8 +140,7 @@ static void setup_interleaved(void) {
         test_close(two);
 }
 
-static void test_skip(void (*setup)(void))
-{
+static void test_skip(void (*setup)(void)) {
         char t[] = "/tmp/journal-skip-XXXXXX";
         sd_journal *j;
         int r;
@@ -194,7 +189,7 @@ static void test_skip(void (*setup)(void))
         if (arg_keep)
                 log_info("Not removing %s", t);
         else {
-                journal_directory_vacuum(".", 3000000, 0, 0, NULL);
+                journal_directory_vacuum(".", 3000000, 0, NULL, true);
 
                 assert_se(rm_rf_dangerous(t, false, true, false) >= 0);
         }
@@ -279,7 +274,7 @@ static void test_sequence_numbers(void) {
         if (arg_keep)
                 log_info("Not removing %s", t);
         else {
-                journal_directory_vacuum(".", 3000000, 0, 0, NULL);
+                journal_directory_vacuum(".", 3000000, 0, NULL, true);
 
                 assert_se(rm_rf_dangerous(t, false, true, false) >= 0);
         }