From 1dce3d7ba2c077847f9e29885dd16836249a41f5 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Mon, 13 May 2024 21:04:40 +0000 Subject: [PATCH] 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 --- test-case/volume-basic-test.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test-case/volume-basic-test.sh b/test-case/volume-basic-test.sh index 79e29043..1f013b2c 100755 --- a/test-case/volume-basic-test.sh +++ b/test-case/volume-basic-test.sh @@ -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" @@ -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/topo_vol_kcontrols.py "$tplg") + # This (1) provides some logging (2) avoids skip_test if amixer fails amixer -c"$sofcard" controls dlogi "pgalist number = ${#pgalist[@]}"