Skip to content

Commit 7915fd1

Browse files
authored
Merge pull request qualcomm-linux#205 from smuppand/video-fix
Video V4L2: add local clips support (--clips-tar/--clips-dest), keep base clean of custom KOs, and update LAVA job to use local bundle (no Wi-Fi)
2 parents ad239c2 + 60f390b commit 7915fd1

File tree

2 files changed

+164
-82
lines changed

2 files changed

+164
-82
lines changed

Runner/plans/video_pre-merge.yaml

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,63 @@
11
metadata:
22
format: Lava-Test Test Definition 1.0
3-
name: Video_V4L2_With_Secrets
4-
description: "Run Video V4L2 runner; use LAVA secrets for Wi-Fi; auto-args for kodiak vs lemans/monaco; run base & overlay"
3+
name: Video_V4L2_LocalClips
4+
description: "Run Video V4L2 runner with local clips tar and custom .ko dir; auto-args for kodiak vs lemans/monaco; run base & overlay"
55
maintainer:
66
77
os:
88
- openembedded
99
scope:
1010
- functional
11-
1211
run:
1312
steps:
1413
- cd Runner
1514
- export REPO_ROOT="$PWD"
16-
- export TARGET="${TARGET:-}" # expected values: kodiak | lemans | monaco (case-insensitive)
17-
18-
# Read Wi-Fi credentials from LAVA-provided secrets (exported as env vars in the job)
19-
- export SSID="${LAVA_WIFI_SSID:-}"
20-
- export PASSWORD="${LAVA_WIFI_PASSWORD:-}"
15+
- export TARGET="${TARGET:-}" # kodiak | lemans | monaco (case-insensitive)
2116

22-
# Build args for run.sh based on TARGET; always pass secrets; add downstream FW only for kodiak
2317
- |
2418
RPATH="$REPO_ROOT/suites/Multimedia/Video/Video_V4L2_Runner/run.sh"
2519
RESFILE="$REPO_ROOT/suites/Multimedia/Video/Video_V4L2_Runner/Video_V4L2_Runner.res"
26-
ARGS=""
20+
21+
# Custom media bundle (local) paths
22+
CLIPS_TAR="/data/vendor/iris_test_app/video_clips_iris.tar.gz"
23+
CLIPS_DEST="/data/vendor/iris_test_app/clips"
24+
25+
# Custom downstream module location (directory containing iris_vpu.ko)
26+
KO_DIR="/data/vendor/iris_test_app"
27+
28+
# Optional: downstream firmware needed on Kodiak overlay
29+
DS_FW="/data/vendor/iris_test_app/vpu20_p1_gen2.mbn"
30+
31+
# Normalize/derive platform flag
2732
TL="$(printf '%s' "${TARGET:-}" | tr '[:upper:]' '[:lower:]')"
2833
case "$TL" in
29-
kodiak)
30-
ARGS="$ARGS --platform kodiak --app /data/vendor/iris_test_app/iris_v4l2_test --ssid \"$SSID\" --password \"$PASSWORD\" --downstream-fw /data/vendor/iris_test_app/vpu20_p1_gen2.mbn"
31-
;;
32-
lemans)
33-
ARGS="$ARGS --platform lemans --ssid \"$SSID\" --password \"$PASSWORD\"" --app /data/vendor/iris_test_app/iris_v4l2_test
34-
;;
35-
monaco)
36-
ARGS="$ARGS --platform monaco --ssid \"$SSID\" --password \"$PASSWORD\"" --app /data/vendor/iris_test_app/iris_v4l2_test
37-
;;
38-
*)
39-
# Unknown or not provided: still pass secrets; platform autodetect in run.sh
40-
ARGS="$ARGS --ssid \"$SSID\" --password \"$PASSWORD\""
41-
;;
34+
kodiak|lemans|monaco) PLAT="--platform $TL" ;;
35+
*) PLAT="" ;; # autodetect
4236
esac
43-
echo "TARGET=${TARGET:-unset} ARGS=$ARGS"
4437
45-
# Run base (upstream) then overlay (downstream)
38+
# Common args (clips local, no Wi-Fi or TAR_URL needed)
39+
ARGS_COMMON="--clips-tar $CLIPS_TAR --clips-dest $CLIPS_DEST --app /data/vendor/iris_test_app/iris_v4l2_test $PLAT --retry-on-fail 2 --loglevel 15"
40+
41+
# --- BASE (upstream): NO ko args here ---
42+
ARGS_BASE="--stack base $ARGS_COMMON"
43+
44+
# --- OVERLAY (downstream): add ko args; on kodiak also add downstream FW ---
45+
ARGS_OVERLAY="--stack overlay $ARGS_COMMON --ko-dir $KO_DIR --ko-prefer-custom"
46+
if [ "$TL" = "kodiak" ]; then
47+
ARGS_OVERLAY="$ARGS_OVERLAY --downstream-fw $DS_FW"
48+
fi
49+
50+
echo "BASE ARGS: $ARGS_BASE"
51+
echo "OVERLAY ARGS: $ARGS_OVERLAY"
52+
53+
# Run BASE (upstream)
4654
# shellcheck disable=SC2086
47-
sh -lc "$RPATH --stack base $ARGS" || true
55+
sh -lc "$RPATH $ARGS_BASE" || true
4856
"$REPO_ROOT/utils/send-to-lava.sh" "$RESFILE" || true
4957
58+
# Run OVERLAY (downstream)
5059
# shellcheck disable=SC2086
51-
sh -lc "$RPATH --stack overlay $ARGS" || true
60+
sh -lc "$RPATH $ARGS_OVERLAY" || true
5261
"$REPO_ROOT/utils/send-to-lava.sh" "$RESFILE" || true
5362
5463
# Optional roll-up (ignored if absent)

