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
31 changes: 30 additions & 1 deletion Runner/suites/Multimedia/Audio/AudioPlayback/Read_me.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ This suite automates the validation of audio playback capabilities on Qualcomm L

## Features


- Supports **PipeWire** and **PulseAudio** backends
- Plays audio clips with configurable format, duration, and loop count
- Automatically downloads and extracts audio assets if missing
Expand Down Expand Up @@ -63,22 +62,45 @@ ssh user@target_device_ip

**Using Unified Runner**
cd <Path in device>/Runner

# Run AudioPlayback using PipeWire (auto-detects backend if not specified)
./run-test.sh AudioPlayback

# Force PulseAudio backend
AUDIO_BACKEND=pulseaudio ./run-test.sh AudioPlayback

# Custom options via environment variables
AUDIO_BACKEND=pipewire PLAYBACK_TIMEOUT=20s PLAYBACK_LOOPS=2 ./run-test.sh AudioPlayback

# Disable asset extraction (offline mode)
EXTRACT_AUDIO_ASSETS=false ./run-test.sh AudioPlayback

# Provide Wi-Fi credentials for asset download
SSID="MyNetwork" PASSWORD="MyPassword" ./run-test.sh AudioPlayback

# Override network probe targets (useful in restricted networks)
NET_PROBE_ROUTE_IP=192.168.1.1 NET_PING_HOST=192.168.1.254 ./run-test.sh AudioPlayback


**Directly from Test Directory**
cd Runner/suites/Multimedia/Audio/AudioPlayback
# Show usage/help
./run.sh --help

# Run with PipeWire, 3 loops, 10s timeout, speakers sink
./run.sh --backend pipewire --sink speakers --loops 3 --timeout 10s

# Run with PulseAudio, null sink, strict mode, verbose
./run.sh --backend pulseaudio --sink null --strict --verbose

# Disable asset extraction (offline mode)
./run.sh --no-extract-assets

# Provide JUnit output and disable dmesg scan
./run.sh --junit results.xml --no-dmesg



Environment Variables:
Variable Description Default
AUDIO_BACKEND Selects backend: pipewire or pulseaudio auto-detect
Expand All @@ -92,6 +114,11 @@ DMESG_SCAN Scan dmesg for errors after playback 1
VERBOSE Enable verbose logging 0
EXTRACT_AUDIO_ASSETS Download/extract audio assets if missing true
JUNIT_OUT Path to write JUnit XML output unset
SSID Wi-Fi SSID for network connection unset
PASSWORD Wi-Fi password for network connection unset
NET_PROBE_ROUTE_IP IP used for route probing (default: 1.1.1.1) 1.1.1.1
NET_PING_HOST Host used for ping reachability check 8.8.8.8


CLI Options
Option Description
Expand Down Expand Up @@ -142,6 +169,8 @@ Diagnostic logs: dmesg snapshots, mixer dumps, playback logs per test case
- If any critical tool is missing, the script exits with an error message.
- Logs include dmesg snapshots, mixer dumps, and playback logs.
- Asset download requires network connectivity.
- Pass Wi-Fi credentials via SSID and PASSWORD environment variables to enable network access for asset downloads and playback validation.
- You can override default network probe targets using NET_PROBE_ROUTE_IP and NET_PING_HOST to avoid connectivity-related failures in restricted environments.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be helpful to include a few examples showing how users can override these parameters, either using the CLI or environment variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be helpful to include a few examples showing how users can override these parameters, either using the CLI or environment variables.

I've added examples for overriding network-related parameters and Wi-Fi credentials using environment variables. Please let me know if any further changes are needed.

- Evidence-based PASS/FAIL logic ensures reliability even if backend quirks occur.

## License
Expand Down
18 changes: 12 additions & 6 deletions Runner/suites/Multimedia/Audio/AudioPlayback/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,15 @@ for fmt in $FORMATS; do
fi

if [ "${EXTRACT_AUDIO_ASSETS:-true}" = "true" ]; then
ensure_playback_clip "$clip" || {
log_warn "[$case_name] Clip missing and could not be fetched: $clip"
echo "$case_name SKIP (clip missing)" >> "$LOGDIR/summary.txt"
append_junit "$case_name" "0" "SKIP" "$logf"; skip=$((skip + 1)); continue
}
audio_ensure_clip_ready "$clip" "$AUDIO_TAR_URL"
rc=$?
if [ "$rc" -eq 2 ] || [ "$rc" -eq 1 ]; then
log_skip "[$case_name] SKIP: Required clip missing and network unavailable or fetch failed."
echo "$case_name SKIP (clip missing)" >> "$LOGDIR/summary.txt"
append_junit "$case_name" "0" "SKIP" "$logf"
skip=$((skip + 1))
continue
fi
fi

