Patrick Delaunay | fea0345 | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Executes tests for pinmux command |
| 4 | * |
| 5 | * Copyright (C) 2021, STMicroelectronics - All Rights Reserved |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <command.h> |
Marek Vasut | 891ec35 | 2022-04-25 18:33:51 +0200 | [diff] [blame] | 10 | #include <dm.h> |
Patrick Delaunay | fea0345 | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 11 | #include <dm/test.h> |
| 12 | #include <test/test.h> |
| 13 | #include <test/ut.h> |
| 14 | |
| 15 | static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts) |
| 16 | { |
Marek Vasut | 891ec35 | 2022-04-25 18:33:51 +0200 | [diff] [blame] | 17 | struct udevice *dev; |
| 18 | |
| 19 | ut_assertok(uclass_get_device(UCLASS_LED, 2, &dev)); |
| 20 | |
Patrick Delaunay | fea0345 | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 21 | /* Test that 'pinmux status <pinname>' displays the selected pin. */ |
| 22 | console_record_reset(); |
| 23 | run_command("pinmux status a5", 0); |
Marek Vasut | 72675b0 | 2022-04-04 01:23:27 +0200 | [diff] [blame] | 24 | ut_assert_nextlinen("a5 : gpio output ."); |
Patrick Delaunay | fea0345 | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 25 | ut_assert_console_end(); |
| 26 | |
| 27 | console_record_reset(); |
| 28 | run_command("pinmux status P7", 0); |
Michal Simek | 57d820d | 2022-03-07 16:48:17 +0100 | [diff] [blame] | 29 | ut_assert_nextlinen("P7 : GPIO2 bias-pull-down input-enable."); |
Patrick Delaunay | fea0345 | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 30 | ut_assert_console_end(); |
| 31 | |
| 32 | console_record_reset(); |
| 33 | run_command("pinmux status P9", 0); |
Michal Simek | 57d820d | 2022-03-07 16:48:17 +0100 | [diff] [blame] | 34 | ut_assert_nextlinen("single-pinctrl pinctrl-single-no-width: missing register width"); |
| 35 | ut_assert_nextlinen("P9 not found"); |
Patrick Delaunay | fea0345 | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 36 | ut_assert_console_end(); |
| 37 | |
| 38 | return 0; |
| 39 | } |
| 40 | |
| 41 | DM_TEST(dm_test_cmd_pinmux_status_pinname, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); |