Skip to content

Comments

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

Open
Sumitupadhyay1 wants to merge 3 commits intoavocado-framework:masterfrom
Sumitupadhyay1:avocado_utils_helper
Open

[utils/dmesg.py]: Add helper for journalctl logs and kernel cmdline parameters#6268
Sumitupadhyay1 wants to merge 3 commits intoavocado-framework:masterfrom
Sumitupadhyay1:avocado_utils_helper

Conversation

@Sumitupadhyay1
Copy link

@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.

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>
@mr-avocado mr-avocado bot moved this to Review Requested in Default project Feb 3, 2026
@gemini-code-assist
Copy link

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

@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.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.65%. Comparing base (b56f6d8) to head (5b51878).
⚠️ Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
avocado/utils/dmesg.py 0.00% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6268      +/-   ##
==========================================
- Coverage   73.72%   73.65%   -0.07%     
==========================================
  Files         206      206              
  Lines       22507    22524      +17     
==========================================
- Hits        16593    16591       -2     
- Misses       5914     5933      +19     

☔ 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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Review Requested

Development

Successfully merging this pull request may close these issues.

2 participants