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