Skip to content

Commit 0addb17

Browse files
committed
checkpoints: do not use SOF_TEST_INTERVAL in test _iterations_
The purpose of SOF_TEST_INTERVAL is to avoid log gaps between tests, _not_ between test iterations of the same test. Fixes issue where the (recent) check-kmod-load-unload.sh was catching _multiple_ firmware boots, including boots from previous test iterations, example: sof-test/test-case/check-mod-load-unload.sh -l 50 Polling 'sof_firmware_boot_complete --since=@1646100584' every 1s for 10s [ 2968.155103] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: firmware boot complete [ 2970.706560] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: firmware boot complete [ 2974.522111] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: firmware boot complete Completed 'sof_firmware_boot_complete --since=@1646100584' after 0s and 1 attempts This may fix other, similar tests too. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
1 parent 71291e1 commit 0addb17

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

case-lib/hijack.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ function func_exit_handler()
8686
fi
8787

8888
if [[ "$KERNEL_CHECKPOINT" =~ ^[0-9]{10} ]]; then
89+
# Do not collect the entire duration of the test but only the
90+
# last iteration.
8991
journalctl_cmd --since=@"$KERNEL_CHECKPOINT" > "$LOG_ROOT/dmesg.txt"
9092
elif [[ "$KERNEL_CHECKPOINT" == "disabled" ]]; then
9193
journalctl_cmd > "$LOG_ROOT/dmesg.txt"

case-lib/lib.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,14 @@ setup_kernel_check_point()
8282
# appear in the next one, see comments in config.sh. Add 3 extra
8383
# second to account for our own, sof-test delays after PASS/FAIL
8484
# decision: time spent collecting logs etc.
85-
KERNEL_CHECKPOINT=$(($(date +%s) - SOF_TEST_INTERVAL - 3))
85+
if [ -z "$KERNEL_CHECKPOINT" ]; then
86+
KERNEL_CHECKPOINT=$(($(date +%s) - SOF_TEST_INTERVAL - 3))
87+
else
88+
# Not the first time we are called so this is a test
89+
# _iteration_. Add just one extra second in case a test makes
90+
# the mistake to call this function _after_ checking the logs.
91+
KERNEL_CHECKPOINT=$(($(date +%s) - 1))
92+
fi
8693
}
8794

8895
# This function adds a fake error to dmesg (which is always saved by
@@ -425,6 +432,8 @@ journalctl_cmd()
425432
--no-hostname "$@"
426433
}
427434

435+
# Force the exit handler to collect all the logs since boot time instead
436+
# of just the last test iteration.
428437
disable_kernel_check_point()
429438
{
430439
KERNEL_CHECKPOINT="disabled"

0 commit comments

Comments
 (0)