]> git.proxmox.com Git - grub2.git/blame - tests/grub_cmd_sleep.in
Fix shebang for termux.
[grub2.git] / tests / grub_cmd_sleep.in
CommitLineData
a827807a 1#! @BUILD_SHEBANG@
3f9634e5
VS
2set -e
3
4. "@builddir@/grub-core/modinfo.sh"
5
6# FIXME: OpenBIOS on sparc64 doesn't implement RTC
7if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; then
8 exit 0
9fi
10
11# Compare RTC with interval timer.
12# Not 100% proper but should check that timer is running ok
13dt=`echo 'date; sleep 10; date' | @builddir@/grub-shell`
b43b8cac
VS
14dt1="$(date -u -d "$(echo "$dt" | head -n 1 | sed 's, [A-Z][a-z]*$,,')" +%s)"
15dt2="$(date -u -d "$(echo "$dt" | tail -n 1 | sed 's, [A-Z][a-z]*$,,')" +%s)"
3f9634e5 16
cc2ed410
VS
17# Ignore QEMU bug
18if [ "${grub_modinfo_target_cpu}" = arm ] && [ $((dt2 - dt1)) -ge 15 ] && [ $((dt2 - dt1)) -le 17 ]; then
19 exit 0;
20fi
21
3f9634e5
VS
22if [ $((dt2 - dt1)) -gt 11 ] || [ $((dt2 - dt1)) -lt 9 ]; then
23 echo "Interval not in range $dt2-$dt1 != 10"
24 exit 1
25fi