]> git.sur5r.net Git - u-boot/commitdiff
test/py/tests/test_sleep.py: test time approximately
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 13 Oct 2017 20:28:31 +0000 (22:28 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 16 Oct 2017 17:45:37 +0000 (13:45 -0400)
On qemu errors like
assert 2.999650001525879 >= 3
occur.

According to the comment in the code the test is meant to be
approximate. So we should accept some milliseconds less.

Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
test/py/tests/test_sleep.py

index b59a4cfc0fc295cae3cf28e81bfb3f54825aa701..64e0571326224ba42322c780974e7281f1ce1367 100644 (file)
@@ -17,7 +17,7 @@ def test_sleep(u_boot_console):
     u_boot_console.run_command('sleep %d' % sleep_time)
     tend = time.time()
     elapsed = tend - tstart
-    assert elapsed >= sleep_time
+    assert elapsed >= (sleep_time - 0.01)
     if not u_boot_console.config.gdbserver:
         # 0.25s margin is hopefully enough to account for any system overhead.
         assert elapsed < (sleep_time + 0.25)