@@ -73,6 +73,10 @@ KO_TREE="" # alt root that has lib/modules/$KVER
7373KO_TARBALL=" " # optional tarball that we unpack once
7474KO_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+
7680if [ -z " ${VIDEO_STACK:- } " ]; then VIDEO_STACK=" auto" ; fi
7781if [ -z " ${VIDEO_PLATFORM:- } " ]; then VIDEO_PLATFORM=" " ; fi
7882if [ -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)
117124EOF
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"
394410fi
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
397449if [ " $TOP_LEVEL_RUN " -eq 1 ]; then
398450 ensure_rootfs_min_size 2
402454
403455# If we're going to fetch, ensure network is online first — only once
404456if [ " $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
442494# --- Optional early fetch of bundle (best-effort, ALWAYS in LOG_ROOT) — only once
443495if [ " $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
12631334if [ " $suite_rc " -eq 0 ] 2> /dev/null; then
12641335 log_pass " $TESTNAME : PASS"
12651336 printf ' %s\n' " $TESTNAME PASS" > " $RES_FILE "
1337+ exit 0
12661338else
12671339 log_fail " $TESTNAME : FAIL"
12681340 printf ' %s\n' " $TESTNAME FAIL" > " $RES_FILE "
1341+ exit 1
12691342fi
12701343
12711344exit " $suite_rc "
0 commit comments