Skip to content

Commit d4a05f4

Browse files
committed
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 <pawelx.langowski@intel.com>
1 parent 5124961 commit d4a05f4

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

test-case/check-audio-equalizer.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
set -e
4+
set -o pipefail
45

56
##
67
## Case Name: check-audio-equalizer.sh
@@ -51,6 +52,13 @@ func_test_eq()
5152
local id=$1
5253
local conf=$2
5354
local double_quoted_id=\""$id"\"
55+
local eq_last_conf="/tmp/eq_last_conf_${sofcard}_${id}.txt"
56+
local ret=0
57+
58+
rm -f "$eq_last_conf"
59+
sof-ctl -Dhw:"$sofcard" -c name="$double_quoted_id" | tail -n1 > "$eq_last_conf" || {
60+
die "Failed to get equalizer config"
61+
}
5462

5563
dlogc "sof-ctl -Dhw:$sofcard -c name=$double_quoted_id -s $conf"
5664
sof-ctl -Dhw:"$sofcard" -c name="$double_quoted_id" -s "$conf" || {
@@ -59,10 +67,21 @@ func_test_eq()
5967
}
6068

6169
dlogc "$cmd -D $dev -f $fmt -c $channel -r $rate -d $duration $dummy_file"
62-
$cmd -D "$dev" -f "$fmt" -c "$channel" -r "$rate" -d "$duration" "$dummy_file" || {
63-
dloge "Equalizer test failure with $conf"
70+
$cmd -D "$dev" -f "$fmt" -c "$channel" -r "$rate" -d "$duration" "$dummy_file" || ret=$?
71+
72+
if ! [ -r "$eq_last_conf" ]; then
73+
dloge "Failed to read equalizer config from $eq_last_conf"
6474
return 1
75+
fi
76+
77+
sof-ctl -Dhw:"$sofcard" -c name="$double_quoted_id" -s "$eq_last_conf" || {
78+
die "Failed to restore equalizer config from $eq_last_conf"
6579
}
80+
81+
if [ $ret -ne 0 ]; then
82+
dloge "Equalizer test failure with $conf"
83+
return 1
84+
fi
6685
sleep 1
6786
}
6887

0 commit comments

Comments
 (0)