Runner/suites/Multimedia/Video/Video_V4L2_Runner/run.sh

Lines changed: 128 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ KO_TREE="" # alt root that has lib/modules/$KVER
7373
KO_TARBALL="" # optional tarball that we unpack once
7474
KO_PREFER_CUSTOM="0" # 1 = try custom first; default 0 = system first
7575

76+
# --- Opt-in: custom media bundle tar (always honored even with --dir/--config) ---
77+
CLIPS_TAR="" # /path/to/clips.tar[.gz|.xz|.zst|.bz2|.tgz|.tbz2|.zip]
78+
CLIPS_DEST="" # optional extraction destination; defaults to cfg/dir root or testcase dir
79+
7680
if [ -z "${VIDEO_STACK:-}" ]; then VIDEO_STACK="auto"; fi
7781
if [ -z "${VIDEO_PLATFORM:-}" ]; then VIDEO_PLATFORM=""; fi
7882
if [ -z "${VIDEO_FW_DS:-}" ]; then VIDEO_FW_DS=""; fi
@@ -114,6 +118,9 @@ Usage: $0 [--config path.json|/path/dir] [--dir DIR] [--pattern GLOB]
114118
# --- Stabilizers ---
115119
[--retry-on-fail N] # retry up to N times if a case ends FAIL
116120
[--post-test-sleep S] # sleep S seconds after each case
121+
# --- Media bundle (opt-in, local tar) ---
122+
[--clips-tar /path/to/clips.tar.gz] # extract locally even if --dir/--config is used
123+
[--clips-dest DIR] # extraction destination (defaults to cfg/dir root or testcase dir)
117124
EOF
118125
}
119126

@@ -245,6 +252,15 @@ while [ $# -gt 0 ]; do
245252
shift
246253
POST_TEST_SLEEP="$1"
247254
;;
255+
# --- Media bundle (opt-in, local tar) ---
256+
--clips-tar)
257+
shift
258+
CLIPS_TAR="$1"
259+
;;
260+
--clips-dest)
261+
shift
262+
CLIPS_DEST="$1"
263+
;;
248264
--help|-h)
249265
usage
250266
exit 0
@@ -393,6 +409,42 @@ if [ -n "$LOG_FLAVOR" ]; then
393409
TOP_LEVEL_RUN="0"
394410
fi
395411

