aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/py/tests/test_gpio.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/py/tests/test_gpio.py b/test/py/tests/test_gpio.py
index 109649e2c7f..fa0af5f82b2 100644
--- a/test/py/tests/test_gpio.py
+++ b/test/py/tests/test_gpio.py
@@ -46,6 +46,20 @@ def test_gpio_exit_statuses(u_boot_console):
response = u_boot_console.run_command('gpio input 200; echo rc:$?')
assert(expected_response in response)
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_gpio')
+def test_gpio_read(u_boot_console):
+ """Test that gpio read correctly sets the variable to the value of a gpio pin."""
+
+ response = u_boot_console.run_command('gpio read var 0; echo val:$var,rc:$?')
+ expected_response = 'val:0,rc:0'
+ assert(expected_response in response)
+ response = u_boot_console.run_command('gpio toggle 0; gpio read var 0; echo val:$var,rc:$?')
+ expected_response = 'val:1,rc:0'
+ assert(expected_response in response)
+ response = u_boot_console.run_command('setenv var; gpio read var nonexistent-gpio; echo val:$var,rc:$?')
+ expected_response = 'val:,rc:1'
+ assert(expected_response in response)
"""
Generic Tests for 'gpio' command on sandbox and real hardware.