test: py: Add an option to skip sleep test

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>
master
Michal Simek 7 years ago committed by Tom Rini
parent f03146480d
commit 040f5f1067
  1. 13
      test/py/tests/test_sleep.py

@ -5,10 +5,23 @@
import pytest import pytest
import time 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): def test_sleep(u_boot_console):
"""Test the sleep command, and validate that it sleeps for approximately """Test the sleep command, and validate that it sleeps for approximately
the correct amount of time.""" 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': if u_boot_console.config.buildconfig.get('config_cmd_misc', 'n') != 'y':
pytest.skip('sleep command not supported') pytest.skip('sleep command not supported')
# 3s isn't too long, but is enough to cross a few second boundaries. # 3s isn't too long, but is enough to cross a few second boundaries.

Loading…
Cancel
Save