Skip to content

Conversation

smuppand
Copy link
Contributor

Why

  • We’ve been maintaining a monolithic video test runner that mixed orchestration, platform logic, firmware handling, and test loops.

  • This PR modularizes the runner, adds robust upstream/downstream stack control across platforms (lemans/monaco/kodiak), and makes firmware & media handling safer and more automated—especially for Kodiak and for offline labs.

What’s in this PR

New/updated scripts

  • run.sh

  • Calls shared libs: functestlib.sh and lib_video.sh.

  • Early rootfs resize: ensures / has ≥2 GiB before any download (ensure_rootfs_min_size 2).

  • Early bundle fetch (best-effort): pulls TAR_URL media unless --config/--dir is given or EXTRACT_INPUT_CLIPS=false.

  • Stack selection: --stack {auto,upstream,downstream,base,overlay,up,down} with platform awareness --platform {lemans,monaco,kodiak} (auto-detect by default).

  • Kodiak upstream pre-step: if --stack upstream on Kodiak, attempts a firmware restore from backups to /lib/firmware before switching (video_kodiak_install_firmware).

  • Device node refresh: udev trigger + prune stale /dev/video* and /dev/media*.

  • Clips ensure: validates inputs from JSON, attempts fetch if missing; offline decode cases are skipped (encode continues).

  • Structured logging, CSV summary, optional JUnit (only if --junit is passed).

utils/lib_video.sh

  • Platform detection: lemans/monaco/kodiak.

Stack control:

  • Runtime block/unblock via /run/modprobe.d/ and persistent blacklist edits (idempotent).

  • Hot-switch (best-effort, no reboot): unload/load modules with modprobe-then-insmod fallback.

  • Validation helpers for upstream/downstream presence per platform.

Kodiak firmware handling:

  • video_kodiak_install_firmware: scans backups in ${VIDEO_FW_BACKUP_DIR:-/opt} (supports multiple patterns like vpu20_p1_gen2_*.mbn, .mbn., *.bak) and installs to /lib/firmware/qcom/vpu/vpu20_p1_gen2.mbn.

  • video_kodiak_swap_and_reload: installs new FW and attempts remoteproc reload, then module reload, then unbind/bind—with device-node refresh after success.

Media fetch:

  • video_ensure_clips_present_or_fetch: jq-less JSON scanning to gather input clips; if missing, uses extract_tar_from_url and optionally ensure_network_online (see “Networking”).

  • DMESG triage and structured JUnit case append helper.

  • POSIX & ShellCheck hardening (see below).

utils/functestlib.sh

  • ensure_rootfs_min_size moved here so other suites can reuse it.

  • ensure_network_online (if available in your tree) is picked up by video fetch flow.

… FW hot-swap, and resilient fetch

- Split responsibilities across run.sh, functestlib.sh, and lib_video.sh
  - run.sh: early rootfs resize (>=2GiB), early bundle fetch, platform-aware
    stack selection, udev refresh/prune, structured loop + results.
  - lib_video.sh: platform detect (lemans/monaco/kodiak), runtime & persistent
    blacklists, hot-switch helper (modprobe→insmod fallback), validation,
    DMESG triage, jq-less JSON clip parsing, Kodiak firmware helpers:
      * video_kodiak_install_firmware: scan /opt for
        vpu20_p1_gen2 backups; install to /lib/firmware path
      * video_kodiak_swap_and_reload: install + remoteproc reload → module
        reload → unbind/bind; refresh /dev/video* on success
  - functestlib.sh: moved ensure_rootfs_min_size here for reuse.
- Networking: if ensure_network_online() is present (as used in audio),
  call it before bundle fetch; on offline, decode cases are skipped.

Signed-off-by: Srikanth Muppandam <[email protected]>
Copy link
Contributor

@abbajaj806 abbajaj806 left a comment

Choose a reason for hiding this comment

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

Looks good to me

@abbajaj806 abbajaj806 merged commit 3656739 into qualcomm-linux:main Sep 30, 2025
8 checks passed
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