412+
# --- Opt-in local media bundle extraction (honored regardless of --config/--dir) ---
413+
if [ -n "$CLIPS_TAR" ]; then
414+
# destination resolution: explicit --clips-dest > cfg dir > --dir > testcase dir
415+
clips_dest_resolved="$CLIPS_DEST"
416+
if [ -z "$clips_dest_resolved" ]; then
417+
if [ -n "$CFG" ] && [ -f "$CFG" ]; then
418+
clips_dest_resolved="$(cd "$(dirname "$CFG")" 2>/dev/null && pwd)"
419+
elif [ -n "$DIR" ] && [ -d "$DIR" ]; then
420+
clips_dest_resolved="$DIR"
421+
else
422+
clips_dest_resolved="$test_path"
423+
fi
424+
fi
425+
mkdir -p "$clips_dest_resolved" 2>/dev/null || true
426+
video_step "" "Extract custom clips tar → $clips_dest_resolved"
427+
case "$CLIPS_TAR" in
428+
*.tar|*.tar.gz|*.tgz|*.tar.xz|*.txz|*.tar.zst|*.tar.bz2|*.tbz2)
429+
if command -v tar >/dev/null 2>&1; then
430+
tar -xf "$CLIPS_TAR" -C "$clips_dest_resolved" 2>/dev/null || true
431+
else
432+
log_warn "tar not available; cannot extract --clips-tar"
433+
fi
434+
;;
435+
*.zip)
436+
if command -v unzip >/dev/null 2>&1; then
437+
unzip -o "$CLIPS_TAR" -d "$clips_dest_resolved" >/dev/null 2>&1 || true
438+
else
439+
log_warn "unzip not available; cannot extract --clips-tar"
440+
fi
441+
;;
442+
*)
443+
log_warn "Unrecognized archive type for --clips-tar: $CLIPS_TAR"
444+
;;
445+
esac
446+
fi
447+
396448
# Ensure rootfs meets minimum size (2GiB) BEFORE any downloads — only once
397449
if [ "$TOP_LEVEL_RUN" -eq 1 ]; then
398450
ensure_rootfs_min_size 2
@@ -402,7 +454,7 @@ fi
402454

403455
# If we're going to fetch, ensure network is online first — only once
404456
if [ "$TOP_LEVEL_RUN" -eq 1 ]; then
405-
if [ "$EXTRACT_INPUT_CLIPS" = "true" ] && [ -z "$CFG" ] && [ -z "$DIR" ]; then
457+
if [ "$EXTRACT_INPUT_CLIPS" = "true" ] && [ -z "$CFG" ] && [ -z "$DIR" ] && [ -z "$CLIPS_TAR" ]; then
406458
net_rc=1
407459

408460
if command -v check_network_status_rc >/dev/null 2>&1; then
@@ -442,24 +494,28 @@ fi
442494
# --- Optional early fetch of bundle (best-effort, ALWAYS in LOG_ROOT) — only once
443495
if [ "$TOP_LEVEL_RUN" -eq 1 ]; then
444496
if [ "$EXTRACT_INPUT_CLIPS" = "true" ] && [ -z "$CFG" ] && [ -z "$DIR" ]; then
445-
video_step "" "Early bundle fetch (best-effort)"
497+
if [ -n "$CLIPS_TAR" ]; then
498+
log_info "Custom --clips-tar provided; skipping online early fetch."
499+
else
500+
video_step "" "Early bundle fetch (best-effort)"
446501

447-
saved_log_dir="$LOG_DIR"
448-
LOG_DIR="$LOG_ROOT"
449-
export LOG_DIR
502+
saved_log_dir="$LOG_DIR"
503+
LOG_DIR="$LOG_ROOT"
504+
export LOG_DIR
450505

