Skip to content

Commit

Permalink
volume-basic-test.sh: switch to .tplg parsing to test topologies v2
Browse files Browse the repository at this point in the history
Until now this test was "screen-scraping" amixer output. This was not
compatible with v2 topologies which means the test was always SKIP for
everything developped on the main branch. Switch to parsing topologies
to extract volume kcontrols.

Fixes: #1069, see also discussion in earlier attempt #1068.

Signed-off-by: Marc Herbert <[email protected]>
  • Loading branch information
marc-hb committed May 14, 2024
1 parent b91f8af commit b1af0ab
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test-case/volume-basic-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

# source from the relative path of current folder
# shellcheck source=case-lib/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh
TOPDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)
source "$TOPDIR/case-lib/lib.sh"


volume_array=("0%" "10%" "20%" "30%" "40%" "50%" "60%" "70%" "80%" "90%" "100%")
OPT_NAME['t']='tplg' OPT_DESC['t']="tplg file, default value is env TPLG: $TPLG"
Expand Down Expand Up @@ -62,7 +64,10 @@ sleep 1
[[ ! $(pidof aplay) ]] && die "aplay process is terminated too early"

sofcard=${SOFCARD:-0}
readarray -t pgalist < <(amixer -c"$sofcard" controls | awk -Fname= 'toupper($2) ~ /PGA/ { print $2 }')

# https://mywiki.wooledge.org/BashFAQ/024 why cant I pipe data to read?
readarray -t pgalist < <("$TOPDIR"/tools/topo2_list_vol_kcontrols.py "$tplg")

# This (1) provides some logging (2) avoids skip_test if amixer fails
amixer -c"$sofcard" controls
dlogi "pgalist number = ${#pgalist[@]}"
Expand Down

0 comments on commit b1af0ab

Please sign in to comment.