From b65cd74928e9e9f33faec5fef670e937a96de3ff Mon Sep 17 00:00:00 2001 From: Pawel Langowski Date: Mon, 28 Jul 2025 15:15:08 +0200 Subject: [PATCH] test-case: check-audio-equalizer.sh: Restore config after test Save the initial equalizer config to a temporary file and restore it after each test Signed-off-by: Pawel Langowski --- test-case/check-audio-equalizer.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/test-case/check-audio-equalizer.sh b/test-case/check-audio-equalizer.sh index 1b4a4ad3..15941621 100755 --- a/test-case/check-audio-equalizer.sh +++ b/test-case/check-audio-equalizer.sh @@ -1,6 +1,7 @@ #!/bin/bash set -e +set -o pipefail ## ## Case Name: check-audio-equalizer.sh @@ -51,6 +52,11 @@ func_test_eq() local id=$1 local conf=$2 local double_quoted_id=\""$id"\" + local eq_last_conf="/tmp/eq_last_conf_${sofcard}_${id}.txt" + local ret=0 + + rm -f "$eq_last_conf" + sof-ctl -Dhw:"$sofcard" -c name="$double_quoted_id" | tail -n1 > "$eq_last_conf" || die "Failed to get equalizer config" dlogc "sof-ctl -Dhw:$sofcard -c name=$double_quoted_id -s $conf" sof-ctl -Dhw:"$sofcard" -c name="$double_quoted_id" -s "$conf" || { @@ -59,10 +65,15 @@ func_test_eq() } dlogc "$cmd -D $dev -f $fmt -c $channel -r $rate -d $duration $dummy_file" - $cmd -D "$dev" -f "$fmt" -c "$channel" -r "$rate" -d "$duration" "$dummy_file" || { - dloge "Equalizer test failure with $conf" - return 1 - } + $cmd -D "$dev" -f "$fmt" -c "$channel" -r "$rate" -d "$duration" "$dummy_file" || ret=$? + + [ -r "$eq_last_conf" ] || + die "Failed to read equalizer config from $eq_last_conf" + + sof-ctl -Dhw:"$sofcard" -c name="$double_quoted_id" -s "$eq_last_conf" || die "Failed to restore equalizer config from $eq_last_conf" + + [ "$ret" -eq 0 ] || return 1 + sleep 1 }