Skip to content

[utils/dmesg.py]: Add helper for journalctl logs and kernel cmdline parameters#6268

Merged
richtja merged 1 commit intoavocado-framework:masterfrom
Sumitupadhyay1:avocado_utils_helper
Mar 19, 2026
Merged

[utils/dmesg.py]: Add helper for journalctl logs and kernel cmdline parameters#6268
richtja merged 1 commit intoavocado-framework:masterfrom
Sumitupadhyay1:avocado_utils_helper

Conversation

@Sumitupadhyay1
Copy link
Copy Markdown
Contributor

@Sumitupadhyay1 Sumitupadhyay1 commented Feb 3, 2026

Add utilities to:
Collect kernel log pattern matches
Run journalctl -k -b to fetch current boot kernel logs, filter for a given pattern, and return matching lines for validation in tests.
Verify kernel cmdline parameters
Read /proc/cmdline and check for a specified boot parameter, returning True if present, otherwise False, to confirm features were enabled at boot.

@mr-avocado mr-avocado Bot moved this to Review Requested in Default project Feb 3, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Sumitupadhyay1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces two new helper utilities within avocado-utils to improve kernel-related diagnostics and testing capabilities. One utility allows for programmatic verification of kernel command-line parameters, ensuring specific boot configurations are active. The other provides a method to collect and filter kernel logs from journalctl, enabling easier validation of kernel events and behaviors.

Highlights

  • Kernel Command Line Parameter Check: Introduced a new utility function, check_kernel_cmdline_param, which reads /proc/cmdline to determine if a specified kernel boot parameter is present. This is useful for verifying kernel features enabled at boot.
  • Journalctl Kernel Log Collection: Added collect_journalctl_logs, a utility that executes journalctl -k -b to fetch kernel logs from the current boot and filters them in Python, returning a list of log lines containing a given pattern. This enables tests to count or validate specific kernel events.
Changelog
  • avocado/utils/dmesg.py
    • Added check_kernel_cmdline_param function to read /proc/cmdline and check for the presence of a specified kernel boot parameter.
    • Added collect_journalctl_logs function to execute journalctl -k -b, retrieve kernel logs, and filter them by a given pattern.
Activity
  • No human activity (comments, reviews, etc.) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds two useful helper functions for interacting with kernel logs and command line parameters. The implementation is straightforward, but I have a couple of suggestions to improve correctness and consistency.

In check_kernel_cmdline_param, the current substring check could lead to false positives. I've suggested a more robust way to check for the exact parameter.

For collect_journalctl_logs, I've suggested using modern type hints for consistency with the other new function and refactoring the implementation to be more concise using a list comprehension.

Comment thread avocado/utils/dmesg.py
Comment thread avocado/utils/dmesg.py Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 14.28571% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.67%. Comparing base (55a0ef8) to head (ba17c54).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
avocado/utils/dmesg.py 14.28% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6268      +/-   ##
==========================================
- Coverage   73.69%   73.67%   -0.02%     
==========================================
  Files         206      206              
  Lines       22620    22634      +14     
==========================================
+ Hits        16670    16676       +6     
- Misses       5950     5958       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@richtja richtja self-requested a review February 3, 2026 15:04
@Sumitupadhyay1 Sumitupadhyay1 changed the title [avocado-utils]: add helper for journalctl logs and kernel cmdline parameters [avocado-utils-dmesg]: Add helper for journalctl logs and kernel cmdline parameters Feb 11, 2026
@dhsrivas
Copy link
Copy Markdown
Contributor

@Sumitupadhyay1 Can you please have a look on above checks failing on your patch?

@Sumitupadhyay1 Sumitupadhyay1 changed the title [avocado-utils-dmesg]: Add helper for journalctl logs and kernel cmdline parameters [utils/dmesg.py]: Add helper for journalctl logs and kernel cmdline parameters Feb 16, 2026
@Sumitupadhyay1 Sumitupadhyay1 force-pushed the avocado_utils_helper branch 5 times, most recently from 023eb9e to 1df982a Compare February 27, 2026 10:27
@Sumitupadhyay1
Copy link
Copy Markdown
Contributor Author

@richtja Could you please review this Pull Request.

@Sumitupadhyay1
Copy link
Copy Markdown
Contributor Author

The failing docs checks are upstream issues, not caused by this PR. They match the problem already fixed in PR: #6273 and applying those changes locally makes the build pass.

@Sumitupadhyay1
Copy link
Copy Markdown
Contributor Author

From my side, everything is done. The failing docs checks are upstream issues already fixed in PR #6273 and not related to this change.
@richtja, could you please review this pull request soon so it can be merged this week?

@Sumitupadhyay1
Copy link
Copy Markdown
Contributor Author

Sumitupadhyay1 commented Mar 5, 2026

This pull request depends on the execution of avocado-misc-tests.
@richtja, Could you please review the pull request? Merging it by this week would help with testing the avocado-misc-tests.

@Sumitupadhyay1
Copy link
Copy Markdown
Contributor Author

@richtja, Could you please review the pull request? Merging it would help with testing the avocado-misc-tests.

1 similar comment
@Sumitupadhyay1
Copy link
Copy Markdown
Contributor Author

@richtja, Could you please review the pull request? Merging it would help with testing the avocado-misc-tests.

Copy link
Copy Markdown
Contributor

@richtja richtja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Sumitupadhyay1, there are many format changes which are not related to this PR. Can you please remove them? Thanks

Add collect_journalctl_logs() to list pattern matches in kernel logs.
Add check_kernel_cmdline_param() to verify parameters in /proc/cmdline.

Signed-off-by: Sumit Kumar <sumitkum@amd.com>
@Sumitupadhyay1
Copy link
Copy Markdown
Contributor Author

Hi @richtja , thank you for the review. I’ve addressed all the requested changes. Could you please take another look at the pull request? Thanks!

@Sumitupadhyay1 Sumitupadhyay1 requested a review from richtja March 17, 2026 08:26
@Sumitupadhyay1
Copy link
Copy Markdown
Contributor Author

@richtja, Could you please review the pull request? Merging it would help with testing the avocado-misc-tests.

Copy link
Copy Markdown
Contributor

@richtja richtja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Sumitupadhyay1, thank you for the update. It LGTM now.

@richtja richtja merged commit 322254c into avocado-framework:master Mar 19, 2026
60 checks passed
@github-project-automation github-project-automation Bot moved this from Review Requested to Done 114 in Default project Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done 114

Development

Successfully merging this pull request may close these issues.

3 participants