Repository navigation
kmsg: unit tests to cover kernel record parsing and terminal output - #5304
Open
Sunil Muthuswamy (sunilmut) wants to merge 4 commits into
Open
Sunil Muthuswamy (sunilmut) wants to merge 4 commits into
Sunil Muthuswamy (sunilmut) wants to merge 4 commits into
Conversation
Test cases informed by actual logging consumers. - Verify malformed headers, record flags and metadata parsing. - Cover escaped bytes and microsecond timestamp boundaries. - Verify terminal output for each severity level. Before: coverage unavailable because the baseline had no tests. After: Linux x64 all-features coverage 93.60% (117/125 production lines) Test changes only; no product code changes.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the kmsg test additions and development dependency change.
No open issues 🎉
What changed in this PR
Adds unit tests for the kmsg crate’s kernel-log and serial-console parsing and terminal formatting. Production code is unchanged.
Changes:
- Covers extended records, metadata, escaped bytes, and malformed headers.
- Checks microsecond timestamps and terminal colors for all severity levels.
- Adds the workspace tracing helper as a test dependency.
| File | Description |
|---|---|
support/kmsg/src/lib.rs |
Adds parsing, validation, and terminal-output tests. |
support/kmsg/Cargo.toml |
Adds test_with_tracing as a development dependency. |
Cargo.lock |
Records the new test dependency for kmsg. |
Review effort: Balanced
Steven Malis (smalis-msft)
approved these changes
Nov 30, 2026
John Starks (jstarks)
approved these changes
Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test cases informed by actual logging consumers.
Add unit tests for:
Before: coverage unavailable because the baseline had no tests.
After: Linux x64 all-features coverage 93.60% (117/125 production lines)
Test changes only; no product code changes.