diff options
| author | Tom Rini <trini@konsulko.com> | 2024-10-15 09:18:04 -0600 |
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2024-10-15 11:38:44 -0600 |
| commit | 4378732d5658accd07d2fb245417262a23f578ce (patch) | |
| tree | 06b50e26d4b1582fb4c00393e83b4ede06537fa6 /test | |
| parent | 4f777c2ef20ad294af1d3447baf7dfffb7514ab3 (diff) | |
| parent | 87980311fbb64369c29d8725fc8fb4fb35ae2f3c (diff) | |
Merge patch series to add a "fallback" keyword to extlinux.conf parsing
This series from Martyn Welch <martyn.welch@collabora.com> adds the
ability to have a "fallback" option in extlinux.conf parsing, which can
be in turn used in A/B style update mechanisms.
Link: https://lore.kernel.org/u-boot/20241009131548.929439-1-martyn.welch@collabora.com/
Diffstat (limited to 'test')
| -rw-r--r-- | test/boot/bootmeth.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/boot/bootmeth.c b/test/boot/bootmeth.c index 518d99c4a27..18ae6d7fe13 100644 --- a/test/boot/bootmeth.c +++ b/test/boot/bootmeth.c @@ -127,6 +127,53 @@ static int bootmeth_cmd_order_glob(struct unit_test_state *uts) } BOOTSTD_TEST(bootmeth_cmd_order_glob, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE); +/* Check 'bootmeth set' command */ +static int bootmeth_cmd_set(struct unit_test_state *uts) +{ + /* Check we can enable extlinux fallback */ + console_record_reset_enable(); + ut_assertok(run_command("bootmeth set extlinux fallback 1", 0)); + ut_assert_console_end(); + + /* Check we can disable extlinux fallback */ + console_record_reset_enable(); + ut_assertok(run_command("bootmeth set extlinux fallback 0", 0)); + ut_assert_console_end(); + + /* Check extlinux fallback unexpected value */ + console_record_reset_enable(); + ut_asserteq(1, run_command("bootmeth set extlinux fallback fred", 0)); + ut_assert_nextline("Unexpected value 'fred'"); + ut_assert_nextline("Failed (err=-22)"); + ut_assert_console_end(); + + /* Check that we need to provide right number of parameters */ + ut_asserteq(1, run_command("bootmeth set extlinux fallback", 0)); + ut_assert_nextline("Required parameters not provided"); + ut_assert_console_end(); + + /* Check that we need to provide a valid bootmethod */ + ut_asserteq(1, run_command("bootmeth set fred fallback 0", 0)); + ut_assert_nextline("Unknown bootmeth 'fred'"); + ut_assert_nextline("Failed (err=-19)"); + ut_assert_console_end(); + + /* Check that we need to provide a valid property */ + ut_asserteq(1, run_command("bootmeth set extlinux fred 0", 0)); + ut_assert_nextline("Invalid option"); + ut_assert_nextline("Failed (err=-22)"); + ut_assert_console_end(); + + /* Check that we need to provide a bootmeth that supports properties */ + ut_asserteq(1, run_command("bootmeth set efi fallback 0", 0)); + ut_assert_nextline("set_property not found"); + ut_assert_nextline("Failed (err=-19)"); + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(bootmeth_cmd_set, UTF_DM | UTF_SCAN_FDT); + /* Check 'bootmeths' env var */ static int bootmeth_env(struct unit_test_state *uts) { |