i=1; ok_runs=0; last_elapsed=0
Expand Down Expand Up @@ -274,7 +278,9 @@ if [ -n "$JUNIT_OUT" ]; then
log_info "Wrote JUnit: $JUNIT_OUT"
fi

if [ "$suite_rc" -eq 0 ]; then
if [ "$pass" -eq 0 ] && [ "$fail" -eq 0 ] && [ "$skip" -gt 0 ]; then
log_skip "$TESTNAME SKIP"; echo "$TESTNAME SKIP" > "$RES_FILE"
elif [ "$suite_rc" -eq 0 ]; then
log_pass "$TESTNAME PASS"; echo "$TESTNAME PASS" > "$RES_FILE"
else
log_fail "$TESTNAME FAIL"; echo "$TESTNAME FAIL" > "$RES_FILE"
Expand Down
8 changes: 8 additions & 0 deletions Runner/suites/Multimedia/Audio/AudioRecord/Read_me.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,26 @@ ssh user@target_device_ip

**Using Unified Runner**
cd <Path in device>Runner

# Run Audiorecord using PipeWire (auto-detects backend if not specified)
./run-test.sh Audiorecord

# Force PulseAudio backend
AUDIO_BACKEND=pulseaudio ./run-test.sh Audiorecord

# Custom options via environment variables
AUDIO_BACKEND=pipewire RECORD_TIMEOUT=20s RECORD_LOOPS=2 RECORD_VOLUME=0.5 ./run-test.sh Audiorecord


**Directly from Test Directory**
cd Runner/suites/Multimedia/Audio/Audiorecord

# Show usage/help
./run.sh --help

# Run with PipeWire, 3 loops, 10s timeout, mic source
./run.sh --backend pipewire --source mic --loops 3 --timeout 10s

# Run with PulseAudio, null source, strict mode, verbose
./run.sh --backend pulseaudio --source null --strict --verbose

Expand All @@ -93,6 +100,7 @@ DMESG_SCAN Scan dmesg for errors after recording 1
VERBOSE Enable verbose logging 0
JUNIT_OUT Path to write JUnit XML output unset


CLI Options:
Option Description
--backend Select backend: pipewire or pulseaudio
Expand Down
66 changes: 58 additions & 8 deletions Runner/utils/audio_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,64 @@ resolve_clip() {
esac
}

ensure_playback_clip() {
clip="$1"
[ -f "$clip" ] && return 0
if [ -n "$AUDIO_TAR_URL" ]; then
log_info "Audio clip missing, extracting from $AUDIO_TAR_URL"
extract_tar_from_url "$AUDIO_TAR_URL" || return 1
fi
[ -f "$clip" ]
# audio_download_with_any <url> <outfile>
audio_download_with_any() {
url="$1"; out="$2"
if command -v wget >/dev/null 2>&1; then
wget -O "$out" "$url"
elif command -v curl >/dev/null 2>&1; then
curl -L --fail -o "$out" "$url"
else
log_error "No downloader (wget/curl) available to fetch $url"
return 1
fi
}
# audio_fetch_assets_from_url <url>
# Prefer functestlib's extract_tar_from_url; otherwise download + extract.
audio_fetch_assets_from_url() {
url="$1"
if command -v extract_tar_from_url >/dev/null 2>&1; then
extract_tar_from_url "$url"
return $?
fi
fname="$(basename "$url")"
log_info "Fetching assets: $url"
if ! audio_download_with_any "$url" "$fname"; then
log_warn "Download failed: $url"
return 1
fi
tar -xzf "$fname" >/dev/null 2>&1 || tar -xf "$fname" >/dev/null 2>&1 || {
log_warn "Extraction failed: $fname"
return 1
}
return 0
}
# audio_ensure_clip_ready <clip-path> [tarball-url]
# Return codes:
# 0 = clip exists/ready
# 2 = network unavailable after attempts (caller should SKIP)
# 1 = fetch/extract/downloader error (caller will also SKIP per your policy)
audio_ensure_clip_ready() {
clip="$1"
url="${2:-${AUDIO_TAR_URL:-}}"
[ -f "$clip" ] && return 0
# Try once without forcing network (tarball may already be present)
if [ -n "$url" ]; then
audio_fetch_assets_from_url "$url" >/dev/null 2>&1 || true
[ -f "$clip" ] && return 0
fi
# Bring network up and retry once
if ! ensure_network_online; then
log_warn "Network unavailable; cannot fetch audio assets for $clip"
return 2
fi
if [ -n "$url" ]; then
if audio_fetch_assets_from_url "$url" >/dev/null 2>&1; then
[ -f "$clip" ] && return 0
fi
fi
log_warn "Clip fetch/extract failed for $clip"
return 1
}

# ---------- dmesg + mixer dumps ----------
Expand Down
Loading
Loading