Skip to content

Commit 91d881b

Browse files
authored
Merge pull request #292 from smuppand/sensors
Sensors: add DT-free dynamic runner, helpers, LAVA YAML, and overlay-only docs
2 parents beec22a + 0769c32 commit 91d881b

4 files changed

Lines changed: 820 additions & 0 deletions

File tree

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
# Sensors (Dynamic, DT-free)
2+
3+
This test validates Qualcomm SSC/ADSP sensor streaming **without relying on Device Tree**. It dynamically discovers available sensor **TYPEs** using `ssc_sensor_info` and validates selected sensors using:
4+
5+
- `see_workhorse` (streaming sanity / event flow)
6+
- `ssc_drva_test` (driver validation test; optional on minimal builds)
7+
8+
> **Important (Overlay-only):**
9+
> The required user-space apps (`ssc_sensor_info`, `see_workhorse`, `ssc_drva_test`) are **not** part of the base image in many builds.
10+
> They are typically provided via a **proprietary / vendor overlay** (or equivalent overlay package).
11+
> This testcase is **meant to be executed only when those overlay apps are present**.
12+
13+
---
14+
15+
## Location
16+
17+
- `Runner/suites/Multimedia/Sensors/run.sh`
18+
- Helper library: `Runner/utils/lib_sensors.sh` (sourced via `$TOOLS/lib_sensors.sh`)
19+
20+
---
21+
22+
## What it does
23+
24+
1. **Gates on ADSP remoteproc**
25+
- Confirms ADSP remoteproc is present and **running**
26+
- If not running, checks whether firmware (default `adsp.mbn`) exists
27+
- Uses helper functions already in `functestlib.sh`:
28+
- `get_remoteproc_path_by_firmware()`
29+
- `get_remoteproc_state()`
30+
31+
2. **Discovers sensors dynamically**
32+
- Runs `ssc_sensor_info` once and saves full output to:
33+
- `./logs_Sensors/ssc_sensor_info.txt` (or custom `--out`)
34+
- Parses **TYPE** entries where `AVAILABLE=true` (and prefers physical sensors where possible)
35+
36+
3. **Auto-selects sensor set**
37+
- Default: `--profile auto`
38+
- If `mag` or `pressure` is present → **Vision-like** profile: `accel,gyro,mag,pressure`
39+
- Else → **Core-like** profile: `accel,gyro`
40+
41+
4. **Runs functional validation**
42+
- For each selected sensor TYPE:
43+
- runs `see_workhorse -sensor=<type> ...`
44+
- runs `ssc_drva_test -sensor=<type> ...` (if tool exists; otherwise SKIP that part)
45+
- Redirects huge tool output to per-sensor log files.
46+
- Prints **small progress heartbeats** to stdout for CI visibility.
47+
48+
5. **Writes a LAVA-friendly result file**
49+
- Always exits `0` (LAVA-friendly)
50+
- Writes `Sensors.res` with `PASS` / `FAIL` / `SKIP`
51+
52+
---
53+
54+
## Prerequisites
55+
56+
### Required commands (overlay apps)
57+
- `ssc_sensor_info`
58+
- `see_workhorse`
59+
60+
### Optional command
61+
- `ssc_drva_test`
62+
If missing, test still runs using `see_workhorse` and treats `ssc_drva_test` as **SKIP**.
63+
64+
### Common shell utilities
65+
- `awk`, `sed`, `grep`, `sort`, `wc`, `tr`
66+
67+
### Files / directories
68+
- `/etc/sensors/config` **must exist**
69+
If missing, the script will **SKIP** (typically indicates a non-prop / non-overlay build).
70+
71+
---
72+
73+
## Usage
74+
75+
### Show help
76+
```sh
77+
./run.sh --help
78+
```
79+
80+
### List discovered sensor TYPEs and exit
81+
```sh
82+
./run.sh --list
83+
```
84+
85+
### Run with auto-detection (default)
86+
```sh
87+
./run.sh
88+
```
89+
90+
### Run a profile preset
91+
```sh
92+
./run.sh --profile basic
93+
./run.sh --profile vision
94+
./run.sh --profile core
95+
./run.sh --profile all --strict 0 # debug / long run
96+
```
97+
98+
Profiles:
99+
- `basic` / `core`: `accel,gyro`
100+
- `vision`: `accel,gyro,mag,pressure`
101+
- `all`: all discovered types (debug)
102+
- `auto` (default): picks core/vision based on presence of `mag`/`pressure`
103+
104+
### Run an explicit list of sensors
105+
```sh
106+
./run.sh --sensors accel,gyro,tilt --strict 0
107+
```
108+
109+
### Control durations / progress heartbeat
110+
```sh
111+
./run.sh --see-duration 5 --drva-duration 10 --hb 5
112+
```
113+
114+
### Output directory
115+
```sh
116+
./run.sh --out ./logs_Sensors
117+
```
118+
119+
---
120+
121+
## Parameters
122+
123+
### CLI options (most common)
124+
- `--list`
125+
List discovered sensor TYPEs and exit 0
126+
- `--profile <auto|basic|core|vision|all>`
127+
Select preset sensors list
128+
- `--sensors <csv>`
129+
Comma-separated list of sensor TYPEs to test
130+
- `--see-duration <sec>`
131+
Duration for `see_workhorse` (default: `5`)
132+
- `--drva-duration <sec>`
133+
Duration for `ssc_drva_test` (default: `10`)
134+
- `--hb <sec>`
135+
Heartbeat interval printed to stdout (default: `5`)
136+
- `--strict <0|1>`
137+
Require `accel` and `gyro` to exist (default: `1`)
138+
139+
### Environment overrides
140+
- `OUT_DIR` (same as `--out`)
141+
- `SEE_DURATION`
142+
- `DRVA_DURATION`
143+
- `HB_SECS`
144+
- `STRICT_REQUIRED`
145+
- `SENSORS_TIMEOUT_PAD_SECS`
146+
Extra timeout pad added beyond duration (default is handled in lib; keep small for CI)
147+
- `SENSORS_DISPLAY_EVENTS`
148+
Passed to `see_workhorse -display_events=` (default: `1`)
149+
- `SENSORS_DRVA_NUM_SAMPLES`
150+
Extra knob for accel in `ssc_drva_test` (default set in run.sh to `325`)
151+
152+
---
153+
154+
## Output / logs
155+
156+
All heavy tool output is redirected to files under `--out` (default `./logs_Sensors`):
157+
158+
- `ssc_sensor_info.txt`
159+
- `see_workhorse_<sensor>.log` (e.g. `see_workhorse_gyro.log`)
160+
- `ssc_drva_test_<sensor>.log` (e.g. `ssc_drva_test_accel.log`)
161+
162+
The console shows:
163+
- high-level progress
164+
- periodic heartbeat lines like:
165+
- `see_workhorse(accel) running... 5/5s (log: ...)`
166+
- final summary:
167+
- `Summary: pass=X fail=Y skip=Z (logs in ...)`
168+
169+
Result file:
170+
- `Sensors.res` in the testcase directory
171+
- `Sensors PASS`
172+
- `Sensors FAIL`
173+
- `Sensors SKIP`
174+
175+
---
176+
177+
## Result parsing behavior
178+
179+
### `see_workhorse`
180+
The script determines PASS/FAIL primarily from log markers:
181+
- `PASS see_workhorse ...`
182+
- `FAIL see_workhorse ...`
183+
184+
The log may contain duplicate PASS lines; verdict is based on the **last PASS/FAIL marker**.
185+
186+
### `ssc_drva_test`
187+
- If `ssc_drva_test` binary is missing → treated as **SKIP** for that sensor.
188+
- If the log begins with `FAIL` → treated as **FAIL** (defensive).
189+
- Otherwise, return code `0` → PASS.
190+
191+
---
192+
193+
## Troubleshooting
194+
195+
### `1970-01-01` timestamps
196+
If system time is not set (no RTC sync), logs may show epoch timestamps. This does not affect functional PASS/FAIL.
197+
198+
### `diag: failed to connect to diag socket`
199+
Some builds print diagnostic socket warnings in `see_workhorse` output.
200+
This is captured in the log file. The test still passes as long as the final PASS marker is present.
201+
202+
### `ssc_sensor_info` outputs nothing / parsing fails
203+
This is treated as **SKIP** (no usable inventory → no further tests).
204+
205+
Check:
206+
- overlay apps installed and runnable
207+
- `/etc/sensors/config` exists
208+
- ADSP remoteproc is running (`/sys/class/remoteproc/.../state`)
209+
210+
---

0 commit comments

Comments
 (0)