test: test-logger: ignore some systemd journal error codes

Some errors from `sd_journal_get_data()` are not (and
should not be considered) fatal from the point of view of
the test. Ignore them.

See #1710
This commit is contained in:
Barnabás Pőcze 2021-12-01 10:50:28 +01:00
parent 3d152db758
commit 0680e249e5

View file

@ -24,6 +24,7 @@
#include "pwtest.h"
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
@ -464,6 +465,9 @@ find_in_journal(sd_journal *journal, const char *needle, char *out, size_t out_s
const char *d;
size_t l;
int r = sd_journal_get_data(journal, "MESSAGE", (const void **)&d, &l);
if (r == -ENOENT || r == -E2BIG || r == -EBADMSG)
continue;
pwtest_neg_errno_ok(r);
spa_scnprintf(buffer, sizeof(buffer), "%.*s", (int) l, d);
if (strstr(buffer, needle)) {