Skip to content

test: capture DUT syslog per test - #1683

Open
saba8814 wants to merge 4 commits into
mainfrom
test-syslog-capture
Open

saba8814 wants to merge 4 commits into
mainfrom
test-syslog-capture

Conversation

@saba8814

@saba8814 saba8814 commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This PR introduces a way for Infamy to collect each DUT's syslog per test.
Each DUT sends its syslog to the test container, which saves it per test
and DUT next to the test output:

test/.log/<run>/output/0006-set-hostname.log
test/.log/<run>/syslog/0006-set-hostname/target/{syslog,kern.log,messages}

After the run, make test packs the logs in logs.tar.gz, which CI uploads
as the dut-syslog artifact. Capture is off by default, enable it with
make TEST_SYSLOG_CAPTURE=y test.

The start and stop of each test, and each test step, are marked in the
DUT's log with the host's time, so DUT lines can be lined up with the test
output. Capture is best-effort: if a DUT reboots, its log is kept up to
the reboot and resumes when the test attaches again. Tests that set up
syslog themselves stop the capture for that DUT. The test result is
never affected.

Resolves: #1608

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

@saba8814
saba8814 marked this pull request as draft October 3, 2026 17:55
@saba8814
saba8814 force-pushed the test-syslog-capture branch 2 times, most recently from d02b9db to fafe7e4 Compare October 3, 2026 18:04
@saba8814 saba8814 changed the title test: capture DUT syslog per test (opt-in) test: capture DUT syslog per test Oct 3, 2026
@saba8814 saba8814 added the ci:skip Skip CI for this PR, started jobs are stopped. label Oct 3, 2026
@saba8814
saba8814 force-pushed the test-syslog-capture branch from f54af4f to 6de0703 Compare October 5, 2026 09:08
@saba8814
saba8814 marked this pull request as ready for review October 5, 2026 12:34
@saba8814
saba8814 marked this pull request as draft October 7, 2026 07:05
The test.py docstring was changed on main without running make
test-spec.

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
Collecting DUT syslog in the test container needs a syslogd that can
receive remote messages and sort them with property filters, which
BusyBox syslogd can't.  Build sysklogd 2.7.2, the same version as on
the DUTs, into /usr/local and bump the image to 2.15.

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
When a test fails in CI, the DUT logs are gone by the time anyone
looks.  With TEST_SYSLOG_CAPTURE=y to make test, or --capture-syslog
to Infamy, each DUT logs to a syslogd in the test container:

    test/.log/<run>/syslog/<test>/<dut>/{syslog,kern.log,messages}

Infamy adds a remote action on each DUT after test_reset, and the
container's syslogd sorts messages on sender address.  Infamy marks
the start and stop of each test, and the start of each step, in the
DUT's log with the log RPC, using msgid test-start, test-stop, and
step.  After the run, make test packs the logs in logs.tar.gz.

Capture is off by default and best-effort, it never changes a test
result.

Resolves: #1608
Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
CI uploads logs.tar.gz as the dut-syslog artifact when capture is
enabled.

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
@saba8814
saba8814 force-pushed the test-syslog-capture branch from 6de0703 to e217a58 Compare October 7, 2026 07:07
@saba8814
saba8814 marked this pull request as ready for review October 7, 2026 07:10
@saba8814
saba8814 marked this pull request as draft October 7, 2026 08:52
@saba8814
saba8814 marked this pull request as ready for review October 7, 2026 10:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:skip Skip CI for this PR, started jobs are stopped.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

infamy: Always send logs from DUTs to remote syslog in tests

1 participant