Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 36 additions & 27 deletions Runner/plans/video_pre-merge.yaml
Original file line number Diff line number Diff line change
@@ -1,54 +1,63 @@
metadata:
format: Lava-Test Test Definition 1.0
name: Video_V4L2_With_Secrets
description: "Run Video V4L2 runner; use LAVA secrets for Wi-Fi; auto-args for kodiak vs lemans/monaco; run base & overlay"
name: Video_V4L2_LocalClips
description: "Run Video V4L2 runner with local clips tar and custom .ko dir; auto-args for kodiak vs lemans/monaco; run base & overlay"
maintainer:
- smuppand@qti.qualcomm.com
os:
- openembedded
scope:
- functional

run:
steps:
- cd Runner
- export REPO_ROOT="$PWD"
- export TARGET="${TARGET:-}" # expected values: kodiak | lemans | monaco (case-insensitive)

# Read Wi-Fi credentials from LAVA-provided secrets (exported as env vars in the job)
- export SSID="${LAVA_WIFI_SSID:-}"
- export PASSWORD="${LAVA_WIFI_PASSWORD:-}"
- export TARGET="${TARGET:-}" # kodiak | lemans | monaco (case-insensitive)

# Build args for run.sh based on TARGET; always pass secrets; add downstream FW only for kodiak
- |
RPATH="$REPO_ROOT/suites/Multimedia/Video/Video_V4L2_Runner/run.sh"
RESFILE="$REPO_ROOT/suites/Multimedia/Video/Video_V4L2_Runner/Video_V4L2_Runner.res"
ARGS=""

# Custom media bundle (local) paths
CLIPS_TAR="/data/vendor/iris_test_app/video_clips_iris.tar.gz"
CLIPS_DEST="/data/vendor/iris_test_app/clips"

# Custom downstream module location (directory containing iris_vpu.ko)
KO_DIR="/data/vendor/iris_test_app"

# Optional: downstream firmware needed on Kodiak overlay
DS_FW="/data/vendor/iris_test_app/vpu20_p1_gen2.mbn"

# Normalize/derive platform flag
TL="$(printf '%s' "${TARGET:-}" | tr '[:upper:]' '[:lower:]')"
case "$TL" in
kodiak)
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"
;;
lemans)
ARGS="$ARGS --platform lemans --ssid \"$SSID\" --password \"$PASSWORD\"" --app /data/vendor/iris_test_app/iris_v4l2_test
;;
monaco)
ARGS="$ARGS --platform monaco --ssid \"$SSID\" --password \"$PASSWORD\"" --app /data/vendor/iris_test_app/iris_v4l2_test
;;
*)
# Unknown or not provided: still pass secrets; platform autodetect in run.sh
ARGS="$ARGS --ssid \"$SSID\" --password \"$PASSWORD\""
;;
kodiak|lemans|monaco) PLAT="--platform $TL" ;;
*) PLAT="" ;; # autodetect
esac
echo "TARGET=${TARGET:-unset} ARGS=$ARGS"

# Run base (upstream) then overlay (downstream)
# Common args (clips local, no Wi-Fi or TAR_URL needed)
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"

# --- BASE (upstream): NO ko args here ---
ARGS_BASE="--stack base $ARGS_COMMON"

# --- OVERLAY (downstream): add ko args; on kodiak also add downstream FW ---
ARGS_OVERLAY="--stack overlay $ARGS_COMMON --ko-dir $KO_DIR --ko-prefer-custom"
if [ "$TL" = "kodiak" ]; then
ARGS_OVERLAY="$ARGS_OVERLAY --downstream-fw $DS_FW"
fi

echo "BASE ARGS: $ARGS_BASE"
echo "OVERLAY ARGS: $ARGS_OVERLAY"

# Run BASE (upstream)
# shellcheck disable=SC2086
sh -lc "$RPATH --stack base $ARGS" || true
sh -lc "$RPATH $ARGS_BASE" || true
"$REPO_ROOT/utils/send-to-lava.sh" "$RESFILE" || true

# Run OVERLAY (downstream)
# shellcheck disable=SC2086
sh -lc "$RPATH --stack overlay $ARGS" || true
sh -lc "$RPATH $ARGS_OVERLAY" || true
"$REPO_ROOT/utils/send-to-lava.sh" "$RESFILE" || true

# Optional roll-up (ignored if absent)
Expand Down
183 changes: 128 additions & 55 deletions Runner/suites/Multimedia/Video/Video_V4L2_Runner/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ KO_TREE="" # alt root that has lib/modules/$KVER
KO_TARBALL="" # optional tarball that we unpack once
KO_PREFER_CUSTOM="0" # 1 = try custom first; default 0 = system first

# --- Opt-in: custom media bundle tar (always honored even with --dir/--config) ---
CLIPS_TAR="" # /path/to/clips.tar[.gz|.xz|.zst|.bz2|.tgz|.tbz2|.zip]
CLIPS_DEST="" # optional extraction destination; defaults to cfg/dir root or testcase dir