451-
if command -v check_network_status_rc >/dev/null 2>&1; then
452-
if ! check_network_status_rc; then
453-
log_info "Network unreachable; skipping early media bundle fetch."
506+
if command -v check_network_status_rc >/dev/null 2>&1; then
507+
if ! check_network_status_rc; then
508+
log_info "Network unreachable; skipping early media bundle fetch."
509+
else
510+
extract_tar_from_url "$TAR_URL" || true
511+
fi
454512
else
455513
extract_tar_from_url "$TAR_URL" || true
456514
fi
457-
else
458-
extract_tar_from_url "$TAR_URL" || true
459-
fi
460515

461-
LOG_DIR="$saved_log_dir"
462-
export LOG_DIR
516+
LOG_DIR="$saved_log_dir"
517+
export LOG_DIR
518+
fi
463519
else
464520
log_info "Skipping early bundle fetch (explicit --config/--dir provided or EXTRACT_INPUT_CLIPS=false)."
465521
fi
@@ -586,6 +642,16 @@ if [ "${VIDEO_STACK}" = "both" ]; then
586642
args="$args --post-test-sleep $(printf %s "$POST_TEST_SLEEP")"
587643
fi
588644

645+
# --- Media bundle passthrough ---
646+
if [ -n "${CLIPS_TAR:-}" ]; then
647+
esc_tar="$(printf %s "$CLIPS_TAR" | sed "s/'/'\\\\''/g")"
648+
args="$args --clips-tar '$esc_tar'"
649+
fi
650+
if [ -n "${CLIPS_DEST:-}" ]; then
651+
esc_dst="$(printf %s "$CLIPS_DEST" | sed "s/'/'\\\\''/g")"
652+
args="$args --clips-dest '$esc_dst'"
653+
fi
654+
589655
printf "%s" "$args"
590656
}
591657

@@ -933,53 +999,58 @@ while IFS= read -r cfg; do
933999

9341000
# Fetch only when not explicitly provided a config/dir and feature enabled
9351001
if [ "$EXTRACT_INPUT_CLIPS" = "true" ] && [ -z "$CFG" ] && [ -z "$DIR" ]; then
936-
video_step "$id" "Ensure clips present or fetch"
937-
938-
saved_log_dir_case="$LOG_DIR"
939-
LOG_DIR="$LOG_ROOT"
940-
export LOG_DIR
941-
942-
video_ensure_clips_present_or_fetch "$cfg" "$TAR_URL"
943-
ce=$?
944-
945-
LOG_DIR="$saved_log_dir_case"
946-
export LOG_DIR
947-
948-
# Map generic download errors to "offline" if link just flapped
949-
if [ "$ce" -eq 1 ] 2>/dev/null; then
950-
sleep "${NET_STABILIZE_SLEEP:-5}"
1002+
if [ -n "$CLIPS_TAR" ]; then
1003+
log_info "[$id] Custom --clips-tar provided; skipping online per-test fetch."
1004+
ce=0
1005+
else
1006+
video_step "$id" "Ensure clips present or fetch"
1007+
1008+
saved_log_dir_case="$LOG_DIR"
1009+
LOG_DIR="$LOG_ROOT"
1010+
export LOG_DIR
1011+
1012+
video_ensure_clips_present_or_fetch "$cfg" "$TAR_URL"
1013+
ce=$?
1014+
1015+
LOG_DIR="$saved_log_dir_case"
1016+
export LOG_DIR
1017+
1018+
# Map generic download errors to "offline" if link just flapped
1019+
if [ "$ce" -eq 1 ] 2>/dev/null; then
1020+
sleep "${NET_STABILIZE_SLEEP:-5}"
1021+
1022+
if command -v check_network_status_rc >/dev/null 2>&1; then
1023+
if ! check_network_status_rc; then
1024+
ce=2
1025+
fi
1026+
elif command -v check_network_status >/dev/null 2>&1; then
1027+
if ! check_network_status >/dev/null 2>&1; then
1028+
ce=2
1029+
fi
1030+
fi
1031+
fi
9511032

