diff options
author | Tom Rini <trini@konsulko.com> | 2024-11-04 14:49:10 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-11-04 14:49:10 -0600 |
commit | a2bed7d8a6997697b54eb75fe59e56edde449314 (patch) | |
tree | 93ee7198ae539b3f6a2f87ce1312787bad91a12d | |
parent | c42250178031af109817a74117e90181ad13e084 (diff) | |
parent | 931e0df6042540ecee00486256a88b220e2cab2a (diff) |
Merge patch series "Fixes to allow 'ut bootm' to pass when run interactively"
Andrew Goodbody <andrew.goodbody@linaro.org> says:
Starting a sandbox session and running 'ut bootm' on the command
line instead of using pytest with --verbose will result in some
test failures. This series makes the tests more deterministic so
that they will better control their environment and hence will
work as expected whether or not they are invoked with '--verbose'.
The series starts with a small fix to the parameters of
bootm_process_cmdline that one commit incorrectly added using a bool
when it had been updated to take flags by the preceeding commit.
Link: https://lore.kernel.org/r/20241101130254.473017-1-andrew.goodbody@linaro.org
-rw-r--r-- | test/bootm.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/test/bootm.c b/test/bootm.c index 26c15552bf6..52b83f149cb 100644 --- a/test/bootm.c +++ b/test/bootm.c @@ -26,12 +26,15 @@ static int bootm_test_nop(struct unit_test_state *uts) { char buf[BUF_SIZE]; + /* This tests relies on GD_FLG_SILENT not being set */ + gd->flags &= ~GD_FLG_SILENT; + *buf = '\0'; - ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, true)); + ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_ALL)); ut_asserteq_str("", buf); strcpy(buf, "test"); - ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, true)); + ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_ALL)); ut_asserteq_str("test", buf); return 0; @@ -43,23 +46,26 @@ static int bootm_test_nospace(struct unit_test_state *uts) { char buf[BUF_SIZE]; + /* This tests relies on GD_FLG_SILENT not being set */ + gd->flags &= ~GD_FLG_SILENT; + /* Zero buffer size */ *buf = '\0'; - ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, 0, true)); + ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, 0, BOOTM_CL_ALL)); /* Buffer string not terminated */ memset(buf, 'a', BUF_SIZE); - ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, BUF_SIZE, true)); + ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_ALL)); /* Not enough space to copy string */ memset(buf, '\0', BUF_SIZE); memset(buf, 'a', BUF_SIZE / 2); - ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, BUF_SIZE, true)); + ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_ALL)); /* Just enough space */ memset(buf, '\0', BUF_SIZE); memset(buf, 'a', BUF_SIZE / 2 - 1); - ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, true)); + ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_ALL)); return 0; } @@ -70,6 +76,9 @@ static int bootm_test_silent(struct unit_test_state *uts) { char buf[BUF_SIZE]; + /* This tests relies on GD_FLG_SILENT not being set */ + gd->flags &= ~GD_FLG_SILENT; + /* 'silent_linux' not set should do nothing */ env_set("silent_linux", NULL); strcpy(buf, CONSOLE_STR); |