@@ -43,7 +43,7 @@ usage() {
4343Usage: $0 [OPTIONS]
4444
4545Options:
46- --arch <name> Architecture (auto-detected if omitted )
46+ --arch <name> Architecture (only if explicitly provided )
4747 --bin-dir <path> Directory containing 'fastrpc_test' binary
4848 --assets-dir <path> Directory that CONTAINS 'linux/' (run from here if present)
4949 --repeat <N> Number of test repetitions (default: 1)
@@ -54,7 +54,7 @@ Options:
5454Notes:
5555- If --bin-dir is omitted, 'fastrpc_test' must be on PATH.
5656- If --assets-dir is omitted or lacks 'linux/', we run from the binary's dir.
57- - Uses stdbuf/script if available for unbuffered output; otherwise runs plain .
57+ - If --arch is omitted, the -a flag is not passed at all .
5858EOF
5959}
6060
@@ -66,7 +66,7 @@ while [ $# -gt 0 ]; do
6666 --assets-dir) ASSETS_DIR=" $2 " ; shift 2 ;;
6767 --repeat) REPEAT=" $2 " ; shift 2 ;;
6868 --timeout) TIMEOUT=" $2 " ; shift 2 ;;
69- --verbose) VERBOSE=1; shift ;; # actively used below
69+ --verbose) VERBOSE=1; shift ;;
7070 --help) usage; exit 0 ;;
7171 * ) echo " [ERROR] Unknown argument: $1 " >&2 ; usage; exit 1 ;;
7272 esac
8181test_path=" $( find_test_case_by_name " $TESTNAME " ) "
8282cd " $test_path " || exit 1
8383
84- log_info " ----------------------------------------------------------------------------------------- "
84+ log_info " --------------------------------------------------------------------------"
8585log_info " -------------------Starting $TESTNAME Testcase----------------------------"
8686
8787# Small debug helper
105105BINDIR=" $( dirname " $FASTBIN " ) "
106106log_info " Binary: $FASTBIN "
107107
108- # ---------- Arch detection if needed ----------
109- if [ -z " $ARCH " ]; then
110- soc=" $( cat /sys/devices/soc0/soc_id 2> /dev/null || echo " unknown" ) "
111- case " $soc " in
112- 498) ARCH=" v68" ;;
113- 676|534) ARCH=" v73" ;;
114- 606) ARCH=" v75" ;;
115- * ) log_warn " Unknown SoC ID: $soc ; defaulting to 'v68'" ; ARCH=" v68" ;;
116- esac
108+ # Extra binary info for debugging
109+ log_info " Binary details:"
110+ log_info " ls -l: $( ls -l " $FASTBIN " 2> /dev/null || echo ' N/A' ) "
111+ log_info " file : $( file " $FASTBIN " 2> /dev/null || echo ' N/A' ) "
112+
113+ # ---------- Optional arch argument ----------
114+ ARCH_OPT=" "
115+ if [ -n " $ARCH " ]; then
116+ ARCH_OPT=" -a $ARCH "
117+ log_info " Arch option provided: $ARCH "
118+ else
119+ log_info " No --arch provided; running without -a"
117120fi
118121
119122# ---------- Buffering tool availability ----------
131134# ---------- Assets directory resolution ----------
132135RESOLVED_RUN_DIR=" "
133136if [ -n " $ASSETS_DIR " ]; then
134- # Use user-provided assets dir if it exists; prefer it if it has linux/
135137 if [ -d " $ASSETS_DIR " ]; then
136138 RESOLVED_RUN_DIR=" $ASSETS_DIR "
137- if [ ! -d " $ASSETS_DIR /linux" ]; then
138- log_debug " --assets-dir provided but no 'linux/' inside: $ASSETS_DIR (continuing anyway)"
139- else
139+ if [ -d " $ASSETS_DIR /linux" ]; then
140140 log_info " Using --assets-dir: $ASSETS_DIR (expects: $ASSETS_DIR /linux)"
141+ else
142+ log_debug " --assets-dir provided but no 'linux/' inside: $ASSETS_DIR "
141143 fi
142144 else
143145 log_warn " --assets-dir not found: $ASSETS_DIR (falling back to binary dir)"
144146 fi
145147fi
146-
147148if [ -z " $RESOLVED_RUN_DIR " ]; then
148149 if [ -d " $BINDIR /linux" ]; then
149150 RESOLVED_RUN_DIR=" $BINDIR "
150151 elif [ -d " $SCRIPT_DIR /linux" ]; then
151152 RESOLVED_RUN_DIR=" $SCRIPT_DIR "
152153 else
153- # Last resort: run from the binary directory
154154 RESOLVED_RUN_DIR=" $BINDIR "
155155 fi
156156fi
157-
158- # Quiet note if linux/ missing (don’t spam CI output)
159- [ -d " $RESOLVED_RUN_DIR /linux" ] || log_debug " No 'linux/' under run dir: $RESOLVED_RUN_DIR (binary may still work)"
160-
161- # ---------- Timeout wrapper (portable fallback) ----------
162- run_with_timeout () {
163- # Usage: run_with_timeout <timeout_sec_or_empty> -- <cmd> [args...]
164- tmo=" $1 " ; shift
165- [ " $1 " = " --" ] && shift
166- if [ -n " $tmo " ] && [ $HAVE_TIMEOUT -eq 1 ]; then
167- timeout " $tmo " " $@ "
168- return $?
169- fi
170-
171- if [ -z " $tmo " ]; then
172- " $@ "
173- return $?
174- fi
175-
176- # Fallback: crude timeout using a watcher
177- (
178- setsid " $@ " &
179- child=$!
180- (
181- sleep " $tmo "
182- if kill -0 " $child " 2> /dev/null; then
183- # shellcheck disable=SC2046
184- kill -TERM -$( ps -o pgid= " $child " | tr -d ' ' ) 2> /dev/null
185- fi
186- ) &
187- watcher=$!
188- wait " $child " ; rc=$?
189- kill " $watcher " 2> /dev/null
190- exit $rc
191- )
192- return $?
193- }
157+ [ -d " $RESOLVED_RUN_DIR /linux" ] || log_debug " No 'linux/' under run dir: $RESOLVED_RUN_DIR "
194158
195159# ---------- Logging root ----------
196160TS=" $( date +%Y%m%d-%H%M%S) "
197161LOG_ROOT=" ./logs_${TESTNAME} _${TS} "
198162mkdir -p " $LOG_ROOT " || { log_error " Cannot create $LOG_ROOT " ; echo " $TESTNAME : FAIL" > " $RESULT_FILE " ; exit 1; }
199163
200164tmo_label=" none" ; [ -n " $TIMEOUT " ] && tmo_label=" ${TIMEOUT} s"
201- log_info " Arch: $ARCH | Repeats: $REPEAT | Timeout: $tmo_label | Buffering: $buf_label "
165+ log_info " Repeats: $REPEAT | Timeout: $tmo_label | Buffering: $buf_label "
202166log_debug " Run dir: $RESOLVED_RUN_DIR | PATH=$PATH "
203167
204168# ---------- Run loop ----------
@@ -212,34 +176,36 @@ while [ "$i" -le "$REPEAT" ]; do
212176
213177 log_info " Running $iter_tag /$REPEAT | start: $iso_now | dir: $RESOLVED_RUN_DIR "
214178
215- # Execute from the chosen directory so binary can discover local deps
179+ # Build command string for debug only
180+ CMD=" $FASTBIN -d 3 -U 1 -t linux $ARCH_OPT "
181+ log_info " Executing: $CMD "
182+
216183 if [ $HAVE_STDBUF -eq 1 ]; then
217184 (
218185 cd " $RESOLVED_RUN_DIR " || exit 127
219- run_with_timeout " $TIMEOUT " -- stdbuf -oL -eL " $FASTBIN " -d 3 -U 1 -t linux -a " $ARCH "
186+ run_with_timeout " $TIMEOUT " stdbuf -oL -eL " $FASTBIN " -d 3 -U 1 -t linux " $ARCH_OPT "
220187 ) > " $iter_log " 2>&1
221188 rc=$?
222189 elif [ $HAVE_SCRIPT -eq 1 ]; then
223190 (
224191 cd " $RESOLVED_RUN_DIR " || exit 127
225192 if [ -n " $TIMEOUT " ] && [ $HAVE_TIMEOUT -eq 1 ]; then
226- script -q -c " timeout $TIMEOUT \" $FASTBIN \" -d 3 -U 1 -t linux -a \" $ARCH \" " /dev/null
193+ script -q -c " timeout $TIMEOUT $CMD " /dev/null
227194 else
228- script -q -c " \" $FASTBIN \" -d 3 -U 1 -t linux -a \" $ARCH \" " /dev/null
195+ script -q -c " $CMD " /dev/null
229196 fi
230197 ) > " $iter_log " 2>&1
231198 rc=$?
232199 else
233200 (
234201 cd " $RESOLVED_RUN_DIR " || exit 127
235- run_with_timeout " $TIMEOUT " -- " $FASTBIN " -d 3 -U 1 -t linux -a " $ARCH "
202+ run_with_timeout " $TIMEOUT " " $FASTBIN " -d 3 -U 1 -t linux " $ARCH_OPT "
236203 ) > " $iter_log " 2>&1
237204 rc=$?
238205 fi
239206
240207 printf ' %s\n' " $rc " > " $iter_rc "
241208
242- # Stream the iteration output to console (compact)
243209 if [ -s " $iter_log " ]; then
244210 echo " ----- $iter_tag output begin -----"
245211 cat " $iter_log "
0 commit comments