[U-Boot] [PATCH v2 1/1] test/py/tests/test_sleep.py: test time approximately

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Oct 13 20:28:31 UTC 2017


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 at nvidia.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
v2
	reduce negative tolerance to 0.01 seconds
	(instead of 0.25) as proposed by Stephen
---
 test/py/tests/test_sleep.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/py/tests/test_sleep.py b/test/py/tests/test_sleep.py
index b59a4cfc0f..64e0571326 100644
--- a/test/py/tests/test_sleep.py
+++ b/test/py/tests/test_sleep.py
@@ -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)
-- 
2.14.1



More information about the U-Boot mailing list