-
Notifications
You must be signed in to change notification settings - Fork 21
Add PipeWire support to AudioRecord and AudioPlayback tests #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
tmoida
commented
Aug 8, 2025
- Updated AudioRecord and AudioPlayback scripts to support both PulseAudio and PipeWire
- Added AUDIO_BACKEND variable for backend selection
- Updated README files with usage instructions for both backends
- Modified LAVA test plan to run tests with both PulseAudio and PipeWire
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tmoida Could you please squash the commits into a single one?
Hi @smuppand , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few chnages needed like pre-scan dmesg (use common helpers) -> Run playback (possibly loop) -> post-scan dmesg fir any potential audio-related dmesg messages detected.
better to add a daemon check which prevents false failures when the server isn't running
loops + timeout - Lets you simulate longer playback without hanging CI.
Hi @smuppand,
Please let me know if there is anything else that needs to be addressed. |
@tmoida , please squash your commits. |
Hi @smuppand, I've squashed the commits and fixed the Shell Check warning by using the loop variable. Please let me know if there is anything else that needs to be addressed. Also. I have validated these scripts on Yocto builds, and they work fine. However, on Mainline (Nightly sanity) builds, they are being skipped due to a missing timeout binary. I wanted to check: will the timeout binary be included in future builds, or should I update the script to avoid using it? |
You can use the library function run_with_timeout() if the build does not include the timeout utility. |
Hi @smuppand, Thanks for the suggestions! I've updated the loop logic to handle early exits cleanly and added clearer return handling to distinguish between success and timeout cases. Also, I've replaced timeout with run_with_timeout() as a fallback to ensure compatibility on builds where the timeout binary is missing. Please let me know if there is anything else that needs to be addressed. |
@tmoida Please update the https://github.com/qualcomm-linux/qcom-linux-testkit/blob/main/Runner/plans/meta-ar-ci-premerge.yaml to include the changes that involve launching or adding any tests. |
Hi @smuppand, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this together. I’ve got a few suggestions to make the Audio test more modular and CI-friendly, consistent.
run.sh only: parse flags → call functions in libaudio.sh.
No direct calls to amixer/aplay/tinymix from run.sh (they go via lib).
All shared helpers should wrap functestlib.sh
Happy to re-review once these land.
3996525
to
4a24ae8
Compare
Hi @smuppand, Thank you for your feedback. I have implemented the requested modular structure and made the following changes:
Why separate run.sh scripts for playback and record? To address this and ensure compatibility with All usage details, CLI options, and examples are documented in the respective Let me know if you’d like any further refinements! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also woth adding
- WAV 16-bit/48k, 44.1k; Ogg Vorbis/Opus (if tools available), AAC.
- Short (5s), medium (30s), long (120s) smoke tiers.
- Mixer dumps (pactl list, pw-dump) on failure.
SEARCH=$(dirname "$SEARCH") | ||
done | ||
[ -z "$INIT_ENV" ] && echo "[ERROR] init_env not found" && exit 1 | ||
# shellcheck source=/dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using # shellcheck source=/dev/null
is a blunt silencer that hides real problems and degrades analysis. It tells ShellCheck “pretend this sourced file exists but is empty, It masks real bugs.
. "$TOOLS/libaudio.sh" | ||
|
||
test_path=$(find_test_case_by_name "$TESTNAME") | ||
cd "$test_path" || exit 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach will fail if we run any test from the run-test root, and the .res file will be generated in the directory where the command is executed, rather than in the test directory. Please keep the expected snippet.
test_path=$(find_test_case_by_name "$TESTNAME") | ||
cd "$test_path" || exit 1 | ||
# Override with BusyBox-compatible version | ||
check_network_status() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check_network_status override isn’t used—drop it to keep things tight.
Use available built-in fiunctions like get_ip_address() to avoid duplication.
SEARCH=$(dirname "$SEARCH") | ||
done | ||
[ -z "$INIT_ENV" ] && echo "[ERROR] init_env not found" && exit 1 | ||
# shellcheck source=/dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT
# shellcheck disable=SC1090 | ||
. "$INIT_ENV" | ||
fi | ||
# shellcheck disable=SC1090,SC1091 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT
Runner/utils/libaudio.sh
Outdated
done | ||
|
||
get_kernel_log > "$LOGDIR/dmesg_after.log" | ||
scan_dmesg_errors "audio" "$LOGDIR" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your function signature is scan_dmesg_errors(prefix, module_regex, [exclude]).
Current calls use scan_dmesg_errors "audio" "$LOGDIR" (reversed). This silently weakens the scan. It returns 0 when errors are found, 1 when clean. Runners should only gate FAIL on this if a strict flag is set (to avoid flakiness).
Runner/utils/libaudio.sh
Outdated
|
||
for i in $(seq 1 "$PLAYBACK_LOOPS"); do | ||
log_info "Playback loop $i of $PLAYBACK_LOOPS" | ||
execute_with_timeout "$PLAYBACK_TIMEOUT" sh -c "$PLAY_CMD" >> "$LOGDIR/playback_stdout.log" 2>&1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defaults like 15s are fine for timeout(1) but may break run_with_timeout (usually expects integers). Normalize once, inside execute_with_timeout.
Runner/utils/libaudio.sh
Outdated
|
||
get_kernel_log > "$LOGDIR/dmesg_before.log" | ||
PLAY_CMD=$(setup_playback_command) | ||
PLAY_SUCCESS=0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Playback uses PLAY_SUCCESS but sets PLAYBACK_SUCCESS in one branch—typo causes false PASS.
Runner/utils/libaudio.sh
Outdated
if [ "$AUDIO_BACKEND" = "pipewire" ]; then | ||
select_pipewire_source | ||
fi | ||
check_dependencies "$([ "$AUDIO_BACKEND" = "pulseaudio" ] && echo "parec" || echo "pw-record")" pgrep grep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
select_pipewire_source uses wpctl but dependency check doesn’t require it.
Minor: pgrep grep in check_dependencies is unnecessary; keep pgrep, drop grep.
Runner/utils/libaudio.sh
Outdated
log_fail_exit "$TESTNAME" "Audio playback test failed" | ||
echo "$TESTNAME FAIL" > "$RESULT_FILE" | ||
fi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transferring PASS/FAIL/SKIP ownership to the top-level runner. These shared libraries will be used across the audio files.
d1cc8fe
to
da44e9c
Compare
Hi @smuppand, |
eff1a92
to
a8b34f3
Compare
@tmoida Please rebase |
d39f2d6
to
a6ce819
Compare
Hi @smuppand, The branch has been rebased and updated as requested. Please let me know if any further changes are needed. |
Hi @smuppand, Please let me know if any additional changes are needed. Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a brief commit message, as this PR introduces a new flow 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]>
Added a brief commit message summarizing the new flow and enhancements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM