Skip to content

Refactor IPA and RMNET tests to use shared module helpers in functestlib.sh #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2025

Conversation

smuppand
Copy link
Contributor

@smuppand smuppand commented Jun 5, 2025

This PR introduces a common set of helper functions in functestlib.sh to simplify and standardize kernel module handling across test cases. The following updates are included:

Changes:

  • Added the following reusable functions to functestlib.sh:

    • find_kernel_module: Locate .ko files reliably
    • load_kernel_module: Safely insert modules with error handling
    • unload_kernel_module: Remove modules with fallback and forced options
    • is_module_loaded: Check module presence via lsmod
  • Refactored IPA/run.sh and RMNET/run.sh:

    • Aligned structure with consistent logging and result file handling
    • Replaced inline module management logic with shared functions
    • Ensured ShellCheck compliance and POSIX compatibility

Benefits:

  • Improved code reuse and readability
  • Consistent behavior across module validation scripts
  • Enhanced robustness for CI environments (e.g., minimal initramfs shells)

@smuppand smuppand requested a review from vnarapar June 5, 2025 08:50
@smuppand smuppand force-pushed the probe_fail branch 3 times, most recently from 38a9263 to 2b3ef6c Compare June 5, 2025 12:25
…odule helpers

- Introduced shared POSIX-compliant helper functions in functestlib.sh:
  - find_kernel_module
  - load_kernel_module
  - unload_kernel_module
  - is_module_loaded

- Refactored IPA/run.sh and RMNET/run.sh:
  - Aligned structure for consistency
  - Replaced hardcoded insmod/lsmod/rmmod logic with shared helpers
  - Added robust error handling, cleanup logic, and module load validation
  - Ensured ShellCheck --shell=sh compatibility

- Improves modularity, maintainability, and test reliability across CI runs

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
Copy link
Contributor

@vnarapar vnarapar left a comment

Choose a reason for hiding this comment

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

LGTM

@vnarapar vnarapar merged commit e2e5763 into qualcomm-linux:main Jun 5, 2025
6 checks passed
@smuppand smuppand deleted the probe_fail branch June 6, 2025 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants