Skip to content

Commit f6e0d55

Browse files
authored
Merge pull request qualcomm-linux#142 from smuppand/fastrpc-test
Multimedia/CDSP: Enhance fastrpc_test automation with CI-ready logging, argument parsing, and arch detection
2 parents 40a2abd + 5e99213 commit f6e0d55

File tree

3 files changed

+354
-116
lines changed

3 files changed

+354
-116
lines changed

Runner/suites/Multimedia/CDSP/fastrpc_test/README_CDSP.md

Lines changed: 0 additions & 81 deletions
This file was deleted.
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# FastRPC Test Script for Qualcomm Linux-based Platforms (Yocto)
2+
3+
## Overview
4+
5+
The **fastrpc_test** runner validates FastRPC (Fast Remote Procedure Call) on Qualcomm targets, offloading work to DSP domains (e.g., **CDSP**).
6+
It wraps the public [fastrpc test application](https://github.com/quic/fastrpc) with **robust logging, parameter control, and CI-friendly output**.
7+
8+
Supported capabilities:
9+
- Auto-detect architecture from SoC ID.
10+
- Multiple iterations and optional timeouts.
11+
- Precise control over where the binary and assets live via `--bin-dir` and `--assets-dir`.
12+
- Unbuffered output via `stdbuf` or `script` when available (falls back gracefully).
13+
14+
## Features
15+
16+
- **Calculator**, **HAP**, and **Multithreading** examples (as provided by `fastrpc_test`)
17+
- CI-ready logs with timestamps and per-iteration results
18+
- Parameterized control (`--arch`, `--repeat`, `--timeout`, `--bin-dir`, `--assets-dir`, `--verbose`)
19+
- Auto-detection fallback for binary and assets
20+
- Silent directory scan (no noisy `ls` dumps)
21+
22+
## Prerequisites
23+
24+
Have these on the target (or specify paths with the flags below):
25+
26+
- `fastrpc_test` binary (from [github.com/quic/fastrpc](https://github.com/quic/fastrpc))
27+
- A **parent directory** that contains a `linux/` subfolder with the required libraries (often alongside the binary), and architecture folders such as `v68`, `v73`, `v75`.
28+
- Optional but recommended:
29+
- `stdbuf` **or** `script` (for unbuffered stdout/stderr)
30+
- `timeout` (GNU coreutils) for wall-clock limiting; the script provides a portable fallback if missing.
31+
32+
## Directory Structure
33+
34+
```bash
35+
Runner/
36+
├── suites/
37+
│ ├── Multimedia/
38+
│ │ ├── CDSP/
39+
│ │ │ ├── fastrpc_test/
40+
│ │ │ │ ├── run.sh
41+
│ │ │ │ ├── fastrpc_test_README.md
42+
```
43+
44+
## Usage
45+
46+
### Script arguments
47+
48+
```
49+
Usage: run.sh [OPTIONS]
50+
51+
Options:
52+
--arch <name> Architecture (auto-detected from SoC if omitted)
53+
--bin-dir <path> Directory that contains the 'fastrpc_test' binary
54+
--assets-dir <path> Directory that CONTAINS 'linux/' (libs/assets parent)
55+
--repeat <N> Number of iterations (default: 1)
56+
--timeout <sec> Timeout per run (no timeout if omitted)
57+
--verbose Extra logging for CI debugging
58+
--help Show this help
59+
60+
Binary & assets resolution (in order):
61+
Binary: 1) --bin-dir 2) $PATH (command -v fastrpc_test)
62+
Assets: 1) --assets-dir
63+
2) <bin-dir> (if provided)
64+
3) directory of resolved binary
65+
4) directory of this run.sh
66+
5) common locations: /usr/share/bin, /usr/share/fastrpc, /opt/fastrpc
67+
The test executes FROM the assets directory so 'fastrpc_test' can find deps.
68+
```
69+
70+
### Quick start
71+
72+
```bash
73+
# If fastrpc_test is already in PATH and assets are discoverable:
74+
./run.sh --repeat 3 --timeout 60
75+
```
76+
77+
### Common scenarios
78+
79+
```bash
80+
# 1) Binary in a custom folder; assets are alongside it (i.e., that folder has linux/)
81+
./run.sh --bin-dir /opt/qcom/fastrpc --repeat 5
82+
83+
# 2) Binary in PATH; assets somewhere else
84+
./run.sh --assets-dir /opt/qcom/fastrpc_assets --timeout 45
85+
86+
# 3) Both explicitly provided (most deterministic)
87+
./run.sh --bin-dir /opt/qcom/fastrpc/bin --assets-dir /opt/qcom/fastrpc --arch v75 --repeat 10 --timeout 30 --verbose
88+
89+
# 4) Force architecture (skip SoC autodetect)
90+
./run.sh --arch v68
91+
```
92+
93+
### Sample output (trimmed)
94+
95+
```
96+
[INFO] 2025-08-13 09:12:01 - -------------------Starting fastrpc_test Testcase----------------------------
97+
[INFO] 2025-08-13 09:12:01 - Buffering: stdbuf -oL -eL | Timeout: 60 sec | Arch: v68
98+
[INFO] 2025-08-13 09:12:01 - Resolved binary: /usr/bin/fastrpc_test
99+
[INFO] 2025-08-13 09:12:01 - Assets dir: /usr/bin (linux/ expected here)
100+
[INFO] 2025-08-13 09:12:01 - Running iter1/3 | start: 2025-08-13T09:12:01Z | cmd: fastrpc_test -d 3 -U 1 -t linux -a v68
101+
... fastrpc_test output ...
102+
[PASS] 2025-08-13 09:12:05 - iter1: pattern matched
103+
[INFO] 2025-08-13 09:12:05 - Running iter2/3 | start: ...
104+
...
105+
[FAIL] 2025-08-13 09:12:15 - fastrpc_test : Test Failed (2/3) | logs: ./logs_fastrpc_test_20250813-091201
106+
```
107+
108+
## CI debugging aids
109+
110+
- Per-iteration logs: `logs_fastrpc_test_<timestamp>/iterN.out` (+ `iterN.rc`)
111+
- Summary result file: `fastrpc_test.res` (`PASS` / `FAIL`)
112+
- Verbose mode: adds environment, resolutions, and timing details
113+
- Graceful fallbacks when `stdbuf`, `script`, or `timeout` are missing
114+
- Silent scan (no directory spam) during auto-detection
115+
116+
## Notes
117+
118+
- If `--arch` is omitted, the script maps `/sys/devices/soc0/soc_id` to a known arch (defaulting to `v68` when unknown).
119+
- If `fastrpc_test` isn’t in `PATH`, use `--bin-dir` or add it to `PATH`.
120+
- 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.
121+
- 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.
122+
123+
## License
124+
125+
SPDX-License-Identifier: BSD-3-Clause-Clear
126+
Copyright (c) Qualcomm Technologies, Inc.

0 commit comments

Comments
 (0)