Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ metadata:
- Now tests ALL supported DSP domains detected at runtime (ADSP, MDSP, SDSP, CDSP, CDSP1, GPDSP0, GPDSP1)
- Tests BOTH signed (system) and unsigned (user) Protection Domains where hardware supports them
- ADSP/MDSP/SDSP: signed PD only; CDSP/CDSP1/GPDSP: both signed and unsigned PDs
- QCS9075, QCS8275, QCS8300, QCS9100: GPDSP0/GPDSP1 domains are skipped (fastrpc_tests binaries not supported temporarily)
- Entire test SKIPs early if FastRPC system libraries (libadsprpc/libcdsprpc/libsdsprpc), DSP skeleton directories (v75/v68), or test libraries (libcalculator/libhap_example/libmultithreading) are absent
- Domains without a `/dev/fastrpc-<label>` or `/dev/fastrpc-<label>-secure` endpoint are skipped at runtime; explicitly selected domains (--domain / --domain-name / single mode) with a missing endpoint produce FAIL with remoteproc diagnostics
- For single-domain testing: set DOMAIN_MODE="single" and specify DOMAIN or DOMAIN_NAME
os:
- linux
Expand Down
115 changes: 73 additions & 42 deletions Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ log_info "-------------------Starting $TESTNAME Testcase------------------------
log_info "Kernel: $(uname -a 2>/dev/null || echo N/A)"
log_info "Date(UTC): $(date -u 2>/dev/null || echo N/A)"
log_soc_info
SOC_MACHINE="$(tr -s ' ' < /sys/devices/soc0/machine 2>/dev/null | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"

# -------------------- Binary directory resolution -----------------
if [ -n "$BIN_DIR" ]; then
Expand Down Expand Up @@ -216,6 +215,28 @@ fi
# -------------------- Runtime layout discovery --------------------
fastrpc_setup_runtime_layout

# Gate on artifacts being present: a domain appearing in remoteproc/DT does not
# guarantee the FastRPC libraries, DSP skeletons, and test libraries are installed
# and usable. Without them every invocation would fail rather than skip, which is
# the wrong signal.
if [ -z "${FASTRPC_RESOLVED_LIB_SYS_DIR:-}" ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new discovery correctly resolves FASTRPC_RESOLVED_LIB_TEST_DIR only when libcalculator.so, libhap_example.so, or libmultithreading.so exists, but this prerequisite gate never requires it. A target with the system library and skeletons but without the test libraries still reaches fastrpc_test and fails at runtime, contradicting this change’s “missing artifacts should skip” policy. Add a clean SKIP gate for an empty FASTRPC_RESOLVED_LIB_TEST_DIR alongside the system-library and skeleton checks.

log_skip "$TESTNAME SKIP - FastRPC system library not found (no libadsprpc/libcdsprpc/libsdsprpc)"
echo "$TESTNAME : SKIP" >"$RESULT_FILE"
exit 0
fi

if [ -z "${FASTRPC_RESOLVED_SKEL_PATH:-}" ]; then
log_skip "$TESTNAME SKIP - FastRPC DSP skeleton directory not found (no v75 or v68 under base)"
echo "$TESTNAME : SKIP" >"$RESULT_FILE"
exit 0
fi

if [ -z "${FASTRPC_RESOLVED_LIB_TEST_DIR:-}" ]; then
log_skip "$TESTNAME SKIP - FastRPC test libraries not found (no libcalculator/libhap_example/libmultithreading)"
echo "$TESTNAME : SKIP" >"$RESULT_FILE"
exit 0
fi

log_info "Using binary: $RUN_BIN"
log_info "Run dir: $RUN_DIR (launching ./fastrpc_test)"
log_info "Binary details:"
Expand All @@ -237,47 +258,52 @@ if [ -z "$DOMAINS_TO_TEST" ]; then
exit 0
fi

# -------------------- SoC-specific domain blacklist --------------------
# QRB2210: FastRPC not supported - skip entire test
# QCS9075, QCS8275, QCS8300, QCS9100: GPDSP0 (domain 5) and GPDSP1 (domain 6) not supported currently
# SM8850: libhap_example HAP_mem DMA not supported - treat as known skip per invocation
#
# Do not skip Glymur CRD by SoC name. Newer Glymur/Debian images expose
# ADSP/CDSP remoteproc instances and FastRPC skeletons, so runtime discovery
# should decide whether the test can run.
soc_skip_all=0
soc_skip_gpdsp=0

case "$SOC_MACHINE" in
*QRB2210*|*"Glymur CRD"*)
Comment thread
anankulk marked this conversation as resolved.
soc_skip_all=1
;;
*QCS9075*|*QCS8275*|*QCS8300*|*QCS9100*)
soc_skip_gpdsp=1
;;
esac

