Skip to content

Commit 5036042

Browse files
authored
Merge pull request #367 from nitinn22/feature/audio-record-playback-fix-clean
Audio: fix/update record-playback test to use shared recorded directory
2 parents 613074a + ee2f9d9 commit 5036042

4 files changed

Lines changed: 276 additions & 88 deletions

File tree

Runner/suites/Multimedia/GSTreamer/Audio/Audio_Record_Playback/Audio_Record_Playback.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,25 @@ metadata:
55
Audio record/playback validation using GStreamer (gst-launch-1.0).
66
Tests 10 scenarios: 4 encode (2 audiotestsrc + 2 pulsesrc) + 6 decode (4 playback + 2 OGG/MP3).
77
Supports WAV, FLAC, OGG, and MP3 formats with both synthetic audio (audiotestsrc) and hardware capture (pulsesrc).
8-
Duration controlled via AUDIO_DURATION (default 10s): audiotestsrc uses num-buffers, pulsesrc uses timeout.
8+
Duration controlled via AUDIO_DURATION (default 10s): audiotestsrc uses num-buffers calculated after argument parsing, pulsesrc uses timeout.
9+
Uses AUDIO_SHARED_RECORDED_DIR for shared artifact storage across test runs.
910
os:
1011
- linux
1112
scope:
1213
- functional
1314

1415
params:
1516
AUDIO_TEST_MODE: "all"
17+
AUDIO_TEST_NAME: ""
1618
AUDIO_FORMATS: "wav,flac"
1719
AUDIO_DURATION: "10"
1820
AUDIO_GST_DEBUG: "2"
1921

2022
run:
2123
steps:
2224
- REPO_PATH="$PWD"
23-
- cd Runner/suites/Multimedia/GSTreamer/Audio/Audio_Record_Playback/
24-
- export AUDIO_TEST_MODE AUDIO_FORMATS AUDIO_DURATION AUDIO_GST_DEBUG
25-
- ./run.sh --mode "${AUDIO_TEST_MODE}" --formats "${AUDIO_FORMATS}" --duration "${AUDIO_DURATION}" --gst-debug "${AUDIO_GST_DEBUG}" || true
25+
- cd "$REPO_PATH/Runner/suites/Multimedia/GSTreamer/Audio/Audio_Record_Playback"
26+
- AUDIO_SHARED_RECORDED_DIR="${REPO_PATH%%/tests/*}/shared/audio-record-playback"
27+
- export REPO_PATH AUDIO_SHARED_RECORDED_DIR AUDIO_TEST_MODE AUDIO_TEST_NAME AUDIO_FORMATS AUDIO_DURATION AUDIO_GST_DEBUG
28+
- ./run.sh || true
2629
- $REPO_PATH/Runner/utils/send-to-lava.sh Audio_Record_Playback.res

Runner/suites/Multimedia/GSTreamer/Audio/Audio_Record_Playback/README.md

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ At a high level, the test:
4545
4. **Recording phase (ENCODE - 4 tests)**:
4646
- **audiotestsrc tests**: Generates sine wave at 440Hz, encodes to WAV/FLAC
4747
- **pulsesrc tests**: Captures from hardware audio input, encodes to WAV/FLAC
48-
- Saves recorded files to `logs/Audio_Record_Playback/recorded/`
48+
- Saves recorded files to shared directory (via `AUDIO_SHARED_RECORDED_DIR` / `gstreamer_shared_recorded_dir()`)
49+
- CI/LAVA runs: `<repo_root>/shared/audio-record-playback/`
50+
- Local/manual runs: `logs/Audio_Record_Playback/recorded/` (fallback)
4951
- Duration control:
5052
- audiotestsrc: Buffer count calculated dynamically: `(44100 * duration) / 1024`
5153
- pulsesrc: Uses timeout command to stop recording after specified duration
@@ -94,15 +96,14 @@ By default, the test runs **10 test cases** with 10 second duration:
9496
## PASS / FAIL / SKIP criteria
9597

9698
### PASS
97-
- **Recording**: Output file is created and has size > 1000 bytes
98-
- **Playback**: Pipeline completes successfully with exit code 0 (clean completion)
99-
- **Note**: Timeout (exit code 124) or termination (exit code 143) are treated as **FAIL** for controlled-duration recordings
100-
- This ensures playback completed successfully rather than being interrupted
99+
- **Recording**: Output file is created and has size > 1000 bytes, and no GStreamer errors detected in log
100+
- Exit code is not directly checked - timeout/termination is acceptable if file is valid
101+
- **Playback**: Pipeline completes successfully with exit code 0 and no GStreamer errors detected in log
101102
- **Overall**: At least one test passes and no tests fail
102103

103104
### FAIL
104-
- **Recording**: No output file created or file size too small
105-
- **Playback**: Pipeline exits with non-zero code (including timeout 124 or termination 143) or GStreamer errors detected
105+
- **Recording**: No output file created, file size too small (≤ 1000 bytes), or GStreamer errors detected in log
106+
- **Playback**: Pipeline exits with non-zero code or GStreamer errors detected in log
106107
- **Overall**: One or more tests fail
107108

108109
### SKIP
@@ -131,15 +132,39 @@ By default, logs are written relative to the script working directory:
131132
playback_flac.log
132133
playback_pulsesrc_wav.log
133134
playback_pulsesrc_flac.log
134-
recorded/ # Recorded audio files
135-
record_wav.wav
136-
record_flac.flac
137-
record_pulsesrc_wav.wav
138-
record_pulsesrc_flac.flac
139135
dmesg/ # dmesg scan outputs (if available)
140136
dmesg_errors.log
141137
```
142138

139+
### Recorded Audio Artifacts
140+
141+
Recorded audio files are stored in a shared directory to enable artifact reuse across test runs:
142+
143+
**Local/Manual Runs** (fallback):
144+
```
145+
./logs/Audio_Record_Playback/recorded/
146+
record_wav.wav
147+
record_flac.flac
148+
record_pulsesrc_wav.wav
149+
record_pulsesrc_flac.flac
150+
```
151+
152+
**CI/LAVA Runs** (shared path):
153+
```
154+
<repo_root>/shared/audio-record-playback/
155+
record_wav.wav
156+
record_flac.flac
157+
record_pulsesrc_wav.wav
158+
record_pulsesrc_flac.flac
159+
```
160+
161+
The recorded artifact directory is determined by:
162+
1. **Explicit override**: `AUDIO_SHARED_RECORDED_DIR` environment variable (if set)
163+
2. **LAVA/tests detection**: Shared path derived from repository structure (if script path contains `/tests/`)
164+
3. **Local fallback**: `./logs/Audio_Record_Playback/recorded/` (for manual runs)
165+
166+
This ensures that in CI/LAVA environments, recorded artifacts are placed in a shared location accessible across multiple test runs, while local/manual runs use a simple local directory.
167+
143168
---
144169

145170
## Dependencies
@@ -530,21 +555,30 @@ fi
530555
- `SKIP` - No tests executed or all skipped
531556
- Test summary is logged showing pass/fail/skip counts
532557
- Individual test logs are available in `logs/Audio_Record_Playback/`
533-
- Recorded files are preserved in `logs/Audio_Record_Playback/recorded/` for debugging
558+
- Recorded files are preserved in the shared recorded directory for debugging:
559+
- CI/LAVA runs: `<repo_root>/shared/audio-record-playback/`
560+
- Local/manual runs: `logs/Audio_Record_Playback/recorded/` (fallback)
534561

535562
### LAVA Environment Variables
536563

537564
The test supports these environment variables (can be set in LAVA job definition):
538565

539566
- `AUDIO_TEST_MODE` - Test mode (all/record/playback) (default: all)
567+
- `AUDIO_TEST_NAME` - Individual test name for single test execution (optional)
540568
- `AUDIO_FORMATS` - Comma-separated format list (default: `wav,flac`)
541569
- `AUDIO_DURATION` - Recording duration in seconds (default: 10)
542570
- `RUNTIMESEC` - Alternative to AUDIO_DURATION (for backward compatibility)
543571
- `AUDIO_GST_DEBUG` - GStreamer debug level (default: 2)
544572
- `GST_DEBUG_LEVEL` - Alternative to AUDIO_GST_DEBUG
573+
- `AUDIO_CLIP_URL` - URL to download test audio files (OGG/MP3) (default: GitHub release URL)
574+
- `AUDIO_CLIP_PATH` - Local path to test audio files (overrides AUDIO_CLIP_URL if files exist)
575+
- `AUDIO_SHARED_RECORDED_DIR` - Shared directory for recorded audio artifacts (optional)
576+
- `REPO_PATH` - Repository root path (set by YAML, used for path resolution)
545577

546578
**Priority order for duration**: `AUDIO_DURATION` > `RUNTIMESEC` > default (10)
547579

580+
**Shared Artifact Directory**: The test uses `AUDIO_SHARED_RECORDED_DIR` to store recorded audio files in a shared location across multiple test runs. If not set, the test will automatically determine the appropriate directory based on the environment (LAVA vs local).
581+
548582
### Test Counting
549583

550584
- **Total tests**: 10 (when running with default wav,flac formats in all mode)

0 commit comments

Comments
 (0)