summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-03-31 17:24:19 -0400
committerTom Rini <trini@konsulko.com>2020-03-31 17:24:19 -0400
commit2b18b89156335bf1f0d84f81d3597762bc48c61d (patch)
tree544e93c39bfaeff20b2ac47980de27edf1a585e4 /test
parent779e6dc6a429ac28dfd4f07ab0c3648a31399d4a (diff)
parentac28e59a574dd231a4787752d923f618587e3d10 (diff)
Merge branch 'next' of git://git.denx.de/u-boot-usb into next
Diffstat (limited to 'test')
-rw-r--r--test/compression.c2
-rw-r--r--test/py/tests/test_gpio.py37
-rw-r--r--test/py/tests/test_mmc_rd.py4
3 files changed, 40 insertions, 3 deletions
diff --git a/test/compression.c b/test/compression.c
index cf040d7c86..63f929fa4b 100644
--- a/test/compression.c
+++ b/test/compression.c
@@ -451,7 +451,7 @@ static int compress_using_none(struct unit_test_state *uts,
}
/**
- * run_bootm_test() - Run tests on the bootm decopmression function
+ * run_bootm_test() - Run tests on the bootm decompression function
*
* @comp_type: Compression type to test
* @compress: Our function to compress data
diff --git a/test/py/tests/test_gpio.py b/test/py/tests/test_gpio.py
new file mode 100644
index 0000000000..8c64f686b0
--- /dev/null
+++ b/test/py/tests/test_gpio.py
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+import pytest
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_gpio')
+def test_gpio_input(u_boot_console):
+ """Test that gpio input correctly returns the value of a gpio pin."""
+
+ response = u_boot_console.run_command('gpio input 0; echo rc:$?')
+ expected_response = 'rc:0'
+ assert(expected_response in response)
+ response = u_boot_console.run_command('gpio toggle 0; gpio input 0; echo rc:$?')
+ expected_response = 'rc:1'
+ assert(expected_response in response)
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_gpio')
+def test_gpio_exit_statuses(u_boot_console):
+ """Test that non-input gpio commands correctly return the command
+ success/failure status."""
+
+ expected_response = 'rc:0'
+ response = u_boot_console.run_command('gpio clear 0; echo rc:$?')
+ assert(expected_response in response)
+ response = u_boot_console.run_command('gpio set 0; echo rc:$?')
+ assert(expected_response in response)
+ response = u_boot_console.run_command('gpio toggle 0; echo rc:$?')
+ assert(expected_response in response)
+ response = u_boot_console.run_command('gpio status -a; echo rc:$?')
+ assert(expected_response in response)
+
+ expected_response = 'rc:1'
+ response = u_boot_console.run_command('gpio nonexistent-command; echo rc:$?')
+ assert(expected_response in response)
+ response = u_boot_console.run_command('gpio input 200; echo rc:$?')
+ assert(expected_response in response)
diff --git a/test/py/tests/test_mmc_rd.py b/test/py/tests/test_mmc_rd.py
index a25aa5f6f7..ea652f9136 100644
--- a/test/py/tests/test_mmc_rd.py
+++ b/test/py/tests/test_mmc_rd.py
@@ -56,7 +56,7 @@ env__mmc_dev_configs = (
'info_mode': ???,
'info_buswidth': ???.
},
-}
+)
# Configuration data for test_mmc_rd; defines regions of the MMC (entire
# devices, or ranges of sectors) which can be read:
@@ -210,7 +210,7 @@ def test_mmc_info(u_boot_console, env__mmc_dev_config):
assert good_response in response
good_response = "Bus Speed: %s" % info_speed
assert good_response in response
- good_response = "Mode : %s" % info_mode
+ good_response = "Mode: %s" % info_mode
assert good_response in response
good_response = "Bus Width: %s" % info_buswidth
assert good_response in response