diff mbox series

[2/2] test: bootm: Ensure GD_FLG_SILENT is reset

Message ID 20241101130254.473017-3-andrew.goodbody@linaro.org
State Accepted
Commit 931e0df6042540ecee00486256a88b220e2cab2a
Headers show
Series Fixes to allow 'ut bootm' to pass when run interactively | expand

Commit Message

Andrew Goodbody Nov. 1, 2024, 1:02 p.m. UTC
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>
---

 test/bootm.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Simon Glass Nov. 20, 2024, 3:33 p.m. UTC | #1
On Fri, 1 Nov 2024 at 07:03, Andrew Goodbody <andrew.goodbody@linaro.org> wrote:
>
> 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>
> ---
>
>  test/bootm.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>


>
> diff --git a/test/bootm.c b/test/bootm.c
> index 5f57ecb337..52b83f149c 100644
> --- a/test/bootm.c
> +++ b/test/bootm.c
> @@ -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);
> --
> 2.39.5
>
diff mbox series

Patch

diff --git a/test/bootm.c b/test/bootm.c
index 5f57ecb337..52b83f149c 100644
--- a/test/bootm.c
+++ b/test/bootm.c
@@ -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);