if [ "$soc_skip_all" -eq 1 ]; then
log_skip "$TESTNAME SKIP - SoC $SOC_MACHINE does not support FastRPC"
echo "$TESTNAME : SKIP" >"$RESULT_FILE"
exit 0
# -------------------- Validate FastRPC endpoint availability --------------------
# Skip per-domain endpoint check on QDA DRM kernels (no /dev/fastrpc-* nodes).
fastrpc_chardev_iface=0
for _fastrpc_dev in /dev/fastrpc-*; do
[ -c "$_fastrpc_dev" ] && fastrpc_chardev_iface=1 && break
done
unset _fastrpc_dev
if [ "$fastrpc_chardev_iface" -eq 1 ]; then
log_info "FastRPC interface: character device (/dev/fastrpc-*)"
else
log_info "FastRPC interface: non-chardev (QDA DRM or similar); skipping endpoint filter"
fi

if [ "$soc_skip_gpdsp" -eq 1 ]; then
filtered=""
if [ "$fastrpc_chardev_iface" -eq 1 ]; then
# Explicit domain selection requires the endpoint present; auto-discovered
# missing endpoints are filtered out silently.
domain_selection_explicit=0
{ [ -n "$CLI_DOMAIN_NAME" ] || [ -n "$CLI_DOMAIN" ] || [ "$DOMAIN_MODE" = "single" ]; } \
&& domain_selection_explicit=1

available_domains=""
for d in $DOMAINS_TO_TEST; do
case "$d" in
5|6) log_info "SoC $SOC_MACHINE: skipping $(domain_to_name "$d") (not supported)" ;;
*) filtered="${filtered:+$filtered }$d" ;;
esac
dom_name="$(domain_to_name "$d")"
ep_label="$(domain_to_endpoint_label "$d")"
if fastrpc_domain_endpoint_available "$d"; then
available_domains="${available_domains:+$available_domains }$d"
log_debug "Endpoint available: /dev/fastrpc-${ep_label} (or -secure)"
else
log_warn "$dom_name: endpoint not present (checked /dev/fastrpc-${ep_label} and /dev/fastrpc-${ep_label}-secure); domain present in DT/remoteproc but not usable"
if [ "$domain_selection_explicit" -eq 1 ]; then
log_fail "$dom_name: explicitly selected endpoint not present (checked /dev/fastrpc-${ep_label} and /dev/fastrpc-${ep_label}-secure)"
log_dsp_remoteproc_status
echo "$TESTNAME : FAIL" >"$RESULT_FILE"
exit 0
fi
fi
done
DOMAINS_TO_TEST="$filtered"
fi

if [ -z "$DOMAINS_TO_TEST" ]; then
log_skip "$TESTNAME SKIP - no supported domains remain after SoC filter ($SOC_MACHINE)"
echo "$TESTNAME : SKIP" >"$RESULT_FILE"
exit 0
if [ -z "$available_domains" ]; then
log_dsp_remoteproc_status
log_skip "$TESTNAME SKIP - no FastRPC endpoint devices found"
echo "$TESTNAME : SKIP" >"$RESULT_FILE"
exit 0
fi

DOMAINS_TO_TEST="$available_domains"
fi

log_info "Domain mode: $DOMAIN_MODE"
Expand Down Expand Up @@ -328,6 +354,16 @@ RESULTS_TRACKER=""

for DOMAIN in $DOMAINS_TO_TEST; do
dom_name="$(domain_to_name "$DOMAIN")"

# Defensive re-check; the pre-filter above should have caught this.
if [ "$fastrpc_chardev_iface" -eq 1 ]; then
if ! fastrpc_domain_endpoint_available "$DOMAIN"; then
_ep="$(domain_to_endpoint_label "$DOMAIN")"
log_info "Skipping $dom_name: endpoint not present (checked /dev/fastrpc-${_ep} and /dev/fastrpc-${_ep}-secure)"
continue
fi
fi

PD_VALUES="$(effective_pds_for_domain "$DOMAIN")"

if [ -z "$PD_VALUES" ]; then
Expand Down Expand Up @@ -433,15 +469,10 @@ for DOMAIN in $DOMAINS_TO_TEST; do
fi

# Track invocation result immediately
# SM8850: libhap_example HAP_mem DMA handle not supported - treat as known skip
if [ "$rc" -eq 0 ] && [ -r "$iter_log" ] && grep -F -q -e "All tests completed successfully" -e "All applicable tests PASSED" "$iter_log"; then
PASS_COUNT=$((PASS_COUNT+1))
combo_pass=$((combo_pass+1))
log_pass "$iter_tag: success"
elif case "$SOC_MACHINE" in *SM8850*) true ;; *) false ;; esac && only_hap_example_failed "$iter_log"; then
PASS_COUNT=$((PASS_COUNT+1))
combo_pass=$((combo_pass+1))
log_pass "$iter_tag: success (libhap_example.so HAP_mem skipped on $SOC_MACHINE - DMA handle not supported)"
else
combo_fail=$((combo_fail+1))
log_warn "$iter_tag: success pattern not found"
Expand Down
76 changes: 64 additions & 12 deletions Runner/utils/lib_fastrpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,44 @@ fastrpc_first_existing_word_dir() {
return 1
}

