Why:
Improve reliability of the imjournal basic test under CI timing
variance and journal churn, reducing non-actionable failures.
Impact: imjournal basic tests become more resilient and may skip
when host journal load is excessive.
Before/After: test could fail due to startup/noise races; now it
waits for readiness, retries under noise, and reports cleaner errors.
Technical Overview:
- Added a readiness probe phase in imjournal-basic before the real
assertion message to avoid IgnorePreviousMessages startup races.
- Added short retry logic for high recent journal volume and skip
only after retries are exhausted.
- Added tunables for noise window, threshold, retries, and sleep.
- Updated journal_print to write newline-terminated records and
explicitly fflush/fclose so writes are durably handed to journald.
- Updated content_check_with_count to treat missing output file as
not-yet-done until the test hard deadline, then fail.
- Improved failure diagnostics for missing output file to avoid
secondary shell errors that obscure the primary failure.
With the help of AI-Agents: Codex
This commit applies the new canonical formatting style using `clang-format` with custom settings (notably 4-space indentation), as part of our shift toward automated formatting normalization.
⚠️ No functional changes are included — only whitespace and layout modifications as produced by `clang-format`.
This change is part of the formatting modernization strategy discussed in:
https://github.com/rsyslog/rsyslog/issues/5747
Key context:
- Formatting is now treated as a disposable view, normalized via tooling.
- The `.clang-format` file defines the canonical style.
- A fixup script (`devtools/format-code.sh`) handles remaining edge cases.
- Formatting commits are added to `.git-blame-ignore-revs` to reduce noise.
- Developers remain free to format code however they prefer locally.
The configure/Makefile checks were not correct, leading to the
build of journal components when not necessary, even if not
supported by the platform. Thus lead to invald build and test
failures. This commit fixes that.
We did not totally fix all that we would like to see changed, but we
fixed it so that it permits us to finally run the style checker on all
files.
Needs some little manual fixup PR to follow.
Fetching journal cursor in persistJournal could cause us to save
invalid cursor leading to duplicating messages further on, when new
WorkAroundJournalBug option is set we are saving it on each
readJournal() where we now that the state is good.
pollJournal() is now cleaner and faster, correctly handles INVALIDATE
status from journald and is able to continue polling after journal
flush. Also reduced POLL_TIMEOUT a bit as it caused rsyslog to exit
with error in corner cases for some ppc when left at full second.
re-factored imjournal CI tests with journal_print tool to have more
detailed error reporting
When starting rsyslog with imjournal for first time it outputs
an error and plugin does not run because no state file exists yet.
Now it skips the loading and creates state file on first persist.
Also fixed imjournal tests to actually test plugin functionality.