Skip to contentSkip to conversation

test: py: Add an option to skip sleep test

PATCH New Michal Simek 4 participants 5 messages Dec 8, 2017 – Dec 13, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---

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(+)
test/py/tests/test_sleep.py +13 -0
index 64e057132622..ccef24d7f7b8 100644
@@ -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.
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 test: py: Add an option to skip sleep test

Quoted 5 lines · Michal Simek

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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171208/81025006/attachment.sig>
#2 lore raw

PATCH v2 1/1 test: py: Add an option to skip sleep test

In reply to Michal Simek
Quoted 3 lines · Michal Simek

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.

Nit: Commit descriptions are typically wrapped around 70-74 characters; the above is very narrow.

test/py/tests/test_sleep.py line 15

Quoted 10 lines
test/py/tests/test_sleep.py +8 -0
 
+"""
+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
+
+"""

Nit: No need for that trailing empty line in the docstring.

(I was going to contemplate a more generic system implemented in conftest.py that could work with any test, but I guess this is simple enough and solves the only issue we have right now, so it's fine.)

#3 lore raw

PATCH v2 1/1 test: py: Add an option to skip sleep test

2017-12-08 17:54 GMT+01:00 Stephen Warren <[email protected]>:

Quoted 27 lines · Michal Simek
Quoted 5 lines

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.

Nit: Commit descriptions are typically wrapped around 70-74 characters; the above is very narrow.

test/py/tests/test_sleep.py +0 -0
Quoted 1 line

+"""

test/py/tests/test_sleep.py line 15

Quoted 10 lines

+Note: This test doesn't rely on boardenv_* configuration values but they can

test/py/tests/test_sleep.py +3 -0
+change test behavior.
+
+# Setup env__sleep_accurate to False if time is not accurate on your

platform

test/py/tests/test_sleep.py +3 -0
+env__sleep_accurate = False
+
+"""

Nit: No need for that trailing empty line in the docstring.

Quoted 6 lines

(I was going to contemplate a more generic system implemented in conftest.py that could work with any test, but I guess this is simple enough and solves the only issue we have right now, so it's fine.)

I think also that generic solution would be better. I was checking xilinx repo where we have some simple i2c
device tests which also needs to be run based on platforms. This test is broken on qemu and some boards are also broken.
There is not an issue with travis because sleep tests are disabled now. For my qemu testing it is not big deal and I can use -k not sleep or this patch as temporary workaround till we have generic solution in place.

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
#4 lore raw

PATCH v2 1/1 test: py: Add an option to skip sleep test

In reply to Michal Simek
Quoted 7 lines · Michal Simek

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171213/06596f5a/attachment.sig>