8 Commits

Author SHA1 Message Date
Rainer Gerhards
0082a418ce tests: harden imjournal basic flake handling
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
2026-02-07 16:13:22 +01:00
Rainer Gerhards
b326c76f45 style: normalize C source formatting via clang-format (PoC)
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.
2025-07-16 13:56:21 +02:00
Rainer Gerhards
614a03550e
testbench: fix issues with journal testing
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.
2019-01-18 09:09:37 +01:00
PascalWithopf
866336d997 activate codestyle for all files ending with .c/.h
Last changes to the codestyle and activation of
the codestyle checker.
2018-08-03 09:32:07 +02:00
Rainer Gerhards
4f8cfcbb54
codestyle fix - rough way
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.
2018-08-02 15:21:22 +02:00
Jiri Vymazal
59e58b5ec8 Fetching cursor on readJournal() and simplified pollJournal()
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
2018-07-31 12:08:25 +02:00
Jiri Vymazal
534d79344b Added skip journal load on first run
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.
2018-07-24 15:40:54 +02:00
Rainer Gerhards
bf9fd03639 testbench: implement basic test for imjournal
this ensures that the module is at least loading and doing
part of its work.

see also https://github.com/rsyslog/rsyslog/issues/1895
closes https://github.com/rsyslog/rsyslog/issues/164
2017-10-26 08:47:29 +02:00