diff --git a/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test.yaml b/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test.yaml index 0cae5cf9..3d45f99b 100644 --- a/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test.yaml +++ b/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test.yaml @@ -8,7 +8,6 @@ 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) - 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/fastrpc_test_README.md b/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test_README.md index 85f22b00..7bf378f9 100644 --- a/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test_README.md +++ b/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test_README.md @@ -1,33 +1,40 @@ -# FastRPC Test Script for Qualcomm Linux-based Platforms (Yocto) +# FastRPC Test Script for Qualcomm Linux-based Platforms ## Overview -The **fastrpc_test** runner validates FastRPC (Fast Remote Procedure Call) on Qualcomm targets, offloading work to DSP domains (e.g., **CDSP**). -It wraps the public [fastrpc test application](https://github.com/quic/fastrpc) with **robust logging, parameter control, and CI-friendly output**. +The **fastrpc_test** runner validates FastRPC (Fast Remote Procedure Call) on Qualcomm targets, +offloading work to all supported DSP domains (ADSP, MDSP, SDSP, CDSP, CDSP1, GPDSP0, GPDSP1). +It wraps the public [fastrpc test application](https://github.com/quic/fastrpc) with **robust +logging, parameter control, and CI-friendly output**. Supported capabilities: -- Auto-detect architecture from SoC ID. +- Runtime discovery of all active DSP domains via remoteproc/DT (no SoC-name filtering). +- Tests both signed (system) and unsigned (user) Protection Domains where hardware supports them. +- ADSP/MDSP/SDSP: signed PD only; CDSP/CDSP1/GPDSP0/GPDSP1: both signed and unsigned PDs. - Multiple iterations and optional timeouts. -- Precise control over where the binary and assets live via `--bin-dir` and `--assets-dir`. +- Precise control over binary location via `--bin-dir`. - Unbuffered output via `stdbuf` or `script` when available (falls back gracefully). ## Features - **Calculator**, **HAP**, and **Multithreading** examples (as provided by `fastrpc_test`) -- CI-ready logs with timestamps and per-iteration results -- Parameterized control (`--arch`, `--repeat`, `--timeout`, `--bin-dir`, `--assets-dir`, `--verbose`) -- Auto-detection fallback for binary and assets -- Silent directory scan (no noisy `ls` dumps) +- CI-ready logs with timestamps and per-iteration, per-domain/PD results +- Parameterized control (`--arch`, `--repeat`, `--timeout`, `--bin-dir`, `--domain-mode`, + `--domain`, `--domain-name`, `--pd-mode`, `--unsigned-pd`, `--verbose`) +- Auto-discovery of system libraries and DSP skeletons for both Yocto and Debian layouts +- Runtime domain discovery; skips only when hardware is genuinely absent ## Prerequisites Have these on the target (or specify paths with the flags below): - `fastrpc_test` binary (from [github.com/quic/fastrpc](https://github.com/quic/fastrpc)) -- A **parent directory** that contains a `linux/` subfolder with the required libraries (often alongside the binary), and architecture folders such as `v68`, `v73`, `v75`. +- FastRPC system libraries and DSP skeletons auto-discovered from standard locations: + - Yocto: `/usr/local/lib`, `/usr/local/lib/fastrpc_test`, `/usr/local/share/fastrpc_test` + - Debian: `/usr/lib/`, `/usr/lib//fastrpc_test`, `/usr/share/fastrpc_test` - Optional but recommended: - `stdbuf` **or** `script` (for unbuffered stdout/stderr) - - `timeout` (GNU coreutils) for wall-clock limiting; the script provides a portable fallback if missing. + - `timeout` (GNU coreutils) for wall-clock limiting; the script provides a portable fallback. ## Directory Structure @@ -38,7 +45,8 @@ Runner/ │ │ ├── CDSP/ │ │ │ ├── fastrpc_test/ │ │ │ │ ├── run.sh -│ │ │ │ ├── fastrpc_test_README.md +│ │ │ │ ├── fastrpc_test_README.md +│ │ │ │ ├── fastrpc_test.yaml ``` ## Usage @@ -49,69 +57,64 @@ Runner/ Usage: run.sh [OPTIONS] Options: - --arch Architecture (only if explicitly provided) - --bin-dir Directory containing 'fastrpc_test' (default: /usr/bin) - --assets-dir Directory that CONTAINS 'linux/' (info only; we run from the binary dir) - --user-pd Use '-U 1' (user/unsigned PD). Default is '-U 0'. - --repeat Number of repetitions (default: 1) - --timeout Timeout for each run (no timeout if omitted) - --verbose Extra logging for CI debugging - --help Show this help + --arch Architecture (only if explicitly provided) + --bin-dir Directory containing 'fastrpc_test' (default: /usr/bin) + --domain <0|1|2|3|4|5|6> DSP domain: 0=ADSP 1=MDSP 2=SDSP 3=CDSP 4=CDSP1 5=GPDSP0 6=GPDSP1 + --domain-name DSP domain by name: adsp|mdsp|sdsp|cdsp|cdsp1|gpdsp0|gpdsp1 + --domain-mode Discover all domains or run only one (default: all-supported) + --pd-mode Select PD mode(s) to run (default: both) + --unsigned-pd Use '-U 1' (user/unsigned PD). Overrides --pd-mode. + --repeat Number of repetitions (default: 1) + --timeout Timeout for each run (no timeout if omitted) + --verbose Extra logging for CI debugging + --help Show this help Env: - FASTRPC_USER_PD=0|1 Sets PD (-U value). CLI --user-pd overrides to 1. - FASTRPC_EXTRA_FLAGS Extra flags appended to the command. - ALLOW_BIN_FASTRPC=1 Permit using /bin/fastrpc_test (otherwise refused). - -The test executes FROM the assets directory so 'fastrpc_test' can find deps. + FASTRPC_DOMAIN=0|1|2|3|4|5|6 Sets domain; CLI --domain/--domain-name wins. + FASTRPC_DOMAIN_NAME=adsp|... Named domain; CLI wins. + FASTRPC_UNSIGNED_PD=0|1 Sets PD (-U value). CLI --unsigned-pd overrides to 1. + FASTRPC_EXTRA_FLAGS Extra flags appended (space-separated). + ALLOW_BIN_FASTRPC=1 Permit using /bin/fastrpc_test when --bin-dir=/bin. ``` ### Quick start ```bash -# If fastrpc_test is already in PATH and assets are discoverable: +# Default: discover all supported domains and run both signed+unsigned PDs +./run.sh + +# With repeat and timeout: ./run.sh --repeat 3 --timeout 60 ``` ### Common scenarios ```bash -# Default expects /usr/bin/fastrpc_test and /usr/bin/linux -./run.sh +# 1) Use a custom binary directory +./run.sh --bin-dir /tmp/stage/usr/bin -Common scenarios +# 2) Run only unsigned (user) PD across all domains +./run.sh --pd-mode unsigned-only -# 1) Use a custom binary directory (we will cd there and run ./fastrpc_test) -./run.sh --bin-dir /tmp/stage/usr/bin +# 3) Run only signed PD +./run.sh --pd-mode signed-only -# 2) Opt into user/unsigned PD (-U 1) -./run.sh --user-pd -# or via env -FASTRPC_USER_PD=1 ./run.sh +# 4) Force a specific domain (CDSP) +./run.sh --domain 3 +# or by name: +./run.sh --domain-name cdsp -# 3) Add extra flags (kept intact; -U is appended last as '-U 0/1') -FASTRPC_EXTRA_FLAGS="-d 3" ./run.sh +# 5) Force GPDSP0 with unsigned PD +./run.sh --domain-name gpdsp0 --pd-mode unsigned-only -# 4) Allow /bin explicitly (generally discouraged unless required) -ALLOW_BIN_FASTRPC=1 ./run.sh --bin-dir /bin +# 6) Run SDSP via environment variable with unsigned PD +FASTRPC_DOMAIN=2 FASTRPC_UNSIGNED_PD=1 ./run.sh -# 5) Run multiple iterations with a timeout and verbose logs +# 7) Run multiple iterations with verbose logs ./run.sh --repeat 3 --timeout 120 --verbose -Force CDSP explicitly: - -# 6) ./run.sh --domain 3 -# or -# 6) ./run.sh --domain-name cdsp - -Use ADSP and user PD: - -# 7) ./run.sh --domain-name adsp --user-pd - -From env (CI): - -FASTRPC_DOMAIN=2 FASTRPC_USER_PD=1 ./run.sh -# => SDSP with -U 1 +# 8) Allow /bin explicitly (generally discouraged) +ALLOW_BIN_FASTRPC=1 ./run.sh --bin-dir /bin ``` ### LAVA integration example @@ -125,34 +128,50 @@ FASTRPC_DOMAIN=2 FASTRPC_USER_PD=1 ./run.sh ``` [INFO] 2025-09-02 10:44:46 - -------------------Starting fastrpc_test Testcase---------------------------- -[INFO] 2025-09-02 10:44:46 - Using binary: /usr/bin/fastrpc_test -[INFO] 2025-09-02 10:44:46 - PD setting: -U 0 (use --user-pd to set -U 1) -[INFO] 2025-09-02 10:44:46 - Run dir: /usr/bin (launching ./fastrpc_test) -[INFO] 2025-09-02 10:44:46 - Executing: ./fastrpc_test -d 3 -t linux -U 0 ------ iter1 output begin ----- +[INFO] 2025-09-02 10:44:46 - Domain mode: all-supported +[INFO] 2025-09-02 10:44:46 - Domains to test: 0 3 +[INFO] 2025-09-02 10:44:46 - PD mode: both +[INFO] 2025-09-02 10:44:46 - Running ADSP_signed_iter1 | domain=ADSP | pd=signed +[INFO] 2025-09-02 10:44:46 - Executing: ./fastrpc_test -d 0 -t linux -U 0 +----- ADSP_signed_iter1 output begin ----- ... fastrpc_test output ... ------ iter1 output end ----- -[PASS] 2025-09-02 10:44:50 - iter1: success -[PASS] 2025-09-02 10:44:50 - fastrpc_test : Test Passed (1/1) +----- ADSP_signed_iter1 output end ----- +[PASS] 2025-09-02 10:44:50 - ADSP_signed_iter1: success +... +[INFO] ================================================================================ +[INFO] FastRPC Test Summary +[INFO] ================================================================================ +[INFO] Domain | PD Mode | Total | Pass | Fail | Skip | Status +[INFO] -------------------------------------------------------------------------------- +[INFO] ADSP | Signed | 5 | 5 | 0 | 0 | PASS +[INFO] CDSP | Signed | 5 | 5 | 0 | 0 | PASS +[INFO] CDSP | Unsigned | 5 | 5 | 0 | 0 | PASS +[PASS] 2025-09-02 10:44:50 - fastrpc_test : Test Passed (3/3) ``` ## CI debugging aids -- Binary resolved to /bin/fastrpc_test: By default this is blocked to avoid loader/ramdisk mismatches. Set ALLOW_BIN_FASTRPC=1 and/or --bin-dir /bin if you intentionally need it. -- Error resolving path .../linux: Ensure linux/ is next to the binary (e.g., /usr/bin/linux). The script runs from the binary dir specifically to make this work. -- Session create errors with -U 1: If you opt into user/unsigned PD and see 0x80000416, confirm your image includes unsigned shells/policies (or revert to the default -U 0). -- Per-iteration logs: `logs_fastrpc_test_/iterN.out` (+ `iterN.rc`) -- Summary result file: `fastrpc_test.res` (`PASS` / `FAIL`) -- Verbose mode: adds environment, resolutions, and timing details -- Graceful fallbacks when `stdbuf`, `script`, or `timeout` are missing -- Silent scan (no directory spam) during auto-detection + +- **Binary resolved to /bin/fastrpc_test**: Blocked by default. Set `ALLOW_BIN_FASTRPC=1` or + use `--bin-dir` to a non-`/bin` path. +- **Session create errors with -U 1**: If unsigned PD returns `0x80000416`, confirm your image + includes unsigned shells/policies (or use `--pd-mode signed-only`). +- **Domain not discovered**: Check `dmesg` for remoteproc firmware load errors. The test + requires the DSP remoteproc to be registered and its firmware present in DT. +- **Per-iteration logs**: `logs_fastrpc_test_/__iter.out` (+ `.rc`, `.env`, `.cmd`) +- **Summary result file**: `fastrpc_test.res` (`PASS` / `FAIL` / `SKIP`) +- **Verbose mode**: adds environment, library resolution, and timing details ## Notes -- If `--arch` is omitted, the script maps `/sys/devices/soc0/soc_id` to a known arch (defaulting to `v68` when unknown). -- If `fastrpc_test` isn’t in `PATH`, use `--bin-dir` or add it to `PATH`. -- If you see `Error resolving path .../linux: No such file or directory`, point `--assets-dir` to the **parent** directory that actually contains a `linux/` subfolder. -- The script changes working directory to the resolved **assets** dir before invoking `fastrpc_test`, which is required for the binary to locate its shared libs/skeletons. +- Domain discovery is runtime-based via remoteproc/DT entries — no SoC name filtering. + If a domain is not available on the hardware, it is simply not discovered and not tested. +- ADSP/MDSP/SDSP support signed PD only (`-U 0`). Requesting unsigned PD for these domains + is silently skipped. +- Libraries and DSP skeletons (`v68`, `v75`) are auto-discovered from standard Yocto and Debian + paths. Override with `FASTRPC_LIB_SYS_DIR`, `FASTRPC_LIB_TEST_DIR`, or `FASTRPC_SKEL_BASE`. +- If `fastrpc_test` is not in the default path, use `--bin-dir` to specify its location. ## License -SPDX-License-Identifier: BSD-3-ClauseCopyright (c) Qualcomm Technologies, Inc. +SPDX-License-Identifier: BSD-3-Clause +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. diff --git a/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh b/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh index d3978995..ea02d30e 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 @@ -228,58 +227,44 @@ ensure_usr_lib_dsp_symlinks log_dsp_remoteproc_status # -------------------- Domain and PD selection ------------------- -# Resolve domains and PDs to test -DOMAINS_TO_TEST="$(resolve_domains_to_test)" - -if [ -z "$DOMAINS_TO_TEST" ]; then - log_skip "$TESTNAME SKIP - no mapped/supported domains detected" - echo "$TESTNAME : SKIP" >"$RESULT_FILE" - exit 0 -fi +# Temp file lets discover_supported_domains() signal non-running domains +# across the subshell boundary created by $(). +FASTRPC_FAIL_FILE="$(mktemp 2>/dev/null || printf '/tmp/.fastrpc_discover_fail_%s' "$$")" +export FASTRPC_FAIL_FILE -# -------------------- 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 +DOMAINS_TO_TEST="$(resolve_domains_to_test)" -if [ "$soc_skip_all" -eq 1 ]; then - log_skip "$TESTNAME SKIP - SoC $SOC_MACHINE does not support FastRPC" - echo "$TESTNAME : SKIP" >"$RESULT_FILE" +# Domains with a remoteproc entry but not in running state — explicit FAIL. +# Checked before the empty-domains guard so all-non-running also FAILs. +if [ -s "$FASTRPC_FAIL_FILE" ]; then + while IFS= read -r fd; do + log_fail "$TESTNAME FAIL - $(domain_to_name "$fd"): remoteproc not in running state" + done <<__FAIL__ +$(sort -u "$FASTRPC_FAIL_FILE" 2>/dev/null) +__FAIL__ + rm -f "$FASTRPC_FAIL_FILE" + echo "$TESTNAME : FAIL" >"$RESULT_FILE" exit 0 fi - -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 +rm -f "$FASTRPC_FAIL_FILE" if [ -z "$DOMAINS_TO_TEST" ]; then - log_skip "$TESTNAME SKIP - no supported domains remain after SoC filter ($SOC_MACHINE)" + log_skip "$TESTNAME SKIP - no mapped/supported domains detected" echo "$TESTNAME : SKIP" >"$RESULT_FILE" exit 0 fi +# A running remoteproc without a FastRPC endpoint is a misconfigured system. +# Validate every domain before handing it to fastrpc_test. +for d in $DOMAINS_TO_TEST; do + if ! fastrpc_domain_endpoint_available "$d"; then + label="$(domain_to_endpoint_label "$d")" + log_fail "$TESTNAME FAIL - $(domain_to_name "$d"): /dev/fastrpc-${label}[-secure] not found" + echo "$TESTNAME : FAIL" >"$RESULT_FILE" + exit 0 + fi +done + log_info "Domain mode: $DOMAIN_MODE" log_info "Domains to test: $DOMAINS_TO_TEST" @@ -433,15 +418,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" @@ -478,8 +458,8 @@ overall_subtests_pass=0 overall_subtests_fail=0 overall_subtests_skip=0 -# shellcheck disable=SC2034 # _pass_cnt/_fail_cnt consumed from tracker but not used in display -while IFS=: read -r domain pd_val _pass_cnt _fail_cnt combo_total_tests combo_pass_tests combo_fail_tests combo_skip_tests; do +# shellcheck disable=SC2034 # pass_cnt/fail_cnt consumed from tracker but not used in display +while IFS=: read -r domain pd_val pass_cnt fail_cnt combo_total_tests combo_pass_tests combo_fail_tests combo_skip_tests; do [ -z "$domain" ] && continue dom_name="$(domain_to_name "$domain")" diff --git a/Runner/utils/lib_fastrpc.sh b/Runner/utils/lib_fastrpc.sh index dc470019..18159baa 100755 --- a/Runner/utils/lib_fastrpc.sh +++ b/Runner/utils/lib_fastrpc.sh @@ -262,16 +262,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 @@ -323,6 +313,19 @@ domain_to_name() { esac } +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 +} + append_unique() { current="$1" new="$2" @@ -370,8 +373,14 @@ discover_supported_domains() { d="$(name_to_domain "$canon")" if [ -n "$d" ]; then - printf '%s\n' "$d" - log_debug "discover: fw=$fw rname=$rname rfirm=$rfirm canon=$canon domain=$d state=$rstate" + if [ "$rstate" != "running" ]; then + log_warn "$(domain_to_name "$d"): remoteproc state=$rstate" >&2 + [ -n "${FASTRPC_FAIL_FILE:-}" ] && \ + printf '%s\n' "$d" >> "$FASTRPC_FAIL_FILE" + else + printf '%s\n' "$d" + log_debug "discover: fw=$fw rname=$rname rfirm=$rfirm canon=$canon domain=$d state=$rstate" + fi else log_debug "discover: fw=$fw rname=$rname rfirm=$rfirm canon=$canon domain=" fi @@ -383,8 +392,13 @@ EOF d="$(name_to_domain "$canon")" if [ -n "$d" ]; then - printf '%s\n' "$d" - log_debug "discover: fw=$fw dt-only canon=$canon domain=$d" + if ! fastrpc_domain_endpoint_available "$d"; then + label="$(domain_to_endpoint_label "$d")" + log_warn "$(domain_to_name "$d"): skipped (/dev/fastrpc-${label}[-secure] absent)" >&2 + else + printf '%s\n' "$d" + log_debug "discover: fw=$fw dt-only canon=$canon domain=$d" + fi fi else log_debug "discover: fw=$fw not present" @@ -477,3 +491,9 @@ effective_pds_for_domain() { printf "%s" "$effective" } + +fastrpc_domain_endpoint_available() { + label="$(domain_to_endpoint_label "$1")" + [ -n "$label" ] || return 1 + [ -c "/dev/fastrpc-${label}" ] || [ -c "/dev/fastrpc-${label}-secure" ] +}