# Returns the first directory in the space-separated candidate_dirs list that
# contains at least one FastRPC system library (libadsprpc, libcdsprpc, or
# libsdsprpc). Generic directories like /usr/lib that exist without FastRPC
# installed are skipped.
fastrpc_first_dir_with_fastrpc_syslib() {
candidate_dirs="$1"
for candidate_dir in $candidate_dirs; do
[ -d "$candidate_dir" ] || continue
for lib in libadsprpc libcdsprpc libsdsprpc; do
if find "$candidate_dir" -maxdepth 1 -name "${lib}.so*" 2>/dev/null \
| grep -qm1 .; then
printf '%s\n' "$candidate_dir"
return 0
fi
done
done
return 1
}

# Returns the first directory in the space-separated candidate_dirs list that
# contains at least one known FastRPC test library (libcalculator, libhap_example,
# or libmultithreading). Matches both unversioned (.so) and versioned (.so.N)
# forms so Debian runtime-only installs are detected correctly.
fastrpc_first_dir_with_testlib() {
Comment thread
anankulk marked this conversation as resolved.
candidate_dirs="$1"
for candidate_dir in $candidate_dirs; do
[ -d "$candidate_dir" ] || continue
for lib in libcalculator libhap_example libmultithreading; do
if find "$candidate_dir" -maxdepth 1 -name "${lib}.so*" 2>/dev/null \
| grep -qm1 .; then
printf '%s\n' "$candidate_dir"
return 0
fi
done
done
return 1
}

fastrpc_detect_multiarch_triplet() {
triplet=""

Expand Down Expand Up @@ -148,8 +186,8 @@ fastrpc_discover_runtime_layout() {
FASTRPC_LIB_TEST_DIRS_CHECKED="$(fastrpc_append_word_unique "$FASTRPC_LIB_TEST_DIRS_CHECKED" "/usr/lib/fastrpc_test")"
FASTRPC_SKEL_BASES_CHECKED="$(fastrpc_append_word_unique "$FASTRPC_SKEL_BASES_CHECKED" "/usr/share/fastrpc_test")"

FASTRPC_RESOLVED_LIB_SYS_DIR="$(fastrpc_first_existing_word_dir "$FASTRPC_LIB_SYS_DIRS_CHECKED" || true)"
FASTRPC_RESOLVED_LIB_TEST_DIR="$(fastrpc_first_existing_word_dir "$FASTRPC_LIB_TEST_DIRS_CHECKED" || true)"
FASTRPC_RESOLVED_LIB_SYS_DIR="$(fastrpc_first_dir_with_fastrpc_syslib "$FASTRPC_LIB_SYS_DIRS_CHECKED" || true)"
FASTRPC_RESOLVED_LIB_TEST_DIR="$(fastrpc_first_dir_with_testlib "$FASTRPC_LIB_TEST_DIRS_CHECKED" || true)"
FASTRPC_RESOLVED_SKEL_BASE="$(fastrpc_first_existing_word_dir "$FASTRPC_SKEL_BASES_CHECKED" || true)"

FASTRPC_RESOLVED_SKEL_PATH=""
Expand Down Expand Up @@ -262,16 +300,6 @@ extract_test_summary_counts() {
printf '%s:%s:%s:%s\n' "$total" "$passed" "$failed" "$skipped"
}

# Returns true if the only failing subtest is libhap_example.so.
# Used to treat HAP_mem DMA failures as known-skip on affected SoCs.
only_hap_example_failed() {
log_file="$1"

[ -r "$log_file" ] || return 1
grep -F -q "[FAIL]" "$log_file" || return 1
! grep -F "[FAIL]" "$log_file" | grep -q -v "libhap_example.so"
}

log_dsp_remoteproc_status() {
fw_list="adsp mdsp sdsp cdsp cdsp0 cdsp1 gdsp0 gdsp1 gpdsp0 gpdsp1"
any=0
Expand Down Expand Up @@ -323,6 +351,30 @@ domain_to_name() {
esac
}

# Maps a domain number to the DT binding label used by the FastRPC driver
# when naming /dev/fastrpc-<label>. GPDSP domains use the DT label gdsp0/gdsp1,
# not the presentation names gpdsp0/gpdsp1.
domain_to_endpoint_label() {
case "$1" in
0) echo "adsp" ;;
1) echo "mdsp" ;;
2) echo "sdsp" ;;
3) echo "cdsp" ;;
4) echo "cdsp1" ;;
5) echo "gdsp0" ;;
6) echo "gdsp1" ;;
*) echo "" ;;
esac
}

# Returns 0 if a usable FastRPC character device exists for the given domain.
# Checks both /dev/fastrpc-<label> and /dev/fastrpc-<label>-secure.
fastrpc_domain_endpoint_available() {
_label="$(domain_to_endpoint_label "$1")"
[ -n "$_label" ] || return 1
[ -c "/dev/fastrpc-${_label}" ] || [ -c "/dev/fastrpc-${_label}-secure" ]
}

append_unique() {
current="$1"
new="$2"
Expand Down