]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
test: py: Add an option to skip sleep test
authorMichal Simek <michal.simek@xilinx.com>
Fri, 8 Dec 2017 14:47:18 +0000 (15:47 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 13 Dec 2017 02:33:38 +0000 (21:33 -0500)
Some QEMUs have a problem with time setup that's why
sleep test is failing. Introduce env__sleep_accurate
boardenv variable to have an option to skip sleep test.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
test/py/tests/test_sleep.py

index 64e0571326224ba42322c780974e7281f1ce1367..ccef24d7f7b84e80847961afa79356c6b8538249 100644 (file)
@@ -5,10 +5,23 @@
 import pytest
 import time
 
+"""
+Note: This test doesn't rely on boardenv_* configuration values but they can
+change test behavior.
+
+# Setup env__sleep_accurate to False if time is not accurate on your platform
+env__sleep_accurate = False
+
+"""
+
 def test_sleep(u_boot_console):
     """Test the sleep command, and validate that it sleeps for approximately
     the correct amount of time."""
 
+    sleep_skip = u_boot_console.config.env.get('env__sleep_accurate', True)
+    if not sleep_skip:
+        pytest.skip('sleep is not accurate')
+
     if u_boot_console.config.buildconfig.get('config_cmd_misc', 'n') != 'y':
         pytest.skip('sleep command not supported')
     # 3s isn't too long, but is enough to cross a few second boundaries.