Skip to content
Merged
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
20 changes: 10 additions & 10 deletions Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ metadata:
The **fastrpc_test** runner validates FastRPC (Fast Remote Procedure Call) on Qualcomm targets.

**Enhanced Test Coverage**:
- 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
- Uses fastrpc-healthcheck when available to discover online, FastRPC-capable DSP domains
- Derives signed and unsigned Protection Domain support from the live healthcheck report
- Without healthcheck, discovers domains from remoteproc plus FastRPC endpoints and uses a conservative protocol map for PD support
- DOMAIN or DOMAIN_NAME forces single-domain testing; CLI values take precedence over environment values
os:
- linux
scope:
Expand All @@ -18,19 +17,20 @@ metadata:
params:
ARCH: "" # Architecture (only if explicitly provided)
BIN_DIR: "/usr/bin" # Directory containing 'fastrpc_test' (default: /usr/bin)
DOMAIN_MODE: "all-supported" # all-supported|single (default: all-supported - tests all detected domains)
DOMAIN: "" # Optional explicit domain id in single-domain mode
DOMAIN_NAME: "" # Optional explicit domain name in single-domain mode
DOMAIN_MODE: "all-supported" # all-supported|single; single requires DOMAIN or DOMAIN_NAME
DOMAIN: "" # Optional explicit domain id; a non-empty value forces single-domain selection
DOMAIN_NAME: "" # Optional explicit domain name; takes precedence over DOMAIN and forces single-domain selection
PD_MODE: "both" # both|signed-only|unsigned-only (default: both - tests both PDs where supported)
UNSIGNED_PD: "" # If set to non-zero, runs only unsigned PD mode (-U 1)
REPEAT: 1 # Number of repetitions (default: 1)
TIMEOUT: "" # Timeout for each run (no timeout if omitted)
TIMEOUT: 120 # Required positive timeout for each fastrpc_test invocation
HEALTHCHECK_TIMEOUT: 15 # Required positive timeout for fastrpc-healthcheck

run:
steps:
- REPO_PATH=$PWD
- cd Runner/suites/Multimedia/CDSP/fastrpc_test
- UNSIGNED_PD_PARAM=""
- if [ -n "${UNSIGNED_PD}" ] && [ "${UNSIGNED_PD}" != 0 ]; then UNSIGNED_PD_PARAM="--unsigned-pd"; fi
- ./run.sh --arch "${ARCH}" --bin-dir "${BIN_DIR}" --domain-mode "${DOMAIN_MODE}" --domain "${DOMAIN}" --domain-name "${DOMAIN_NAME}" --pd-mode "${PD_MODE}" --repeat "${REPEAT}" --timeout "${TIMEOUT}" $UNSIGNED_PD_PARAM || true
- ./run.sh --arch "${ARCH}" --bin-dir "${BIN_DIR}" --domain-mode "${DOMAIN_MODE}" --domain "${DOMAIN}" --domain-name "${DOMAIN_NAME}" --pd-mode "${PD_MODE}" --repeat "${REPEAT}" --timeout "${TIMEOUT}" --healthcheck-timeout "${HEALTHCHECK_TIMEOUT}" $UNSIGNED_PD_PARAM || true
- $REPO_PATH/Runner/utils/send-to-lava.sh fastrpc_test.res || true
224 changes: 146 additions & 78 deletions Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test_README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,55 @@
# 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, GDSP0, GDSP1).
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.
- Multiple iterations and optional timeouts.
- Precise control over where the binary and assets live via `--bin-dir` and `--assets-dir`.
- Unbuffered output via `stdbuf` or `script` when available (falls back gracefully).
- Uses `fastrpc-healthcheck` when available to discover online DSPs, FastRPC support, signed and
unsigned PD support, firmware information, and DSP library paths. The reported DMA-BUF system
heap state is retained and logged as a diagnostic because the healthcheck documents it as
informational rather than a FastRPC execution gate.
- When healthcheck is unavailable, discovers runnable domains from remoteproc state and FastRPC
character endpoints. The fallback cannot discover PD support directly, so it uses the documented
conservative protocol map. The fallback recognizes both `sdsp` and the public `slpi` remoteproc
identity for the sensor DSP. Host, test, and DSP skeleton libraries remain runtime-discovered.
- Multiple iterations with a required finite timeout.
- Precise control over binary location via `--bin-dir`.
- Line-buffered output through `stdbuf` when available.

## 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 and PD discovery without SoC-name filtering