if [ -z "${VIDEO_STACK:-}" ]; then VIDEO_STACK="auto"; fi
if [ -z "${VIDEO_PLATFORM:-}" ]; then VIDEO_PLATFORM=""; fi
if [ -z "${VIDEO_FW_DS:-}" ]; then VIDEO_FW_DS=""; fi
Expand Down Expand Up @@ -114,6 +118,9 @@ Usage: $0 [--config path.json|/path/dir] [--dir DIR] [--pattern GLOB]
# --- Stabilizers ---
[--retry-on-fail N] # retry up to N times if a case ends FAIL
[--post-test-sleep S] # sleep S seconds after each case
# --- Media bundle (opt-in, local tar) ---
[--clips-tar /path/to/clips.tar.gz] # extract locally even if --dir/--config is used
[--clips-dest DIR] # extraction destination (defaults to cfg/dir root or testcase dir)
EOF
}

Expand Down Expand Up @@ -245,6 +252,15 @@ while [ $# -gt 0 ]; do
shift
POST_TEST_SLEEP="$1"
;;
# --- Media bundle (opt-in, local tar) ---
--clips-tar)
shift
CLIPS_TAR="$1"
;;
--clips-dest)
shift
CLIPS_DEST="$1"
;;
--help|-h)
usage
exit 0
Expand Down Expand Up @@ -393,6 +409,42 @@ if [ -n "$LOG_FLAVOR" ]; then
TOP_LEVEL_RUN="0"
fi

# --- Opt-in local media bundle extraction (honored regardless of --config/--dir) ---
if [ -n "$CLIPS_TAR" ]; then
# destination resolution: explicit --clips-dest > cfg dir > --dir > testcase dir
clips_dest_resolved="$CLIPS_DEST"
if [ -z "$clips_dest_resolved" ]; then
if [ -n "$CFG" ] && [ -f "$CFG" ]; then
clips_dest_resolved="$(cd "$(dirname "$CFG")" 2>/dev/null && pwd)"
elif [ -n "$DIR" ] && [ -d "$DIR" ]; then
clips_dest_resolved="$DIR"
else
clips_dest_resolved="$test_path"
fi
fi
mkdir -p "$clips_dest_resolved" 2>/dev/null || true
video_step "" "Extract custom clips tar → $clips_dest_resolved"
case "$CLIPS_TAR" in
*.tar|*.tar.gz|*.tgz|*.tar.xz|*.txz|*.tar.zst|*.tar.bz2|*.tbz2)
if command -v tar >/dev/null 2>&1; then
tar -xf "$CLIPS_TAR" -C "$clips_dest_resolved" 2>/dev/null || true
else
log_warn "tar not available; cannot extract --clips-tar"
fi
;;
*.zip)
if command -v unzip >/dev/null 2>&1; then
unzip -o "$CLIPS_TAR" -d "$clips_dest_resolved" >/dev/null 2>&1 || true
else
log_warn "unzip not available; cannot extract --clips-tar"
fi
;;
*)
log_warn "Unrecognized archive type for --clips-tar: $CLIPS_TAR"
;;
esac
fi

# Ensure rootfs meets minimum size (2GiB) BEFORE any downloads — only once
if [ "$TOP_LEVEL_RUN" -eq 1 ]; then
ensure_rootfs_min_size 2
Expand All @@ -402,7 +454,7 @@ fi

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

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

saved_log_dir="$LOG_DIR"
LOG_DIR="$LOG_ROOT"
export LOG_DIR
saved_log_dir="$LOG_DIR"
LOG_DIR="$LOG_ROOT"
export LOG_DIR

if command -v check_network_status_rc >/dev/null 2>&1; then
if ! check_network_status_rc; then
log_info "Network unreachable; skipping early media bundle fetch."
if command -v check_network_status_rc >/dev/null 2>&1; then
if ! check_network_status_rc; then
log_info "Network unreachable; skipping early media bundle fetch."
else
extract_tar_from_url "$TAR_URL" || true
fi
else
extract_tar_from_url "$TAR_URL" || true
fi
else
extract_tar_from_url "$TAR_URL" || true
fi

LOG_DIR="$saved_log_dir"
export LOG_DIR
LOG_DIR="$saved_log_dir"
export LOG_DIR
fi
else
log_info "Skipping early bundle fetch (explicit --config/--dir provided or EXTRACT_INPUT_CLIPS=false)."
fi
Expand Down Expand Up @@ -586,6 +642,16 @@ if [ "${VIDEO_STACK}" = "both" ]; then
args="$args --post-test-sleep $(printf %s "$POST_TEST_SLEEP")"
fi

# --- Media bundle passthrough ---
if [ -n "${CLIPS_TAR:-}" ]; then
esc_tar="$(printf %s "$CLIPS_TAR" | sed "s/'/'\\\\''/g")"
args="$args --clips-tar '$esc_tar'"
fi
if [ -n "${CLIPS_DEST:-}" ]; then
esc_dst="$(printf %s "$CLIPS_DEST" | sed "s/'/'\\\\''/g")"
args="$args --clips-dest '$esc_dst'"
fi

printf "%s" "$args"
}

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

# Fetch only when not explicitly provided a config/dir and feature enabled
if [ "$EXTRACT_INPUT_CLIPS" = "true" ] && [ -z "$CFG" ] && [ -z "$DIR" ]; then
video_step "$id" "Ensure clips present or fetch"

saved_log_dir_case="$LOG_DIR"
LOG_DIR="$LOG_ROOT"
export LOG_DIR

video_ensure_clips_present_or_fetch "$cfg" "$TAR_URL"
ce=$?

LOG_DIR="$saved_log_dir_case"
export LOG_DIR

# Map generic download errors to "offline" if link just flapped
if [ "$ce" -eq 1 ] 2>/dev/null; then
sleep "${NET_STABILIZE_SLEEP:-5}"
if [ -n "$CLIPS_TAR" ]; then
log_info "[$id] Custom --clips-tar provided; skipping online per-test fetch."
ce=0
else
video_step "$id" "Ensure clips present or fetch"

saved_log_dir_case="$LOG_DIR"
LOG_DIR="$LOG_ROOT"
export LOG_DIR

video_ensure_clips_present_or_fetch "$cfg" "$TAR_URL"
ce=$?

LOG_DIR="$saved_log_dir_case"
export LOG_DIR

# Map generic download errors to "offline" if link just flapped
if [ "$ce" -eq 1 ] 2>/dev/null; then
sleep "${NET_STABILIZE_SLEEP:-5}"

if command -v check_network_status_rc >/dev/null 2>&1; then
if ! check_network_status_rc; then
ce=2
fi
elif command -v check_network_status >/dev/null 2>&1; then
if ! check_network_status >/dev/null 2>&1; then
ce=2
fi
fi
fi

if command -v check_network_status_rc >/dev/null 2>&1; then
if ! check_network_status_rc; then
ce=2
if [ "$ce" -eq 2 ] 2>/dev/null; then
if [ "$mode" = "decode" ]; then
log_skip "[$id] SKIP - offline and clips missing (decode case)"
printf '%s\n' "$id SKIP $pretty" >> "$LOG_DIR/summary.txt"
printf '%s\n' "$mode,$id,SKIP,$pretty,0,0,0" >> "$LOG_DIR/results.csv"
skip=$((skip + 1))
continue
fi
elif command -v check_network_status >/dev/null 2>&1; then
if ! check_network_status >/dev/null 2>&1; then
ce=2
elif [ "$ce" -eq 1 ] 2>/dev/null; then
log_fail "[$id] FAIL - fetch/extract failed while online"
printf '%s\n' "$id FAIL $pretty" >> "$LOG_DIR/summary.txt"
printf '%s\n' "$mode,$id,FAIL,$pretty,0,0,0" >> "$LOG_DIR/results.csv"
fail=$((fail + 1))
suite_rc=1

if [ "$STOP_ON_FAIL" -eq 1 ]; then
break
fi
fi
fi

if [ "$ce" -eq 2 ] 2>/dev/null; then
if [ "$mode" = "decode" ]; then
log_skip "[$id] SKIP - offline and clips missing (decode case)"
printf '%s\n' "$id SKIP $pretty" >> "$LOG_DIR/summary.txt"
printf '%s\n' "$mode,$id,SKIP,$pretty,0,0,0" >> "$LOG_DIR/results.csv"
skip=$((skip + 1))
continue
fi
elif [ "$ce" -eq 1 ] 2>/dev/null; then
log_fail "[$id] FAIL - fetch/extract failed while online"
printf '%s\n' "$id FAIL $pretty" >> "$LOG_DIR/summary.txt"
printf '%s\n' "$mode,$id,FAIL,$pretty,0,0,0" >> "$LOG_DIR/results.csv"
fail=$((fail + 1))
suite_rc=1

if [ "$STOP_ON_FAIL" -eq 1 ]; then
break
fi

continue
fi
else
log_info "[$id] Fetch disabled (explicit --config/--dir)."
Expand Down Expand Up @@ -1139,7 +1210,7 @@ while IFS= read -r cfg; do
if [ -n "$rc_val" ]; then
case "$rc_val" in
139) log_warn "[$id] Retry exited rc=139 (SIGSEGV)." ;;
134) log_warn "[$id] Retry exited rc=134 (SIGABRT)." ;;
134) log_warn "[$id] Retry exited rc=134 (SIGABORT)." ;;
137) log_warn "[$id] Retry exited rc=137 (SIGKILL/OOM?)." ;;
*) : ;;
esac
Expand Down Expand Up @@ -1263,9 +1334,11 @@ fi
if [ "$suite_rc" -eq 0 ] 2>/dev/null; then
log_pass "$TESTNAME: PASS"
printf '%s\n' "$TESTNAME PASS" >"$RES_FILE"
exit 0
else
log_fail "$TESTNAME: FAIL"
printf '%s\n' "$TESTNAME FAIL" >"$RES_FILE"
exit 1
fi

exit "$suite_rc"
Loading