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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
169 changes: 94 additions & 75 deletions Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test_README.md
Original file line number Diff line number Diff line change
@@ -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/<multiarch>`, `/usr/lib/<multiarch>/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

Expand All @@ -38,7 +45,8 @@ Runner/
│ │ ├── CDSP/
│ │ │ ├── fastrpc_test/
│ │ │ │ ├── run.sh
│ │ │ │ ├── fastrpc_test_README.md
│ │ │ │ ├── fastrpc_test_README.md
│ │ │ │ ├── fastrpc_test.yaml
```

## Usage
Expand All @@ -49,69 +57,64 @@ Runner/
Usage: run.sh [OPTIONS]

Options:
--arch <name> Architecture (only if explicitly provided)
--bin-dir <path> Directory containing 'fastrpc_test' (default: /usr/bin)
--assets-dir <path> 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 <N> Number of repetitions (default: 1)
--timeout <sec> Timeout for each run (no timeout if omitted)
--verbose Extra logging for CI debugging
--help Show this help
--arch <name> Architecture (only if explicitly provided)
--bin-dir <path> 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 <name> DSP domain by name: adsp|mdsp|sdsp|cdsp|cdsp1|gpdsp0|gpdsp1
--domain-mode <all-supported|single> Discover all domains or run only one (default: all-supported)
--pd-mode <both|signed-only|unsigned-only> Select PD mode(s) to run (default: both)
--unsigned-pd Use '-U 1' (user/unsigned PD). Overrides --pd-mode.
--repeat <N> Number of repetitions (default: 1)
--timeout <sec> 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
Expand All @@ -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_<timestamp>/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_<timestamp>/<domain>_<pd>_iter<N>.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.
49 changes: 0 additions & 49 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 @@ -237,49 +236,6 @@ if [ -z "$DOMAINS_TO_TEST" ]; then
exit 0
fi

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.

After removing the SoC filters, every domain returned from remoteproc or DT discovery is scheduled immediately.

Remoteproc presence does not prove that a usable FastRPC endpoint exists, so a target with DSP firmware but no /dev/fastrpc-* interface now reaches fastrpc_test and fails without an actionable capability diagnosis. Before accepting DOMAINS_TO_TEST, validate the domain’s running state, secure or non-secure endpoint, required runtime library, and skeleton assets.

# -------------------- 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
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

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
fi

log_info "Domain mode: $DOMAIN_MODE"
log_info "Domains to test: $DOMAINS_TO_TEST"

Expand Down Expand Up @@ -433,15 +389,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
10 changes: 0 additions & 10 deletions Runner/utils/lib_fastrpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading