]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
test/py: gpio: allow omitting gpio_op_pin
authorDavid Lechner <dlechner@baylibre.com>
Thu, 12 Mar 2026 20:33:41 +0000 (15:33 -0500)
committerTom Rini <trini@konsulko.com>
Wed, 25 Mar 2026 20:38:15 +0000 (14:38 -0600)
Modify tests that make use of gpio_op_pin from env__gpio_dev_config to
be skipped if gpio_op_pin is not provided. This is useful in cases where
one might not be sure which GPIOs are safe to use as outputs that can be
toggled without causing problems.

Signed-off-by: David Lechner <dlechner@baylibre.com>
test/py/tests/test_gpio.py

index 059b5141b0f024a6168f1d46d9fe853e575a547b..eba7bab7589a202cb5a0e7737479f8f72bb5c2de 100644 (file)
@@ -134,7 +134,11 @@ def test_gpio_set_generic(ubman):
     if not f:
         pytest.skip("gpio not configured")
 
-    gpio_pin_adr = f['gpio_op_pin']
+    gpio_pin_adr = f.get('gpio_op_pin')
+
+    if gpio_pin_adr is None:
+        pytest.skip("gpio_op_pin is not configured")
+
     gpio_set_value = f['gpio_set_value']
 
 
@@ -158,7 +162,11 @@ def test_gpio_clear_generic(ubman):
     if not f:
         pytest.skip("gpio not configured")
 
-    gpio_pin_adr = f['gpio_op_pin']
+    gpio_pin_adr = f.get('gpio_op_pin')
+
+    if gpio_pin_adr is None:
+        pytest.skip("gpio_op_pin is not configured")
+
     gpio_clear_value = f['gpio_clear_value']
 
 
@@ -182,7 +190,11 @@ def test_gpio_toggle_generic(ubman):
     if not f:
         pytest.skip("gpio not configured")
 
-    gpio_pin_adr = f['gpio_op_pin']
+    gpio_pin_adr = f.get('gpio_op_pin')
+
+    if gpio_pin_adr is None:
+        pytest.skip("gpio_op_pin is not configured")
+
     gpio_set_value = f['gpio_set_value']
     gpio_clear_value = f['gpio_clear_value']