@@ -44,7 +44,65 @@ STOP_TO="${STOP_TO:-10}"
4444START_TO=" ${START_TO:- 10} "
4545POLL_I=" ${POLL_I:- 1} "
4646
47- log_info " DEBUG: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I "
47+ # --- CLI ----------------------------------------------------------------------
48+ # Default: do NOT do SSR (stop/start). Enable explicitly with --ssr
49+ DO_SSR=0
50+
51+ usage () {
52+ echo " Usage: $0 [--ssr] [--stop-to SEC] [--start-to SEC] [--poll-i SEC]" >&2
53+ echo " --ssr Perform CDSP stop/start (SSR). Default: OFF" >&2
54+ echo " --stop-to SEC Stop timeout (default: $STOP_TO )" >&2
55+ echo " --start-to SEC Start timeout (default: $START_TO )" >&2
56+ echo " --poll-i SEC Poll interval (default: $POLL_I )" >&2
57+ }
58+
59+ while [ $# -gt 0 ]; do
60+ case " $1 " in
61+ --ssr)
62+ DO_SSR=1
63+ shift
64+ ;;
65+ --stop-to)
66+ if [ $# -lt 2 ]; then
67+ log_fail " Missing value for --stop-to"
68+ usage
69+ exit 2
70+ fi
71+ STOP_TO=" $2 "
72+ shift 2
73+ ;;
74+ --start-to)
75+ if [ $# -lt 2 ]; then
76+ log_fail " Missing value for --start-to"
77+ usage
78+ exit 2
79+ fi
80+ START_TO=" $2 "
81+ shift 2
82+ ;;
83+ --poll-i)
84+ if [ $# -lt 2 ]; then
85+ log_fail " Missing value for --poll-i"
86+ usage
87+ exit 2
88+ fi
89+ POLL_I=" $2 "
90+ shift 2
91+ ;;
92+ -h|--help)
93+ usage
94+ exit 0
95+ ;;
96+ * )
97+ log_warn " Unknown argument: $1 "
98+ usage
99+ exit 2
100+ ;;
101+ esac
102+ done
103+
104+ log_info " Tunables: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I "
105+ log_info " SSR control: DO_SSR=$DO_SSR (0=no stop/start, 1=do stop/start)"
48106
49107# --- Device Tree gate ----------------------------------------------------
50108if dt_has_remoteproc_fw " $FW " ; then
58116
59117# ---------- Discover all matching remoteproc entries ----------
60118# get_remoteproc_by_firmware prints: "path|state|firmware|name"
61- entries=" $( get_remoteproc_by_firmware " $FW " " " all) " || entries=" "
119+ entries=" $( get_remoteproc_by_firmware " $FW " " " all 2> /dev/null ) " || entries=" "
62120if [ -z " $entries " ]; then
63121 log_fail " $FW present in DT but no /sys/class/remoteproc entry found"
122+ log_info " Writing to $RES_FILE "
123+ echo " $TESTNAME FAIL" > " $RES_FILE "
64124 exit 1
65125fi
66126
@@ -97,43 +157,51 @@ while IFS='|' read -r rpath rstate rfirm rname; do
97157 continue
98158 fi
99159
100- # Stop
101- dump_rproc_logs " $rpath " before-stop
102- t0=$( date +%s)
103- log_info " $inst_id : stopping"
104- if stop_remoteproc " $rpath " && wait_remoteproc_state " $rpath " offline " $STOP_TO " " $POLL_I " ; then
105- t1=$( date +%s)
106- log_pass " $inst_id : stop PASS ($(( t1 - t0 )) s)"
107- stop_res=" PASS"
108- else
109- dump_rproc_logs " $rpath " after-stop-fail
110- log_fail " $inst_id : stop FAIL"
111- stop_res=" FAIL"
112- inst_fail=$(( inst_fail + 1 ))
113- RESULT_LINES=" $RESULT_LINES
160+ if [ " $DO_SSR " -eq 1 ]; then
161+ # Stop
162+ dump_rproc_logs " $rpath " before-stop
163+ t0=$( date +%s)
164+ log_info " $inst_id : stopping"
165+ log_info " $inst_id : waiting for state=offline with timeout=${STOP_TO} s poll=${POLL_I} s"
166+ if stop_remoteproc " $rpath " && wait_remoteproc_state " $rpath " offline " $STOP_TO " " $POLL_I " ; then
167+ t1=$( date +%s)
168+ log_pass " $inst_id : stop PASS ($(( t1 - t0 )) s)"
169+ stop_res=" PASS"
170+ else
171+ dump_rproc_logs " $rpath " after-stop-fail
172+ log_fail " $inst_id : stop FAIL"
173+ stop_res=" FAIL"
174+ inst_fail=$(( inst_fail + 1 ))
175+ RESULT_LINES=" $RESULT_LINES
114176 $inst_id : boot=$boot_res , stop=$stop_res , start=$start_res , ping=$ping_res "
115- continue
116- fi
117- dump_rproc_logs " $rpath " after-stop
118-
119- # Start
120- dump_rproc_logs " $rpath " before-start
121- t2=$( date +%s)
122- log_info " $inst_id : starting"
123- if start_remoteproc " $rpath " && wait_remoteproc_state " $rpath " running " $START_TO " " $POLL_I " ; then
124- t3=$( date +%s)
125- log_pass " $inst_id : start PASS ($(( t3 - t2 )) s)"
126- start_res=" PASS"
127- else
128- dump_rproc_logs " $rpath " after-start-fail
129- log_fail " $inst_id : start FAIL"
130- start_res=" FAIL"
131- inst_fail=$(( inst_fail + 1 ))
132- RESULT_LINES=" $RESULT_LINES
177+ continue
178+ fi
179+ dump_rproc_logs " $rpath " after-stop
180+
181+ # Start
182+ dump_rproc_logs " $rpath " before-start
183+ t2=$( date +%s)
184+ log_info " $inst_id : starting"
185+ log_info " $inst_id : waiting for state=running with timeout=${START_TO} s poll=${POLL_I} s"
186+ if start_remoteproc " $rpath " && wait_remoteproc_state " $rpath " running " $START_TO " " $POLL_I " ; then
187+ t3=$( date +%s)
188+ log_pass " $inst_id : start PASS ($(( t3 - t2 )) s)"
189+ start_res=" PASS"
190+ else
191+ dump_rproc_logs " $rpath " after-start-fail
192+ log_fail " $inst_id : start FAIL"
193+ start_res=" FAIL"
194+ inst_fail=$(( inst_fail + 1 ))
195+ RESULT_LINES=" $RESULT_LINES
133196 $inst_id : boot=$boot_res , stop=$stop_res , start=$start_res , ping=$ping_res "
134- continue
197+ continue
198+ fi
199+ dump_rproc_logs " $rpath " after-start
200+ else
201+ log_info " $inst_id : SSR disabled (--ssr not set). Skipping stop/start."
202+ stop_res=" SKIPPED"
203+ start_res=" SKIPPED"
135204 fi
136- dump_rproc_logs " $rpath " after-start
137205
138206 # Optional RPMsg ping
139207 if CTRL_DEV=$( find_rpmsg_ctrl_for " $FW " ) ; then
0 commit comments