Skip to content

Commit b251b98

Browse files
committed
Introduce unified audio test workflow and enhancements
- Modular runner supports both PipeWire and PulseAudio backends - Validation improved with evidence-based checks for playback and recording - Automatic handling of audio assets (download and extraction) - Enhanced diagnostics: dmesg scan, mixer dumps, JUnit XML output for CI - Added CLI options and environment variable support for configuration - Utility scripts refactored for better extensibility and maintainability Signed-off-by: Teja Swaroop Moida <[email protected]>
1 parent e84268e commit b251b98

File tree

6 files changed

+1349
-192
lines changed

6 files changed

+1349
-192
lines changed
Lines changed: 106 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,55 @@
1-
# Audio playback Validation Script for Qualcomm Linux based platform (Yocto)
1+
# Audio Playback Validation Script for Qualcomm Linux-based Platform (Yocto)
22

33
## Overview
44

5-
This script automates the validation of audio playback capabilities on the Qualcomm Linux based platform running a Yocto-based Linux system. It utilizes pulseaudio test app to decode wav file.
5+
This suite automates the validation of audio playback capabilities on Qualcomm Linux-based platforms running a Yocto-based Linux system. It supports both PipeWire and PulseAudio backends, with robust evidence-based PASS/FAIL logic, asset management, and diagnostic logging.
6+
67

78
## Features
89

9-
- Decoding PCM clip
10-
- Compatible with Yocto-based root filesystem
10+
11+
- Supports **PipeWire** and **PulseAudio** backends
12+
- Plays audio clips with configurable format, duration, and loop count
13+
- Automatically downloads and extracts audio assets if missing
14+
- Validates playback using multiple evidence sources:
15+
- PipeWire/PulseAudio streaming state
16+
- ALSA and ASoC runtime status
17+
- Kernel logs (`dmesg`)
18+
- Diagnostic logs: dmesg scan, mixer dumps, playback logs
19+
- Evidence-based validation (user-space, ALSA, ASoC, dmesg)
20+
- Generates `.res` result file and optional JUnit XML output
21+
1122

1223
## Prerequisites
1324

1425
Ensure the following components are present in the target Yocto build:
1526

16-
- `paplay` binary(available at /usr/bin)
27+
- PipeWire: `pw-play`, `wpctl`
28+
- PulseAudio: `paplay`, `pactl`
29+
- Common tools: `pgrep`, `timeout`, `grep`, `wget`, `tar`
30+
- Daemon: `pipewire` or `pulseaudio` must be running
1731

1832
## Directory Structure
1933

2034
```bash
2135
Runner/
22-
├──suites/
23-
├ ├── Multimedia/
24-
│ ├ ├── Audio/
25-
│ ├ ├ ├── AudioPlayback/
26-
│ ├ ├ ├ ├ └── run.sh
27-
├ ├ ├ ├ ├ └── Read_me.md
36+
├── run-test.sh
37+
├── utils/
38+
│ ├── functestlib.sh
39+
│ └── audio_common.sh
40+
└── suites/
41+
└── Multimedia/
42+
└── Audio/
43+
├── AudioPlayback/
44+
├── run.sh
45+
└── Read_me.md
2846
```
2947

3048
## Usage
3149

32-
33-
Instructions
34-
50+
Instructions:
3551
1. Copy repo to Target Device: Use scp to transfer the scripts from the host to the target device. The scripts should be copied to any directory on the target device.
36-
37-
2. Verify Transfer: Ensure that the repo have been successfully copied to any directory on the target device.
38-
52+
2. Verify Transfer: Ensure that the repo has been successfully copied to any directory on the target device.
3953
3. Run Scripts: Navigate to the directory where these files are copied on the target device and execute the scripts as needed.
4054

4155
Run a specific test using:
@@ -46,33 +60,92 @@ git clone <this-repo>
4660
cd <this-repo>
4761
scp -r Runner user@target_device_ip:<Path in device>
4862
ssh user@target_device_ip
49-
cd <Path in device>/Runner && ./run-test.sh AudioPlayback
63+
64+
**Using Unified Runner**
65+
cd <Path in device>/Runner
66+
# Run AudioPlayback using PipeWire (auto-detects backend if not specified)
67+
./run-test.sh AudioPlayback
68+
# Force PulseAudio backend
69+
AUDIO_BACKEND=pulseaudio ./run-test.sh AudioPlayback
70+
# Custom options via environment variables
71+
AUDIO_BACKEND=pipewire PLAYBACK_TIMEOUT=20s PLAYBACK_LOOPS=2 ./run-test.sh AudioPlayback
72+
73+
**Directly from Test Directory**
74+
cd Runner/suites/Multimedia/Audio/AudioPlayback
75+
# Show usage/help
76+
./run.sh --help
77+
# Run with PipeWire, 3 loops, 10s timeout, speakers sink
78+
./run.sh --backend pipewire --sink speakers --loops 3 --timeout 10s
79+
# Run with PulseAudio, null sink, strict mode, verbose
80+
./run.sh --backend pulseaudio --sink null --strict --verbose
81+
82+
Environment Variables:
83+
Variable Description Default
84+
AUDIO_BACKEND Selects backend: pipewire or pulseaudio auto-detect
85+
SINK_CHOICE Playback sink: speakers or null speakers
86+
FORMATS Audio formats: e.g. wav wav
87+
DURATIONS Playback durations: short, medium, long short
88+
LOOPS Number of playback loops 1
89+
TIMEOUT Playback timeout per loop (e.g., 15s, 0=none) 0
90+
STRICT Enable strict mode (fail on any error) 0
91+
DMESG_SCAN Scan dmesg for errors after playback 1
92+
VERBOSE Enable verbose logging 0
93+
EXTRACT_AUDIO_ASSETS Download/extract audio assets if missing true
94+
JUNIT_OUT Path to write JUnit XML output unset
95+
96+
CLI Options
97+
Option Description
98+
--backend Select backend: pipewire or pulseaudio
99+
--sink Playback sink: speakers or null
100+
--formats Audio formats (space/comma separated): e.g. wav
101+
--durations Playback durations: short, medium, long
102+
--loops Number of playback loops
103+
--timeout Playback timeout per loop (e.g., 15s)
104+
--strict Enable strict mode
105+
--no-dmesg Disable dmesg scan
106+
--no-extract-assets Disable asset extraction
107+
--junit <file.xml> Write JUnit XML output
108+
--verbose Enable verbose logging
109+
--help Show usage instructions
110+
50111
```
112+
51113
Sample Output:
52114
```
53-
sh-5.2# cd <Path in device>/Runner/ && ./run-test.sh AudioPlayback
54-
[Executing test case: AudioPlayback] 2025-05-28 19:01:59 -
55-
[INFO] 2025-05-28 19:01:59 - ------------------------------------------------------------
56-
[INFO] 2025-05-28 19:01:59 - ------------------- Starting AudioPlayback Testcase ------------
57-
[INFO] 2025-05-28 19:01:59 - Checking if dependency binary is available
58-
[INFO] 2025-05-28 19:01:59 - Playback clip present: AudioClips/yesterday_48KHz.wav
59-
[PASS] 2025-05-28 19:02:14 - Playback completed or timed out (ret=124) as expected.
60-
[PASS] 2025-05-28 19:02:14 - AudioPlayback : Test Passed
61-
[INFO] 2025-05-28 19:02:14 - See results/audioplayback/playback_stdout.log, dmesg_before/after.log, syslog_before/after.log for debug details
62-
[INFO] 2025-05-28 19:02:14 - ------------------- Completed AudioPlayback Testcase -------------
63-
[PASS] 2025-05-28 19:02:14 - AudioPlayback passed
64-
sh-5.2#
115+
sh-5.3# ./run.sh --backend pipewire
116+
[INFO] 2025-09-12 05:24:47 - ---------------- Starting AudioPlayback ----------------
117+
[INFO] 2025-09-12 05:24:47 - SoC: 498
118+
[INFO] 2025-09-12 05:24:47 - Args: backend=pipewire sink=speakers loops=1 timeout=0 formats='wav' durations='short' strict=0 dmesg=1 extract=true
119+
[INFO] 2025-09-12 05:24:47 - Using backend: pipewire
120+
[INFO] 2025-09-12 05:24:47 - Routing to sink: id=72 name='Built-in Audio Speaker playback' choice=speakers
121+
[INFO] 2025-09-12 05:24:47 - Watchdog/timeout: 0
122+
[INFO] 2025-09-12 05:24:47 - [play_wav_short] loop 1/1 start=2025-09-12T05:24:47Z clip=AudioClips/yesterday_48KHz.wav backend=pipewire sink=speakers(72)
123+
[INFO] 2025-09-12 05:24:47 - [play_wav_short] exec: pw-play -v "AudioClips/yesterday_48KHz.wav"
124+
[INFO] 2025-09-12 05:26:52 - [play_wav_short] evidence: pw_streaming=1 pa_streaming=0 alsa_running=1 asoc_path_on=1 pw_log=1
125+
[PASS] 2025-09-12 05:26:52 - [play_wav_short] loop 1 OK (rc=0, 125s)
126+
[INFO] 2025-09-12 05:26:52 - Scanning dmesg for snd|audio|pipewire|pulseaudio: errors & success patterns
127+
[INFO] 2025-09-12 05:26:52 - No snd|audio|pipewire|pulseaudio-related errors found (no OK pattern requested)
128+
[INFO] 2025-09-12 05:26:52 - Summary: total=1 pass=1 fail=0 skip=0
129+
[PASS] 2025-09-12 05:26:52 - AudioPlayback PASS
65130
```
66-
3. Results will be available in the `Runner/suites/Multimedia/Audio/AudioPlayback/AudioPlayback.res` directory.
131+
132+
Results:
133+
Results are stored in: results/AudioPlayback/
134+
Summary result file: AudioPlayback.res
135+
JUnit XML (if enabled): <your-path>.xml
136+
Diagnostic logs: dmesg snapshots, mixer dumps, playback logs per test case
67137

68138

69139
## Notes
70140

71-
- The script does not take any arguments.
72-
- It validates the presence of required libraries before executing tests.
141+
- The script validates the presence of required tools before executing tests; missing tools result in SKIP.
73142
- If any critical tool is missing, the script exits with an error message.
143+
- Logs include dmesg snapshots, mixer dumps, and playback logs.
144+
- Asset download requires network connectivity.
145+
- Evidence-based PASS/FAIL logic ensures reliability even if backend quirks occur.
74146

75147
## License
76148

77149
SPDX-License-Identifier: BSD-3-Clause-Clear
78150
(C) Qualcomm Technologies, Inc. and/or its subsidiaries.
151+

0 commit comments

Comments
 (0)