@@ -53,8 +53,9 @@ Options:
5353 --help Show this help
5454
5555Notes:
56- - If --bin-dir is omitted, 'fastrpc_test' must be on PATH or in known fallback paths.
57- - Default assets location prefers \$ BINDIR/linux (so /usr/bin/linux in your layout).
56+ - Default binary path is /usr/bin/fastrpc_test.
57+ - /bin/fastrpc_test is used ONLY if ALLOW_BIN_FASTRPC=1 or you pass --bin-dir /bin.
58+ - Default assets location prefers \$ BINDIR/linux (so /usr/bin/linux).
5859- If --arch is omitted, the -a flag is not passed at all.
5960EOF
6061}
@@ -97,18 +98,18 @@ log_info "-------------------Starting $TESTNAME Testcase------------------------
9798# Small debug helper
9899log_debug () { [ " $VERBOSE " -eq 1 ] && log_info " [debug] $* " ; }
99100
100- # -------------------- Binary detection (robust) - ----------------
101+ # -------------------- Binary detection (default: /usr/bin) ----------------
101102FASTBIN=" "
102- if [ -n " $BIN_DIR " ]; then
103+ if [ -n " $BIN_DIR " ] && [ -x " $BIN_DIR /fastrpc_test" ]; then
104+ # Explicit override wins
103105 FASTBIN=" $BIN_DIR /fastrpc_test"
104- elif command -v fastrpc_test > /dev/null 2>&1 ; then
105- FASTBIN=" $( command -v fastrpc_test) "
106- elif [ -x " /usr/bin/fastrpc_test" ]; then
106+ elif [ -x /usr/bin/fastrpc_test ]; then
107107 FASTBIN=" /usr/bin/fastrpc_test"
108- elif [ -x " /opt/qcom/bin/fastrpc_test" ]; then
109- FASTBIN=" /opt/qcom/bin/fastrpc_test"
108+ elif [ -x /bin/fastrpc_test ] && [ " ${ALLOW_BIN_FASTRPC:- 0} " = " 1" ]; then
109+ FASTBIN=" /bin/fastrpc_test"
110+ log_warn " ALLOW_BIN_FASTRPC=1: using /bin/fastrpc_test"
110111else
111- log_fail " 'fastrpc_test' not found (try --bin-dir or ensure PATH includes /usr /bin)."
112+ log_fail " 'fastrpc_test' not found in /usr/bin. Pass --bin-dir <dir> ( or ALLOW_BIN_FASTRPC=1 to allow /bin)."
112113 echo " $TESTNAME : FAIL" > " $RESULT_FILE "
113114 exit 1
114115fi
@@ -150,34 +151,19 @@ elif [ $HAVE_SCRIPT -eq 1 ]; then
150151fi
151152
152153# ---------------- Assets directory resolution ------------------
153- # Default must prefer $BINDIR/linux (e.g., /usr/bin/linux)
154- : " ${FASTRPC_ASSETS_DIR:= } "
154+ # Prefer $BINDIR/linux (e.g., /usr/bin/linux); allow explicit --assets-dir.
155155RESOLVED_RUN_DIR=" "
156-
157- # Priority: explicit flags/env → alongside binary → script dir → FHS-ish fallbacks
158- CANDIDATES="
159- ${ASSETS_DIR}
160- ${FASTRPC_ASSETS_DIR}
161- ${BINDIR}
162- ${SCRIPT_DIR}
163- ${BINDIR%/ bin} /share/fastrpc_test
164- /usr/share/fastrpc_test
165- /usr/lib/fastrpc_test
166- "
167-
168- for d in $CANDIDATES ; do
169- [ -n " $d " ] || continue
170- if [ -d " $d /linux" ]; then
171- RESOLVED_RUN_DIR=" $d "
172- break
173- fi
174- done
175-
176- if [ -n " $RESOLVED_RUN_DIR " ]; then
177- log_info " Assets dir: $RESOLVED_RUN_DIR (found 'linux/')"
156+ if [ -n " $ASSETS_DIR " ] && [ -d " $ASSETS_DIR /linux" ]; then
157+ RESOLVED_RUN_DIR=" $ASSETS_DIR "
158+ elif [ -d /usr/bin/linux ]; then
159+ RESOLVED_RUN_DIR=" /usr/bin"
160+ elif [ -d " $BINDIR /linux" ]; then
161+ RESOLVED_RUN_DIR=" $BINDIR "
162+ elif [ -d " $SCRIPT_DIR /linux" ]; then
163+ RESOLVED_RUN_DIR=" $SCRIPT_DIR "
178164else
179165 RESOLVED_RUN_DIR=" $BINDIR "
180- log_warn " No 'linux/' assets found; continuing from $RESOLVED_RUN_DIR "
166+ log_warn " No 'linux/' assets found; running from $RESOLVED_RUN_DIR "
181167fi
182168
183169# -------------------- Logging root -----------------------------
@@ -187,7 +173,8 @@ mkdir -p "$LOG_ROOT" || { log_error "Cannot create $LOG_ROOT"; echo "$TESTNAME :
187173
188174tmo_label=" none" ; [ -n " $TIMEOUT " ] && tmo_label=" ${TIMEOUT} s"
189175log_info " Repeats: $REPEAT | Timeout: $tmo_label | Buffering: $buf_label "
190- log_debug " Run dir: $RESOLVED_RUN_DIR "
176+ log_info " Run dir: $RESOLVED_RUN_DIR "
177+ log_debug " Run dir has linux?: $( [ -d " $RESOLVED_RUN_DIR /linux" ] && echo yes || echo no ) "
191178
192179# -------------------- Run loop ---------------------------------
193180PASS_COUNT=0
0 commit comments