summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2021-07-23 08:30:48 -0400
committerTom Rini <[email protected]>2021-07-23 08:30:48 -0400
commitf534d93cbf34f1d1762b04eb5680e84bef5e1fe1 (patch)
tree09a0231852e9df884a8da30db093ac1932978814 /test
parent4906d698d3960b70cf8000299da35412efd4f51d (diff)
parent988002dcd931e7236422e4d158c397d964ba1360 (diff)
Merge branch '2021-07-23-assorted-fixes'
- Assorted FIT, optee, pcf8575, mux, vexpress64 and distro bootcmd fixes. - Allow pinmux status to take pin names
Diffstat (limited to 'test')
-rw-r--r--test/cmd/Makefile1
-rw-r--r--test/cmd/pinmux.c36
-rw-r--r--test/py/tests/test_pinmux.py4
3 files changed, 39 insertions, 2 deletions
diff --git a/test/cmd/Makefile b/test/cmd/Makefile
index 2cfe43a6bd3..a59adb1e6d6 100644
--- a/test/cmd/Makefile
+++ b/test/cmd/Makefile
@@ -8,5 +8,6 @@ endif
obj-y += mem.o
obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o
obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
+obj-$(CONFIG_CMD_PINMUX) += pinmux.o
obj-$(CONFIG_CMD_PWM) += pwm.o
obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
diff --git a/test/cmd/pinmux.c b/test/cmd/pinmux.c
new file mode 100644
index 00000000000..8ae807b5377
--- /dev/null
+++ b/test/cmd/pinmux.c
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Executes tests for pinmux command
+ *
+ * Copyright (C) 2021, STMicroelectronics - All Rights Reserved
+ */
+
+#include <common.h>
+#include <command.h>
+#include <dm/test.h>
+#include <test/test.h>
+#include <test/ut.h>
+
+static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts)
+{
+ /* Test that 'pinmux status <pinname>' displays the selected pin. */
+ console_record_reset();
+ run_command("pinmux status a5", 0);
+ ut_assert_nextline("a5 : gpio input . ");
+ ut_assert_console_end();
+
+ console_record_reset();
+ run_command("pinmux status P7", 0);
+ ut_assert_nextline("P7 : GPIO2 bias-pull-down input-enable. ");
+ ut_assert_console_end();
+
+ console_record_reset();
+ run_command("pinmux status P9", 0);
+ ut_assert_nextline("single-pinctrl pinctrl-single-no-width: missing register width");
+ ut_assert_nextline("P9 not found");
+ ut_assert_console_end();
+
+ return 0;
+}
+
+DM_TEST(dm_test_cmd_pinmux_status_pinname, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
diff --git a/test/py/tests/test_pinmux.py b/test/py/tests/test_pinmux.py
index 0cbbae000c8..b3ae2ab0240 100644
--- a/test/py/tests/test_pinmux.py
+++ b/test/py/tests/test_pinmux.py
@@ -13,9 +13,9 @@ def test_pinmux_usage_1(u_boot_console):
@pytest.mark.buildconfigspec('cmd_pinmux')
def test_pinmux_usage_2(u_boot_console):
"""Test that 'pinmux status' executed without previous "pinmux dev"
- command displays pinmux usage."""
+ command displays error message."""
output = u_boot_console.run_command('pinmux status')
- assert 'Usage:' in output
+ assert 'pin-controller device not selected' in output
@pytest.mark.buildconfigspec('cmd_pinmux')
@pytest.mark.boardspec('sandbox')