Skip to content

Commit 82b4831

Browse files
committed
volume-basic-test.sh: switch to .tplg parsing to test topologies v2
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 <marc.herbert@intel.com>
1 parent dcf8678 commit 82b4831

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

test-case/volume-basic-test.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

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

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

6466
sofcard=${SOFCARD:-0}
65-
readarray -t pgalist < <(amixer -c"$sofcard" controls | awk -Fname= 'toupper($2) ~ /PGA/ { print $2 }')
67+
68+
# https://mywiki.wooledge.org/BashFAQ/024 why cant I pipe data to read?
69+
readarray -t pgalist < <("$TOPDIR"/tools/topo_vol_kcontrols.py "$tplg")
70+
6671
# This (1) provides some logging (2) avoids skip_test if amixer fails
6772
amixer -c"$sofcard" controls
6873
dlogi "pgalist number = ${#pgalist[@]}"

0 commit comments

Comments
 (0)