Skip to content
Draft
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
72 changes: 64 additions & 8 deletions Runner/config/pkg_command_map.conf
Original file line number Diff line number Diff line change
Expand Up @@ -216,35 +216,91 @@ ubuntu:package-set:graphics=kgsl-dkms adreno-common adreno-gles1 adreno-gles2 ad
# ---------------------------------------------------------------------------
# Audio validation package recovery.
#
# Debian Audio tests use the upstream base Audio stack by default.
# Debian and Ubuntu Audio tests use their distro-provided base Audio stack.
#
# Qualcomm AudioReach packages are installed only when --overlay is explicitly
# requested.
#
# Ubuntu uses the apt sources already configured by the distro image. Audio
# package preparation must not add, replace, or rewrite Ubuntu apt sources.
#
# No rpm, opkg, qcom-distro, or generic provider package-set mapping is
# provided. Yocto and other embedded images therefore continue using their
# image-provided Audio stack without package recovery.
# provided. Yocto and other embedded images continue using their image-provided
# Audio stack without package recovery.
# ---------------------------------------------------------------------------

# ---------------------------------------------------------------------------
# Debian base Audio stack.
# ---------------------------------------------------------------------------

debian:package-set:audio-base=alsa-utils pipewire-bin wireplumber pulseaudio-utils curl wget ca-certificates tar gzip

# ---------------------------------------------------------------------------
# Ubuntu base Audio stack.
#
# pipewire:
# PipeWire daemon and service files.
#
# pipewire-bin:
# pw-play, pw-record, pw-cli and other PipeWire command-line tools.
#
# pipewire-audio:
# Recommended Ubuntu PipeWire audio integration, including ALSA and
# PulseAudio compatibility components.
#
# wireplumber:
# PipeWire session and policy manager providing wpctl.
#
# pulseaudio-utils:
# pactl, paplay and parecord compatibility commands.
#
# curl, wget, ca-certificates, tar and gzip:
# Required by AudioPlayback to download and extract AudioClips.tar.gz.
# ---------------------------------------------------------------------------

# Base Debian Audio stack.
debian:package-set:audio-base=alsa-utils pipewire-bin wireplumber pulseaudio-utils
ubuntu:package-set:audio-base=alsa-utils alsa-ucm-conf curl ca-certificates tar gzip

# ---------------------------------------------------------------------------
# Debian Qualcomm AudioReach overlay stack.
#
# This package set is complete by itself because overlay mode checks only
# "audio"; it does not check "audio-base" first.
debian:package-set:audio=alsa-utils pipewire-bin wireplumber pulseaudio-utils audioreach-pipewire-plugin audioreach-kernel-dkms audioreach-config
# The overlay package set must be complete by itself because --overlay checks
# the "audio" package set directly; it does not install "audio-base" first.
# ---------------------------------------------------------------------------

debian:package-set:audio=alsa-utils pipewire-bin wireplumber pulseaudio-utils curl ca-certificates tar gzip audioreach-pipewire-plugin audioreach-kernel-dkms audioreach-config

# ---------------------------------------------------------------------------
# Ubuntu Qualcomm AudioReach overlay stack.
#
# Ubuntu uses the existing distro-configured apt sources. Do not configure a
# Debian, qli, or qli-staging source from the Audio test.
#
# This package set includes the complete Ubuntu base Audio stack because
# --overlay checks only the "audio" package set.
# ---------------------------------------------------------------------------

ubuntu:package-set:audio=alsa-utils pipewire pipewire-bin pipewire-audio wireplumber pulseaudio-utils curl wget ca-certificates tar gzip audioreach-pipewire-plugin audioreach-kernel-dkms audioreach-config

# ---------------------------------------------------------------------------
# Command recovery used by check_dependencies()/pkg_ensure_command().
#
# These apt-provider mappings apply to Debian and Ubuntu.
# ---------------------------------------------------------------------------

apt:aplay=alsa-utils
apt:arecord=alsa-utils
apt:amixer=alsa-utils
apt:alsaucm=alsa-utils
apt:wpctl=wireplumber
apt:pipewire=pipewire
apt:pw-play=pipewire-bin
apt:pw-record=pipewire-bin
apt:pactl=pulseaudio-utils
apt:paplay=pulseaudio-utils
apt:parecord=pulseaudio-utils
apt:curl=curl
apt:wget=wget
apt:tar=tar

# ---------------------------------------------------------------------------
# Qualcomm Sensors runtime and test packages.
Expand Down
98 changes: 76 additions & 22 deletions Runner/utils/audio_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4204,8 +4204,10 @@ audio_prepare_test_packages() {
;;
esac

# Resolve the operating-system ID without making the package-provider
# library mandatory on native embedded images.
###########################################################################
# Platform detection
###########################################################################

if command -v pkg_detect_os_id >/dev/null 2>&1; then
atp_os_id="$(
pkg_detect_os_id 2>/dev/null ||
Expand All @@ -4227,23 +4229,55 @@ audio_prepare_test_packages() {
log_info "Native image detected; Audio package preparation is not required"
return 0
;;
debian)
debian|ubuntu)
;;
*)
log_info "Audio package preparation is not enabled for os=$atp_os_id"
return 0
;;
esac

