Skip to content

Commit

Permalink
verify-kernel-boot-log: move all the code to functions
Browse files Browse the repository at this point in the history
Rationale in thesofproject#740

Signed-off-by: Marc Herbert <[email protected]>
  • Loading branch information
marc-hb committed Oct 15, 2021
1 parent 93b5fcd commit c9c038e
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions test-case/verify-kernel-boot-log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"

0 comments on commit c9c038e

Please sign in to comment.