test: add more testcases for seeking journal entries

This is mostly for issue #29216.
This commit is contained in:
Yu Watanabe
2023-09-21 01:58:43 +09:00
parent 836809d179
commit 45689fd265
+19
View File
@@ -185,6 +185,15 @@ static void test_skip_one(void (*setup)(void)) {
test_check_numbers_down(j, 9);
sd_journal_close(j);
/* Seek to head twice, iterate down. */
assert_ret(sd_journal_open_directory(&j, t, 0));
assert_ret(sd_journal_seek_head(j));
assert_se(sd_journal_next(j) == 1); /* pointing to the first entry */
assert_ret(sd_journal_seek_head(j));
assert_se(sd_journal_next(j) == 1); /* pointing to the first entry */
test_check_numbers_down(j, 9);
sd_journal_close(j);
/* Seek to head, move to previous, then iterate down. */
assert_ret(sd_journal_open_directory(&j, t, 0));
assert_ret(sd_journal_seek_head(j));
@@ -212,6 +221,16 @@ static void test_skip_one(void (*setup)(void)) {
test_check_numbers_up(j, 9);
sd_journal_close(j);
/* Seek to tail twice, iterate up. */
assert_ret(sd_journal_open_directory(&j, t, 0));
assert_ret(sd_journal_seek_tail(j));
assert_se(sd_journal_previous(j) == 1); /* pointing to the last entry */
// FIXME: the below does not work. See issue #29216.
//assert_ret(sd_journal_seek_tail(j));
//assert_se(sd_journal_previous(j) == 1); /* pointing to the last entry */
test_check_numbers_up(j, 9);
sd_journal_close(j);
/* Seek to tail, move to next, then iterate up. */
assert_ret(sd_journal_open_directory(&j, t, 0));
assert_ret(sd_journal_seek_tail(j));