Video: modularize iris V4L2 runner, add stack switching, Kodiak FW hot-swap, and resilient media fetch #176
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.
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
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.