test: test-logger: fix systemd journal usage

`sd_journal_seek_tail()` is supposed to seek to the logical end of the journal,
i.e. (always) after the last entry. A call to `sd_journal_previous()` is needed
to seek to the last entry, so that `sd_journal_next()` can be called
successfully in `find_in_journal()`. Without it, the journal would always
stay at the end of the list of entries, so further `sd_journal_next()`
calls would fail as there are no entries after the last.

See:
 * https://github.com/systemd/systemd/issues/25369
 * https://github.com/systemd/systemd/pull/26577
This commit is contained in:
Barnabás Pőcze 2023-05-21 20:29:38 +02:00 committed by Wim Taymans
parent de9b28f783
commit de7883024b
1 changed files with 2 additions and 2 deletions

View File

@ -504,7 +504,7 @@ PWTEST(logger_journal)
}
sd_journal_seek_tail(journal);
sd_journal_next(journal);
sd_journal_previous(journal);
spa_scnprintf(token, sizeof(token), "MARK %s:%d", __func__, __LINE__);
spa_logt_info(iface, &topic, "%s", token);
@ -572,7 +572,7 @@ PWTEST(logger_journal_chain)
}
sd_journal_seek_tail(journal);
sd_journal_next(journal);
sd_journal_previous(journal);
spa_scnprintf(token, sizeof(token), "MARK %s:%d", __func__, __LINE__);