From 283b5cf1ad2b3a0717ab34265b4ff0bd7bc105fa Mon Sep 17 00:00:00 2001 From: Anand Kulkarni Date: Mon, 10 Aug 2026 21:54:54 +0530 Subject: [PATCH] fastrpc-test: Add runtime validation and remove SoC-based filtering Enable FastRPC testing on QRB2210 and Glymur CRD by removing the hardcoded SoC-level skip. Remove the SoC-specific GPDSP0/GPDSP1 blacklist for QCS9075, QCS8275, QCS8300, and QCS9100; GPDSP availability is now determined entirely through runtime discovery. Add validation of FastRPC system library, DSP skeleton, and /dev/fastrpc- endpoint availability before test execution. Domains or configurations that are not usable are skipped early with a clear message instead of being invoked and failing. Remove the SM8850 libhap_example HAP_mem DMA exception (only_hap_example_failed) so results are reported consistently across all targets. Signed-off-by: Anand Kulkarni --- .../CDSP/fastrpc_test/fastrpc_test.yaml | 2 +- .../Multimedia/CDSP/fastrpc_test/run.sh | 97 +++++++++++-------- Runner/utils/lib_fastrpc.sh | 49 +++++++--- 3 files changed, 92 insertions(+), 56 deletions(-) diff --git a/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test.yaml b/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test.yaml index 0cae5cf9..cd8b533a 100644 --- a/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test.yaml +++ b/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test.yaml @@ -8,7 +8,7 @@ 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) + - Domains without a `/dev/fastrpc-` 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 diff --git a/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh b/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh index d3978995..67ef5c48 100755 --- a/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh +++ b/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh @@ -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 @@ -216,6 +215,22 @@ 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 endpoint device nodes are +# usable. Without them every invocation would fail rather than skip, which is +# the wrong signal. +if [ -z "${FASTRPC_RESOLVED_LIB_SYS_DIR:-}" ]; then + log_skip "$TESTNAME SKIP - FastRPC system library directory not found" + 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 + log_info "Using binary: $RUN_BIN" log_info "Run dir: $RUN_DIR (launching ./fastrpc_test)" log_info "Binary details:" @@ -237,49 +252,41 @@ 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"*) - 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 -fi +# -------------------- Validate FastRPC endpoint availability -------------------- +# Explicitly selected domains (--domain, --domain-name, single mode) must have +# their endpoint present; absence is a FAIL with remoteproc diagnostics. +# Auto-discovered domains without an endpoint are filtered out; if none remain +# the test SKIPs. +domain_selection_explicit=0 +{ [ -n "$CLI_DOMAIN_NAME" ] || [ -n "$CLI_DOMAIN" ] || [ "$DOMAIN_MODE" = "single" ]; } \ + && domain_selection_explicit=1 -if [ "$soc_skip_gpdsp" -eq 1 ]; then - filtered="" - 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 - done - DOMAINS_TO_TEST="$filtered" -fi +available_domains="" +for d in $DOMAINS_TO_TEST; do + dom_name="$(domain_to_name "$d")" + fastrpc_dev="/dev/fastrpc-$(printf '%s' "$dom_name" | tr '[:upper:]' '[:lower:]')" + if [ -c "$fastrpc_dev" ]; then + available_domains="${available_domains:+$available_domains }$d" + log_debug "Endpoint available: $fastrpc_dev" + else + log_debug "Endpoint not available: $fastrpc_dev" + if [ "$domain_selection_explicit" -eq 1 ]; then + log_fail "$dom_name: explicitly selected endpoint $fastrpc_dev not present" + log_dsp_remoteproc_status + echo "$TESTNAME : FAIL" >"$RESULT_FILE" + exit 0 + fi + fi +done -if [ -z "$DOMAINS_TO_TEST" ]; then - log_skip "$TESTNAME SKIP - no supported domains remain after SoC filter ($SOC_MACHINE)" +if [ -z "$available_domains" ]; then + log_skip "$TESTNAME SKIP - no FastRPC endpoint devices found" echo "$TESTNAME : SKIP" >"$RESULT_FILE" exit 0 fi +DOMAINS_TO_TEST="$available_domains" + log_info "Domain mode: $DOMAIN_MODE" log_info "Domains to test: $DOMAINS_TO_TEST" @@ -328,6 +335,15 @@ RESULTS_TRACKER="" for DOMAIN in $DOMAINS_TO_TEST; do dom_name="$(domain_to_name "$DOMAIN")" + + # Check that the FastRPC endpoint device node for this domain exists. + # remoteproc/DT presence does not guarantee the driver has created the node. + fastrpc_dev="/dev/fastrpc-$(printf '%s' "$dom_name" | tr '[:upper:]' '[:lower:]')" + if [ ! -c "$fastrpc_dev" ]; then + log_info "Skipping $dom_name: endpoint $fastrpc_dev not present" + continue + fi + PD_VALUES="$(effective_pds_for_domain "$DOMAIN")" if [ -z "$PD_VALUES" ]; then @@ -433,15 +449,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" diff --git a/Runner/utils/lib_fastrpc.sh b/Runner/utils/lib_fastrpc.sh index dc470019..d27efdad 100755 --- a/Runner/utils/lib_fastrpc.sh +++ b/Runner/utils/lib_fastrpc.sh @@ -87,6 +87,41 @@ 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 shared library (*.so or *.so.*). Avoids accepting +# generic directories that exist without any test artifacts installed. +fastrpc_first_dir_with_testlib() { + candidate_dirs="$1" + for candidate_dir in $candidate_dirs; do + [ -d "$candidate_dir" ] || continue + if find "$candidate_dir" -maxdepth 1 \( -name "*.so" -o -name "*.so.*" \) \ + 2>/dev/null | grep -qm1 .; then + printf '%s\n' "$candidate_dir" + return 0 + fi + done + return 1 +} + fastrpc_detect_multiarch_triplet() { triplet="" @@ -148,8 +183,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="" @@ -262,16 +297,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