diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:29:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:29:51 +0000 |
commit | 6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e (patch) | |
tree | 32451fa3cdd9321fb2591fada9891b2cb70a9cd1 /tests/grub_cmd_sleep.in | |
parent | Initial commit. (diff) | |
download | grub2-upstream/2.06.tar.xz grub2-upstream/2.06.zip |
Adding upstream version 2.06.upstream/2.06upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/grub_cmd_sleep.in')
-rw-r--r-- | tests/grub_cmd_sleep.in | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/grub_cmd_sleep.in b/tests/grub_cmd_sleep.in new file mode 100644 index 0000000..8797f66 --- /dev/null +++ b/tests/grub_cmd_sleep.in @@ -0,0 +1,25 @@ +#! @BUILD_SHEBANG@ +set -e + +. "@builddir@/grub-core/modinfo.sh" + +# FIXME: OpenBIOS on sparc64 doesn't implement RTC +if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; then + exit 0 +fi + +# Compare RTC with interval timer. +# Not 100% proper but should check that timer is running ok +dt=`echo 'date; sleep 10; date' | @builddir@/grub-shell` +dt1="$(date -u -d "$(echo "$dt" | head -n 1 | sed 's, [A-Z][a-z]*$,,')" +%s)" +dt2="$(date -u -d "$(echo "$dt" | tail -n 1 | sed 's, [A-Z][a-z]*$,,')" +%s)" + +# Ignore QEMU bug +if [ "${grub_modinfo_target_cpu}" = arm ] && [ $((dt2 - dt1)) -ge 15 ] && [ $((dt2 - dt1)) -le 17 ]; then + exit 0; +fi + +if [ $((dt2 - dt1)) -gt 11 ] || [ $((dt2 - dt1)) -lt 9 ]; then + echo "Interval not in range $dt2-$dt1 != 10" + exit 1 +fi |