test: bootm: Ensure GD_FLG_SILENT is reset

Some bootm tests expect that GD_FLG_SILENT is reset in order
to work as expected. This is the state if the test is run with
'pytest --verbose' but not if run from, say, the sandbox command
line.
So reset the flag for those tests that rely on it being reset. This
has to be done in each test as the test infrastructure will set it
again before every test when not invoked with 'pytest --verbose'.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
This commit is contained in:
Andrew Goodbody 2024-11-01 13:02:54 +00:00 committed by Tom Rini
parent 66ca6622ee
commit 931e0df604

View File

@ -26,6 +26,9 @@ 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, BOOTM_CL_ALL));
ut_asserteq_str("", buf);
@ -43,6 +46,9 @@ 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, BOOTM_CL_ALL));
@ -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);