Skip to content

Commit a225efc

Browse files
author
Chao Song
committed
sof-test: include test interval in kernel check point
The sof-framework will add a 5-second test interval between two test cases. This patch makes the kernel check point include this test interval to avoid log loss. And also rename func_lib_setup_kernel_check_point to setup_kernel_check_point, because the prefix doesn't provide much information. Signed-off-by: Chao Song <chao.song@linux.intel.com>
1 parent d7e6d36 commit a225efc

22 files changed

+32
-26
lines changed

case-lib/config.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,8 @@ SUDO_LEVEL=${SUDO_LEVEL:-}
5656
# pipelines will be filtered out. Example:
5757
#
5858
# NO_HDMI_MODE=true
59+
60+
# Test interval between two test cases, the default value is 5 seconds
61+
# in CI, which is controlled by sof-framework. In manual run, user can
62+
# override the default value.
63+
SOF_TEST_INTERVAL=${SOF_TEST_INTERVAL:-5}

case-lib/lib.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ if [ ! "$SOFCARD" ]; then
4040
awk '/sof-[a-z]/ && $1 ~ /^[0-9]+$/ { $1=$1; print $1; exit 0;}')
4141
fi
4242

43-
func_lib_setup_kernel_checkpoint()
43+
setup_kernel_check_point()
4444
{
45-
# shellcheck disable=SC2034 # external script will use it
46-
KERNEL_CHECKPOINT=$(date +%s)
45+
# Make the check point $SOF_TEST_INTERVAL second(s) earlier to avoid log loss.
46+
# Note this may lead to an error caused by one test appear in the next one.
47+
KERNEL_CHECKPOINT=$(($(date +%s) - $SOF_TEST_INTERVAL))
4748
}
4849

4950
# This function adds a fake error to dmesg (which is always saved by
@@ -342,5 +343,5 @@ is_sof_used()
342343
journalctl_cmd()
343344
{
344345
journalctl -k -q --no-pager --utc --output=short-monotonic \
345-
--no-hostname "$@"
346+
--no-hostname "$@"
346347
}

test-case/check-capture.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ file_prefix=${OPT_VAL['f']}
5959

6060
[[ ${OPT_VAL['s']} -eq 1 ]] && func_lib_start_log_collect
6161

62-
func_lib_setup_kernel_checkpoint
62+
setup_kernel_check_point
6363
func_lib_check_sudo
6464
func_pipeline_export "$tplg" "type:capture & ${OPT_VAL['S']}"
6565

test-case/check-fw-echo-reference.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ frequency=${OPT_VAL['f']}
4444
[[ ${OPT_VAL['s']} -eq 1 ]] && func_lib_start_log_collect
4545

4646
func_pipeline_export "$tplg" "echo:any"
47-
func_lib_setup_kernel_checkpoint
47+
setup_kernel_check_point
4848

4949
if [ "$PIPELINE_COUNT" != "2" ]; then
5050
die "Only detect $PIPELINE_COUNT pipeline(s) from topology, but two are needed"

test-case/check-ipc-flood.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ do
4444
# cleanup dmesg buffer for each iteration
4545
sudo dmesg -c > /dev/null
4646
# set up timestamp for each iteration
47-
func_lib_setup_kernel_checkpoint
47+
setup_kernel_check_point
4848
dlogi "===== [$i/$loop_cnt] loop Begin ====="
4949
dlogc "sudo bash -c 'echo $lpc_loop_cnt > $ipc_flood_dfs'"
5050
sudo bash -c "'echo $lpc_loop_cnt > $ipc_flood_dfs'"

test-case/check-keyword-detection.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ duration=${OPT_VAL['d']}
5555
[[ ${OPT_VAL['s']} -eq 1 ]] && func_lib_start_log_collect
5656

5757
func_pipeline_export "$tplg" "kpbm:any"
58-
func_lib_setup_kernel_checkpoint
58+
setup_kernel_check_point
5959

6060
if test "$PIPELINE_COUNT" != "1"; then
6161
die "detected $PIPELINE_COUNT wov pipeline(s) from topology, but 1 is needed"

test-case/check-kmod-load-unload.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ OPT_NAME['p']='pulseaudio' OPT_DESC['p']='disable pulseaudio on the test proce
3333
OPT_HAS_ARG['p']=0 OPT_VAL['p']=1
3434

3535
func_opt_parse_option "$@"
36-
func_lib_setup_kernel_checkpoint
36+
setup_kernel_check_point
3737

3838
loop_cnt=${OPT_VAL['l']}
3939

@@ -48,7 +48,7 @@ for idx in $(seq 1 $loop_cnt)
4848
do
4949
dlogi "===== Starting iteration $idx of $loop_cnt ====="
5050
## - 1: remove module section
51-
func_lib_setup_kernel_checkpoint
51+
setup_kernel_check_point
5252

5353
# After module removal, it takes about 10s for "aplay -l" to show
5454
# device list, within this 10s, it shows "no soundcard found". Here
@@ -78,7 +78,7 @@ do
7878
sof-kernel-log-check.sh "$KERNEL_CHECKPOINT" ||
7979
die "error found after kmod unload is real error, failing"
8080

81-
func_lib_setup_kernel_checkpoint
81+
setup_kernel_check_point
8282
dlogi "run kmod/sof_insert.sh"
8383
sudo sof_insert.sh || {
8484
# FIXME: don't exit the status of dloge(). Use die()

test-case/check-pause-release-suspend-resume.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ esac
110110

111111
[[ ${OPT_VAL['s']} -eq 1 ]] && func_lib_start_log_collect
112112

113-
func_lib_setup_kernel_checkpoint
113+
setup_kernel_check_point
114114

115115
dlogi "Entering audio stream expect script with: $cmd -D $pcm -r $rate -c $channel -f $fmt -vv -i $dummy_file -q"
116116
dlogi "Will enter suspend-resume cycle during paused period of audio stream process"

test-case/check-pause-resume.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func_pipeline_export "$tplg" "type:$test_mode & ${OPT_VAL['S']}"
8181
for idx in $(seq 0 $((PIPELINE_COUNT - 1)))
8282
do
8383
# set up checkpoint for each iteration
84-
func_lib_setup_kernel_checkpoint
84+
setup_kernel_check_point
8585
channel=$(func_pipeline_parse_value "$idx" channel)
8686
rate=$(func_pipeline_parse_value "$idx" rate)
8787
fmt=$(func_pipeline_parse_value "$idx" fmt)

test-case/check-playback.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ else
6767
dlogi "using $file as playback source"
6868
fi
6969

70-
func_lib_setup_kernel_checkpoint
70+
setup_kernel_check_point
7171
func_lib_check_sudo
7272
func_pipeline_export "$tplg" "type:playback & ${OPT_VAL['S']}"
7373

0 commit comments

Comments
 (0)