From cc2ed410391773c2b6f094d9d699ac219adbc499 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Fri, 8 Jan 2016 16:22:47 +0100 Subject: [PATCH] arm: Ignore qemu clock bug --- grub-core/tests/sleep_test.c | 9 ++++++++- tests/grub_cmd_sleep.in | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/grub-core/tests/sleep_test.c b/grub-core/tests/sleep_test.c index 3dda30312..3d11c717c 100644 --- a/grub-core/tests/sleep_test.c +++ b/grub-core/tests/sleep_test.c @@ -33,12 +33,19 @@ sleep_test (void) { struct grub_datetime st, en; grub_int32_t stu = 0, enu = 0; + int is_delayok; grub_test_assert (!grub_get_datetime (&st), "Couldn't retrieve start time"); grub_millisleep (10000); grub_test_assert (!grub_get_datetime (&en), "Couldn't retrieve end time"); grub_test_assert (grub_datetime2unixtime (&st, &stu), "Invalid date"); grub_test_assert (grub_datetime2unixtime (&en, &enu), "Invalid date"); - grub_test_assert (enu - stu >= 9 && enu - stu <= 11, "Interval out of range: %d", enu-stu); + is_delayok = (enu - stu >= 9 && enu - stu <= 11); +#ifdef __arm__ + /* Ignore QEMU bug */ + if (enu - stu >= 15 && enu - stu <= 17) + is_delayok = 1; +#endif + grub_test_assert (is_delayok, "Interval out of range: %d", enu-stu); } diff --git a/tests/grub_cmd_sleep.in b/tests/grub_cmd_sleep.in index 1c84fbfbb..eb362aa24 100644 --- a/tests/grub_cmd_sleep.in +++ b/tests/grub_cmd_sleep.in @@ -14,6 +14,11 @@ dt=`echo 'date; sleep 10; date' | @builddir@/grub-shell` dt1="$(date -u -d "$(echo "$dt" | head -n 1)" +%s)" dt2="$(date -u -d "$(echo "$dt" | tail -n 1)" +%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