From: Yu Watanabe Date: Tue, 28 Nov 2023 21:08:11 +0000 (+0900) Subject: test: split out finalization task X-Git-Tag: v255~34^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=76b7a346ed0f193111f50ec7388126b959d98256;p=platform%2Fupstream%2Fsystemd.git test: split out finalization task --- diff --git a/src/libsystemd/sd-journal/test-journal-interleaving.c b/src/libsystemd/sd-journal/test-journal-interleaving.c index eff908b..af4f506 100644 --- a/src/libsystemd/sd-journal/test-journal-interleaving.c +++ b/src/libsystemd/sd-journal/test-journal-interleaving.c @@ -58,6 +58,20 @@ static void test_close(JournalFile *f) { (void) journal_file_offline_close(f); } +static void test_done(const char *t) { + log_info("Done..."); + + if (arg_keep) + log_info("Not removing %s", t); + else { + journal_directory_vacuum(".", 3000000, 0, 0, NULL, true); + + assert_se(rm_rf(t, REMOVE_ROOT|REMOVE_PHYSICAL) >= 0); + } + + log_info("------------------------------------------------------------"); +} + static void append_number(JournalFile *f, int n, const sd_id128_t *boot_id, uint64_t *seqnum) { _cleanup_free_ char *p = NULL, *q = NULL; dual_timestamp ts; @@ -376,17 +390,7 @@ static void test_skip_one(void (*setup)(void)) { test_check_numbers_up(j, 9); sd_journal_close(j); - log_info("Done..."); - - if (arg_keep) - log_info("Not removing %s", t); - else { - journal_directory_vacuum(".", 3000000, 0, 0, NULL, true); - - assert_se(rm_rf(t, REMOVE_ROOT|REMOVE_PHYSICAL) >= 0); - } - - puts("------------------------------------------------------------"); + test_done(t); } TEST(skip) { @@ -428,17 +432,7 @@ static void test_boot_id_one(void (*setup)(void), size_t n_boots_expected) { sd_journal_close(j); } - log_info("Done..."); - - if (arg_keep) - log_info("Not removing %s", t); - else { - journal_directory_vacuum(".", 3000000, 0, 0, NULL, true); - - assert_se(rm_rf(t, REMOVE_ROOT|REMOVE_PHYSICAL) >= 0); - } - - puts("------------------------------------------------------------"); + test_done(t); } TEST(boot_id) { @@ -527,15 +521,7 @@ static void test_sequence_numbers_one(void) { test_close(two); } - log_info("Done..."); - - if (arg_keep) - log_info("Not removing %s", t); - else { - journal_directory_vacuum(".", 3000000, 0, 0, NULL, true); - - assert_se(rm_rf(t, REMOVE_ROOT|REMOVE_PHYSICAL) >= 0); - } + test_done(t); } TEST(sequence_numbers) {