test: dm: add button_cmd test
PATCH 1/1 test: dm: add button_cmd test
Add a test for the button_cmd feature. This validates that commands can be mapped to two buttons, that the correct command runs based on which button is pressed, that only 1 command is run, and that no command runs if button_cmd_0_name is wrong or unset.
CONFIG_BUTTON is now enabled automatically and was removed when running save_defconfig.
--- configs/sandbox_defconfig | 2 +- test/dm/button.c | 96 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-)
configs/sandbox_defconfig +1 -1
@@ -10,6 +10,7 @@ CONFIG_PCI=y CONFIG_DEBUG_UART=y CONFIG_SYS_MEMTEST_START=0x00100000 CONFIG_SYS_MEMTEST_END=0x00101000 +CONFIG_BUTTON_CMD=y CONFIG_FIT=y CONFIG_FIT_RSASSA_PSS=y CONFIG_FIT_CIPHER=y
@@ -166,7 +167,6 @@ CONFIG_DM_BOOTCOUNT=y CONFIG_DM_BOOTCOUNT_RTC=y CONFIG_DM_BOOTCOUNT_I2C_EEPROM=y CONFIG_DM_BOOTCOUNT_SYSCON=y -CONFIG_BUTTON=y CONFIG_BUTTON_ADC=y CONFIG_BUTTON_GPIO=y CONFIG_CLK=y
test/dm/button.c +96 -0
99 lines not on this page · raw message
Signature · 1 line
2.43.1
Quoted 9 lines · Caleb Connolly
Add a test for the
button_cmdfeature. This validates that commands can be mapped to two buttons, that the correct command runs based on which button is pressed, that only 1 command is run, and that no command runs ifbutton_cmd_0_nameis wrong or unset.
CONFIG_BUTTONis now enabled automatically and was removed when runningsave_defconfig.Signed-off-by Caleb Connolly <[email protected]>
Locally this fails:
========================================== FAILURES =========================================== ______________________________ test_ut[ut_dm_dm_test_button_cmd] ______________________________ test/py/u_boot_spawn.py:195: in expect
c = os.read(self.fd, 1024).decode(errors='replace')
E OSError: [Errno 5] Input/output error
During handling of the above exception, another exception occurred:test/py/tests/test_ut.py:509: in test_ut
output = u_boot_console.run_command('ut ' + ut_subtest)test/py/u_boot_console_base.py:266: in run_command
m = self.p.expect([self.prompt_compiled] + self.bad_patterns)test/py/u_boot_spawn.py:204: in expect
raise ValueError('U-Boot exited with %s' % info)
E ValueError: U-Boot exited with signal 11 (SIGSEGV)
------------------------------------ Captured stdout call ------------------------------------- => ut dm dm_test_button_cmd
Test: dm_test_button_cmd: button.c
BTN 'button1'> env set test_button_cmds_0 PASS
BTN 'button1'> env set test_button_cmds_0 PASS
BTN 'button2'> env set test_button_cmds_1 PASS =================================== short test summary info =================================== FAILED test/py/tests/test_ut.py::test_ut[ut_dm_dm_test_button_cmd] - ValueError: U-Boot exit...
On top of current master.
Signature · 1 line
Tom