# Debian package preparation must run before the test is re-executed as the
# unprivileged Audio user.
###########################################################################
# Root requirement
###########################################################################

if [ "$(id -u 2>/dev/null || echo 1)" -ne 0 ]; then
log_fail "Debian Audio package preparation must run as root"
log_fail "Audio package preparation must run as root for os=$atp_os_id"
return 1
fi

###########################################################################
# Debian base mode
# Ubuntu package preparation
###########################################################################

if [ "$atp_os_id" = "ubuntu" ]; then
if [ "$atp_overlay_requested" -eq 1 ]; then
log_fail "Ubuntu AudioReach overlay support is still in progress"
log_info "Use the Ubuntu native ALSA/UCM path without --overlay"
log_info "No AudioReach packages were installed"
log_info "No Ubuntu apt source files were added or modified"
return 1
fi

if ! command -v pkg_ensure_required_package_set_present \
>/dev/null 2>&1; then
log_fail "Required package-set helper is unavailable"
return 1
fi

log_info "Preparing native Ubuntu ALSA/UCM Audio packages"

if ! pkg_ensure_required_package_set_present audio-base; then
log_fail "Failed to ensure Ubuntu native Audio package set"
return 1
fi

log_pass "Ubuntu native ALSA/UCM Audio package set is ready"
return 0
fi

###########################################################################
# Debian base package preparation
###########################################################################

if [ "$atp_overlay_requested" -eq 0 ]; then
Expand All @@ -4253,6 +4287,8 @@ audio_prepare_test_packages() {
return 1
fi

log_info "Preparing Debian base Audio packages"

if ! pkg_ensure_required_package_set_present audio-base; then
log_fail "Failed to ensure Debian base Audio package set"
return 1
Expand All @@ -4263,7 +4299,7 @@ audio_prepare_test_packages() {
fi

###########################################################################
# Debian AudioReach overlay mode
# Debian Qualcomm AudioReach overlay package preparation
###########################################################################

if ! command -v pkg_ensure_optional_package_set_present \
Expand All @@ -4278,9 +4314,12 @@ audio_prepare_test_packages() {
return 1
fi

# Capture AudioReach package versions before package preparation. These
# values let us distinguish an already-ready target from an install or
# upgrade performed during this invocation.
log_info "Preparing Debian Qualcomm AudioReach overlay packages"

###########################################################################
# Capture AudioReach package state before preparation
###########################################################################

atp_before_plugin="$(
pkg_installed_package_version \
audioreach-pipewire-plugin 2>/dev/null ||
Expand All @@ -4299,19 +4338,26 @@ audio_prepare_test_packages() {
true
)"

# The optional package provider intentionally requires the literal
# --overlay argument. Passing only the internal value "1" makes the provider
# treat the request as base mode.
###########################################################################
# Ensure the Debian AudioReach package set
###########################################################################

# The optional package provider determines overlay mode from the arguments.
# Keep --overlay last so it cannot be overridden by an earlier base option.
if ! pkg_ensure_optional_package_set_present \
audio \
qli-staging \
auto \
--overlay \
"$@"; then
"$@" \
--overlay; then
log_fail "Failed to ensure Debian AudioReach package set"
return 1
fi

###########################################################################
# Capture AudioReach package state after preparation
###########################################################################

atp_after_plugin="$(
pkg_installed_package_version \
audioreach-pipewire-plugin 2>/dev/null ||
Expand All @@ -4330,6 +4376,10 @@ audio_prepare_test_packages() {
true
)"

###########################################################################
# Detect AudioReach package changes
###########################################################################

if [ "$atp_before_plugin" != "$atp_after_plugin" ] ||
[ "$atp_before_dkms" != "$atp_after_dkms" ] ||
[ "$atp_before_config" != "$atp_after_config" ]; then
Expand All @@ -4353,8 +4403,10 @@ audio_prepare_test_packages() {
log_info "AudioReach packages were already installed; runtime package state is unchanged"
fi

# Do not continue into Audio testing after installing or upgrading the DKMS
# package. The active kernel must boot with the newly prepared module.
###########################################################################
# Debian AudioReach DKMS reboot requirement
###########################################################################

if [ "$atp_before_dkms" != "$atp_after_dkms" ]; then
AUDIO_OVERLAY_REBOOT_REQUIRED=1
export AUDIO_OVERLAY_REBOOT_REQUIRED
Expand All @@ -4363,9 +4415,11 @@ audio_prepare_test_packages() {
log_warn "A reboot is required before running AudioReach validation"
return 2
fi

# Refresh module metadata when package state changed, then install and
# activate the repository-owned AudioReach udev rule.

###########################################################################
# Refresh Debian AudioReach device policy
###########################################################################

if ! command -v audio_refresh_overlay_devices \
>/dev/null 2>&1; then
log_fail "AudioReach device-refresh helper is unavailable"
Expand All @@ -4375,7 +4429,7 @@ audio_prepare_test_packages() {
if ! audio_refresh_overlay_devices \
"$atp_overlay_requested" \
"$AUDIO_OVERLAY_PACKAGES_CHANGED"; then
log_fail "Failed to refresh AudioReach devices"
log_fail "Failed to refresh Debian AudioReach devices"
return 1
fi

Expand Down
Loading