From c9c038efea7224e55d04362b90e7aab0b644d695 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 14 Oct 2021 21:20:10 -0700 Subject: [PATCH] verify-kernel-boot-log: move all the code to functions Rationale in #740 Signed-off-by: Marc Herbert --- test-case/verify-kernel-boot-log.sh | 42 ++++++++++++++++++----------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/test-case/verify-kernel-boot-log.sh b/test-case/verify-kernel-boot-log.sh index 318f97ef..c37b3a24 100755 --- a/test-case/verify-kernel-boot-log.sh +++ b/test-case/verify-kernel-boot-log.sh @@ -18,26 +18,36 @@ set -e # shellcheck source=case-lib/lib.sh source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh -func_opt_parse_option "$@" -disable_kernel_check_point +main() +{ + func_opt_parse_option "$@" + disable_kernel_check_point -print_module_params + print_module_params -# Check this device time is NTP Synchronized -if check_ntp_sync; then - printf '\nTime Check: NTP Synchronized\n' -else - timedatectl show - # try to disable/enable NTP once, this will trigger ntp sync twice, - # before stopping ntp and after enabling ntp. - re_enable_ntp_sync + ntp_check + sof-kernel-log-check.sh +} + +ntp_check() +{ + # Check this device time is NTP Synchronized if check_ntp_sync; then - printf '\nTime Check: NTP Synchronized after re-enabling ntp sync\n' + printf '\nTime Check: NTP Synchronized\n' else - # If NTP is not synchronized, let this test fail - die "Time Check: NTP NOT Synchronized" + timedatectl show + # try to disable/enable NTP once, this will trigger ntp sync twice, + # before stopping ntp and after enabling ntp. + re_enable_ntp_sync + + if check_ntp_sync; then + printf '\nTime Check: NTP Synchronized after re-enabling ntp sync\n' + else + # If NTP is not synchronized, let this test fail + die "Time Check: NTP NOT Synchronized" + fi fi -fi +} -sof-kernel-log-check.sh +main "$@"