952-
if command -v check_network_status_rc >/dev/null 2>&1; then
953-
if ! check_network_status_rc; then
954-
ce=2
1033+
if [ "$ce" -eq 2 ] 2>/dev/null; then
1034+
if [ "$mode" = "decode" ]; then
1035+
log_skip "[$id] SKIP - offline and clips missing (decode case)"
1036+
printf '%s\n' "$id SKIP $pretty" >> "$LOG_DIR/summary.txt"
1037+
printf '%s\n' "$mode,$id,SKIP,$pretty,0,0,0" >> "$LOG_DIR/results.csv"
1038+
skip=$((skip + 1))
1039+
continue
9551040
fi
956-
elif command -v check_network_status >/dev/null 2>&1; then
957-
if ! check_network_status >/dev/null 2>&1; then
958-
ce=2
1041+
elif [ "$ce" -eq 1 ] 2>/dev/null; then
1042+
log_fail "[$id] FAIL - fetch/extract failed while online"
1043+
printf '%s\n' "$id FAIL $pretty" >> "$LOG_DIR/summary.txt"
1044+
printf '%s\n' "$mode,$id,FAIL,$pretty,0,0,0" >> "$LOG_DIR/results.csv"
1045+
fail=$((fail + 1))
1046+
suite_rc=1
1047+
1048+
if [ "$STOP_ON_FAIL" -eq 1 ]; then
1049+
break
9591050
fi
960-
fi
961-
fi
9621051

963-
if [ "$ce" -eq 2 ] 2>/dev/null; then
964-
if [ "$mode" = "decode" ]; then
965-
log_skip "[$id] SKIP - offline and clips missing (decode case)"
966-
printf '%s\n' "$id SKIP $pretty" >> "$LOG_DIR/summary.txt"
967-
printf '%s\n' "$mode,$id,SKIP,$pretty,0,0,0" >> "$LOG_DIR/results.csv"
968-
skip=$((skip + 1))
9691052
continue
9701053
fi
971-
elif [ "$ce" -eq 1 ] 2>/dev/null; then
972-
log_fail "[$id] FAIL - fetch/extract failed while online"
973-
printf '%s\n' "$id FAIL $pretty" >> "$LOG_DIR/summary.txt"
974-
printf '%s\n' "$mode,$id,FAIL,$pretty,0,0,0" >> "$LOG_DIR/results.csv"
975-
fail=$((fail + 1))
976-
suite_rc=1
977-
978-
if [ "$STOP_ON_FAIL" -eq 1 ]; then
979-
break
980-
fi
981-
982-
continue
9831054
fi
9841055
else
9851056
log_info "[$id] Fetch disabled (explicit --config/--dir)."
@@ -1139,7 +1210,7 @@ while IFS= read -r cfg; do
11391210
if [ -n "$rc_val" ]; then
11401211
case "$rc_val" in
11411212
139) log_warn "[$id] Retry exited rc=139 (SIGSEGV)." ;;
1142-
134) log_warn "[$id] Retry exited rc=134 (SIGABRT)." ;;
1213+
134) log_warn "[$id] Retry exited rc=134 (SIGABORT)." ;;
11431214
137) log_warn "[$id] Retry exited rc=137 (SIGKILL/OOM?)." ;;
11441215
*) : ;;
11451216
esac
@@ -1263,9 +1334,11 @@ fi
12631334
if [ "$suite_rc" -eq 0 ] 2>/dev/null; then
12641335
log_pass "$TESTNAME: PASS"
12651336
printf '%s\n' "$TESTNAME PASS" >"$RES_FILE"
1337+
exit 0
12661338
else
12671339
log_fail "$TESTNAME: FAIL"
12681340
printf '%s\n' "$TESTNAME FAIL" >"$RES_FILE"
1341+
exit 1
12691342
fi
12701343

12711344
exit "$suite_rc"

0 commit comments

Comments
 (0)