[U-Boot] [PATCH v2] test: py: Add an option to skip sleep test

Michal Simek michal.simek at xilinx.com
Fri Dec 8 14:47:18 UTC 2017


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 at xilinx.com>
---

Changes in v2:
- Remove unrelated zc706 change

Changes in v1:
- Change subject line and patch description
- Move from RFC to regular patch
- Remove boardidentity marker and use variable instead

 test/py/tests/test_sleep.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/test/py/tests/test_sleep.py b/test/py/tests/test_sleep.py
index 64e057132622..ccef24d7f7b8 100644
--- a/test/py/tests/test_sleep.py
+++ b/test/py/tests/test_sleep.py
@@ -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.
-- 
1.9.1



More information about the U-Boot mailing list