]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
test: py: Add option to skip i2c device tests
authorMichal Simek <michal.simek@xilinx.com>
Fri, 8 Dec 2017 13:16:46 +0000 (14:16 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 4 Jan 2018 15:19:12 +0000 (16:19 +0100)
Missing/Incorrect QEMU models or broken boards/devices can enable this
new option to skip i2c device tests.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
test/py/tests/test_i2c.py

index 7195409fdcb647e44a5e14203c8ccab2b8c3efdc..2e4a91bedab1638f8ba60366e9be8b92187363c9 100644 (file)
@@ -5,6 +5,16 @@
 import pytest
 import random
 
+"""
+Note: This test doesn't rely on boardenv_* configuration value but they can
+change test behavior.
+
+# Setup env__i2c_device_test_skip to True if tests with i2c devices should be
+# skipped. For example: Missing QEMU model or broken i2c device
+env__i2c_device_test_skip = True
+
+"""
+
 @pytest.mark.buildconfigspec("cmd_i2c")
 def test_i2c_bus(u_boot_console):
     expected_response = "Bus"
@@ -28,6 +38,10 @@ def test_i2c_probe(u_boot_console):
 @pytest.mark.boardspec("zynq_zc706")
 @pytest.mark.buildconfigspec("cmd_i2c")
 def test_i2c_probe_zc70x(u_boot_console):
+    test_skip = u_boot_console.config.env.get('env__i2c_device_test_skip', False)
+    if test_skip:
+        pytest.skip('i2c device test skipped')
+
     # Enable i2c mux bridge
     u_boot_console.run_command("i2c mw 74 0 4")
     u_boot_console.run_command("i2c probe")
@@ -40,6 +54,10 @@ def test_i2c_probe_zc70x(u_boot_console):
 @pytest.mark.boardspec("xilinx_zynqmp_zcu102")
 @pytest.mark.buildconfigspec("cmd_i2c")
 def test_i2c_probe_zcu102(u_boot_console):
+    test_skip = u_boot_console.config.env.get('env__i2c_device_test_skip', False)
+    if test_skip:
+        pytest.skip('i2c device test skipped')
+
     # This is using i2c mux wiring from config file
     u_boot_console.run_command("i2c dev 5")
     u_boot_console.run_command("i2c probe")