Skip to content

Commit 1bad903

Browse files
committed
fastrpc_test: default to /usr/bin; add --bin-dir/--assets-dir; block /bin unless explicitly allowed
- Always prefer /usr/bin/fastrpc_test (do not rely on PATH ordering or shell hash). - Support --bin-dir <dir> to point at a specific install prefix (runs <dir>/fastrpc_test). - Support --assets-dir <dir>; expects <dir>/linux/ (defaults to /usr/bin or $BINDIR/linux). - Only use /bin/fastrpc_test when explicitly allowed via ALLOW_BIN_FASTRPC=1 (or --bin-dir /bin). - Remove /opt probing and any overlay timing logic—image construction guarantees /usr/bin. - Invoke fastrpc_test as -d 3 -t linux (drop -U 1 user-PD flag). - Keep result/log behavior unchanged; cd into the resolved assets dir so linux/ lookups work. Signed-off-by: Srikanth Muppandam <[email protected]>
1 parent b7f6809 commit 1bad903

File tree

1 file changed

+23
-36
lines changed
  • Runner/suites/Multimedia/CDSP/fastrpc_test

1 file changed

+23
-36
lines changed

Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ Options:
5353
--help Show this help
5454
5555
Notes:
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.
5960
EOF
6061
}
@@ -97,18 +98,18 @@ log_info "-------------------Starting $TESTNAME Testcase------------------------
9798
# Small debug helper
9899
log_debug() { [ "$VERBOSE" -eq 1 ] && log_info "[debug] $*"; }
99100

100-
# -------------------- Binary detection (robust) -----------------
101+
# -------------------- Binary detection (default: /usr/bin) ----------------
101102
FASTBIN=""
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"
110111
else
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
114115
fi
@@ -150,34 +151,19 @@ elif [ $HAVE_SCRIPT -eq 1 ]; then
150151
fi
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.
155155
RESOLVED_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"
178164
else
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"
181167
fi
182168

183169
# -------------------- Logging root -----------------------------
@@ -187,7 +173,8 @@ mkdir -p "$LOG_ROOT" || { log_error "Cannot create $LOG_ROOT"; echo "$TESTNAME :
187173

188174
tmo_label="none"; [ -n "$TIMEOUT" ] && tmo_label="${TIMEOUT}s"
189175
log_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 ---------------------------------
193180
PASS_COUNT=0

0 commit comments

Comments
 (0)