## 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`.
- Optional `fastrpc-healthcheck`. When installed, this is the primary distro-independent
capability source. An installed healthcheck that fails, times out, or produces an
unrecognized or malformed report fails the suite. Runtime fallback is used only when the tool
is absent.
- 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`
- RPM-based images: `/usr/lib64`, `/usr/lib64/fastrpc_test`, `/usr/share/fastrpc_test`
- A selected DSP skeleton directory must contain the complete calculator, HAP example, and
multithreading skeleton set. Discovered directories are prepended to the semicolon-separated
`DSP_LIBRARY_PATH` used by the public `fastrpc_test` utility while preserving existing DSP
search entries. The same merged value is exported through the domain-specific library paths.
- 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.
- `stdbuf` for line-buffered output. Execution remains bounded without it.
- The suite does not install packages at runtime. Missing optional image assets are reported as
SKIP unless the operator explicitly selected a domain whose required runtime library is absent.

## Directory Structure

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

## Usage
Expand All @@ -49,71 +72,77 @@ 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=GDSP0 6=GDSP1
--domain-name <name> DSP domain: adsp|mdsp|sdsp|slpi|cdsp|cdsp1|gdsp0|gdsp1
--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 (default: 120, must be greater than zero)
--healthcheck-timeout <sec> Timeout for fastrpc-healthcheck (default: 15)
--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 Forces one domain; CLI --domain/--domain-name wins.
FASTRPC_DOMAIN_NAME=adsp|... Forces one 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).
FASTRPC_HEALTHCHECK_BIN Optional path to fastrpc-healthcheck.
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: dynamically discover runnable domains and supported PD modes
./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 GDSP0 with unsigned PD
./run.sh --domain-name gdsp0 --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
```

Domain selection uses `CLI > environment > dynamic discovery` precedence. A non-empty
`FASTRPC_DOMAIN_NAME` or `FASTRPC_DOMAIN` selects one domain even when `--domain-mode` remains at
its `all-supported` default. `--domain-mode single` without a CLI or environment domain is invalid.
An explicitly selected domain fails when it is unavailable, lacks its runtime library, or does not
support the requested PD mode. Automatic selection from the runtime fallback excludes domains
without complete remoteproc and endpoint evidence. When `fastrpc-healthcheck` reports an online,
FastRPC-supported domain, a missing endpoint or required runtime library is treated as a broken
installation and fails the suite.

### LAVA integration example

```
Expand All @@ -125,34 +154,73 @@ 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

- **Capability source**: The startup log reports `capability_source`, `domain_source`, and
`pd_source`, plus the healthcheck system-heap status when available. Whenever healthcheck is
executed, its raw output is retained. A normalized six-column table containing domain, state,
signed-PD support, unsigned-PD support, normalized FastRPC support, and the support reason is
retained only when strict parsing succeeds.
- **Offline automatic domain**: Logged and excluded from automatic selection. Other runnable
domains continue.
- **Unsupported automatic domain**: Logged with the healthcheck reason and excluded. Other
runnable domains continue.
- **Offline explicitly requested domain**: Fails with the healthcheck or remoteproc state.
- **Missing runtime artifacts**: When the capability source is `fastrpc-healthcheck`, a domain
missing its endpoint or required runtime library fails the suite — healthcheck has declared it
supported, so the absence indicates a broken installation. When the capability source is the
runtime fallback, such a domain is logged and excluded while other runnable domains continue.
Missing shared test libraries or DSP skeletons skip the suite before execution.
- **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`)
- **Kernel evidence on failure**: one shared `logs_fastrpc_test_<timestamp>/kernel/` snapshot is
captured through `scan_dmesg_errors` after the invocation matrix.
- **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 and PD support are derived from `fastrpc-healthcheck` when available. The fallback is
selected only when the tool is absent and uses runtime remoteproc and endpoint evidence, with
a conservative protocol mapping for PD support.
- The existing `/usr/lib/dsp` compatibility links are prepared before healthcheck captures its
capability report, so the report and the subsequent functional run observe the same layout.
- This suite runs the public `fastrpc_test` character-device path and therefore requires either
`/dev/fastrpc-<domain>` or `/dev/fastrpc-<domain>-secure` for every selected domain.
- DSP skeleton directories are discovered dynamically by locating `.so` artifacts instead of
assuming fixed ABI directory names such as `v68` or `v75`.
- Override library discovery with `FASTRPC_LIB_SYS_DIR`, `FASTRPC_LIB_TEST_DIR`, or
`FASTRPC_SKEL_BASE`. CLI domain selection takes precedence over environment selection, which
takes precedence over runtime discovery.
- 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.
Loading
Loading