* [PATCH 1/2] test: Avoid assuming sandbox board for bloblist test
@ 2020-11-09 4:08 Simon Glass
2020-11-09 4:08 ` [PATCH 2/2] test: Only enable bloblist test when supported Simon Glass
0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2020-11-09 4:08 UTC (permalink / raw)
To: u-boot
This tests assumes it is running on sandbox. Add a few functions to handle
silencing the console on any board and use those instead.
Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
include/test/ut.h | 18 ++++++++++++++++++
test/bloblist.c | 13 ++++---------
test/ut.c | 18 ++++++++++++++++++
3 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/include/test/ut.h b/include/test/ut.h
index 3f2ee7514b8..17400c73ea9 100644
--- a/include/test/ut.h
+++ b/include/test/ut.h
@@ -338,4 +338,22 @@ ulong ut_check_free(void);
*/
long ut_check_delta(ulong last);
+/**
+ * ut_silence_console() - Silence the console if requested by the user
+ *
+ * This stops test output from appear on the console. It is the default on
+ * sandbox, unless the -v flag is given. For other boards, this does nothing.
+ *
+ * @uts: Test state (in case in future we want to keep state here)
+ */
+void ut_silence_console(struct unit_test_state *uts);
+
+/**
+ * ut_unsilence_console() - Unsilence the console after a test
+ *
+ * This restarts console output again and turns off console recording. This
+ * happens on all boards, including sandbox.
+ */
+void ut_unsilence_console(struct unit_test_state *uts);
+
#endif
diff --git a/test/bloblist.c b/test/bloblist.c
index 0bb9e2d81e7..900299dd68e 100644
--- a/test/bloblist.c
+++ b/test/bloblist.c
@@ -7,7 +7,6 @@
#include <bloblist.h>
#include <log.h>
#include <mapmem.h>
-#include <asm/state.h>
#include <test/suites.h>
#include <test/test.h>
#include <test/ut.h>
@@ -240,7 +239,6 @@ BLOBLIST_TEST(bloblist_test_checksum, 0);
/* Test the 'bloblist info' command */
static int bloblist_test_cmd_info(struct unit_test_state *uts)
{
- struct sandbox_state *state = state_get_current();
struct bloblist_hdr *hdr;
char *data, *data2;
@@ -250,8 +248,7 @@ static int bloblist_test_cmd_info(struct unit_test_state *uts)
data2 = bloblist_ensure(TEST_TAG2, TEST_SIZE2);
console_record_reset_enable();
- if (!state->show_test_output)
- gd->flags |= GD_FLG_SILENT;
+ ut_silence_console(uts);
console_record_reset();
run_command("bloblist info", 0);
ut_assert_nextline("base: %lx", (ulong)map_to_sysmem(hdr));
@@ -259,7 +256,7 @@ static int bloblist_test_cmd_info(struct unit_test_state *uts)
ut_assert_nextline("alloced: 70 112 Bytes");
ut_assert_nextline("free: 390 912 Bytes");
ut_assert_console_end();
- gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD);
+ ut_unsilence_console(uts);
return 0;
}
@@ -268,7 +265,6 @@ BLOBLIST_TEST(bloblist_test_cmd_info, 0);
/* Test the 'bloblist list' command */
static int bloblist_test_cmd_list(struct unit_test_state *uts)
{
- struct sandbox_state *state = state_get_current();
struct bloblist_hdr *hdr;
char *data, *data2;
@@ -278,8 +274,7 @@ static int bloblist_test_cmd_list(struct unit_test_state *uts)
data2 = bloblist_ensure(TEST_TAG2, TEST_SIZE2);
console_record_reset_enable();
- if (!state->show_test_output)
- gd->flags |= GD_FLG_SILENT;
+ ut_silence_console(uts);
console_record_reset();
run_command("bloblist list", 0);
ut_assert_nextline("Address Size Tag Name");
@@ -288,7 +283,7 @@ static int bloblist_test_cmd_list(struct unit_test_state *uts)
ut_assert_nextline("%08lx %8x 2 SPL hand-off",
(ulong)map_to_sysmem(data2), TEST_SIZE2);
ut_assert_console_end();
- gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD);
+ ut_unsilence_console(uts);
return 0;
}
diff --git a/test/ut.c b/test/ut.c
index 95bdd66de6a..44ed1ba2d31 100644
--- a/test/ut.c
+++ b/test/ut.c
@@ -8,6 +8,9 @@
#include <common.h>
#include <console.h>
#include <malloc.h>
+#ifdef CONFIG_SANDBOX
+#include <asm/state.h>
+#endif
#include <test/test.h>
#include <test/ut.h>
@@ -114,3 +117,18 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes)
return upto == total_bytes ? 0 : 1;
}
+
+void ut_silence_console(struct unit_test_state *uts)
+{
+#ifdef CONFIG_SANDBOX
+ struct sandbox_state *state = state_get_current();
+
+ if (!state->show_test_output)
+ gd->flags |= GD_FLG_SILENT;
+#endif
+}
+
+void ut_unsilence_console(struct unit_test_state *uts)
+{
+ gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD);
+}
--
2.29.2.222.g5d2a92d10f8-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] test: Only enable bloblist test when supported
2020-11-09 4:08 [PATCH 1/2] test: Avoid assuming sandbox board for bloblist test Simon Glass
@ 2020-11-09 4:08 ` Simon Glass
2020-11-09 7:42 ` Heinrich Schuchardt
0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2020-11-09 4:08 UTC (permalink / raw)
To: u-boot
This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.
Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
test/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/test/Makefile b/test/Makefile
index 1c930b31485..cdbfa61cda3 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -2,7 +2,9 @@
#
# (C) Copyright 2012 The Chromium Authors
+ifneq ($(CONFIG_$(SPL_)BLOBLIST),)
obj-$(CONFIG_$(SPL_)CMDLINE) += bloblist.o
+endif
obj-$(CONFIG_$(SPL_)CMDLINE) += cmd/
obj-$(CONFIG_$(SPL_)CMDLINE) += cmd_ut.o
obj-$(CONFIG_$(SPL_)CMDLINE) += command_ut.o
--
2.29.2.222.g5d2a92d10f8-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] test: Only enable bloblist test when supported
2020-11-09 4:08 ` [PATCH 2/2] test: Only enable bloblist test when supported Simon Glass
@ 2020-11-09 7:42 ` Heinrich Schuchardt
2020-11-11 14:31 ` Simon Glass
0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2020-11-09 7:42 UTC (permalink / raw)
To: u-boot
On 09.11.20 05:08, Simon Glass wrote:
> This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
> that condition.
>
> Reported-by: Kever Yang <kever.yang@rock-chips.com>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> test/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/test/Makefile b/test/Makefile
> index 1c930b31485..cdbfa61cda3 100644
> --- a/test/Makefile
> +++ b/test/Makefile
> @@ -2,7 +2,9 @@
> #
> # (C) Copyright 2012 The Chromium Authors
>
> +ifneq ($(CONFIG_$(SPL_)BLOBLIST),)
> obj-$(CONFIG_$(SPL_)CMDLINE) += bloblist.o
> +endif
> obj-$(CONFIG_$(SPL_)CMDLINE) += cmd/
> obj-$(CONFIG_$(SPL_)CMDLINE) += cmd_ut.o
> obj-$(CONFIG_$(SPL_)CMDLINE) += command_ut.o
>
This patch conflicts with my patch
[1/1] test: test/bloblist.c depends on asm/state.h
https://patchwork.ozlabs.org/project/uboot/patch/20201031073806.30736-1-xypron.glpk at gmx.de/
It seems that my patch is obsoleted by the first patch of Kever's series:
test: Avoid assuming sandbox board for bloblist test
https://patchwork.ozlabs.org/project/uboot/patch/20201108210834.1.I08cec35c8482583834811d48894f358277c662aa at changeid/
Best regards
Heinrich
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] test: Only enable bloblist test when supported
2020-11-09 7:42 ` Heinrich Schuchardt
@ 2020-11-11 14:31 ` Simon Glass
0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2020-11-11 14:31 UTC (permalink / raw)
To: u-boot
Hi Heinrich,
On Mon, 9 Nov 2020 at 00:42, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 09.11.20 05:08, Simon Glass wrote:
> > This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
> > that condition.
> >
> > Reported-by: Kever Yang <kever.yang@rock-chips.com>
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> > test/Makefile | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/test/Makefile b/test/Makefile
> > index 1c930b31485..cdbfa61cda3 100644
> > --- a/test/Makefile
> > +++ b/test/Makefile
> > @@ -2,7 +2,9 @@
> > #
> > # (C) Copyright 2012 The Chromium Authors
> >
> > +ifneq ($(CONFIG_$(SPL_)BLOBLIST),)
> > obj-$(CONFIG_$(SPL_)CMDLINE) += bloblist.o
> > +endif
> > obj-$(CONFIG_$(SPL_)CMDLINE) += cmd/
> > obj-$(CONFIG_$(SPL_)CMDLINE) += cmd_ut.o
> > obj-$(CONFIG_$(SPL_)CMDLINE) += command_ut.o
> >
>
> This patch conflicts with my patch
>
> [1/1] test: test/bloblist.c depends on asm/state.h
> https://patchwork.ozlabs.org/project/uboot/patch/20201031073806.30736-1-xypron.glpk at gmx.de/
>
> It seems that my patch is obsoleted by the first patch of Kever's series:
>
> test: Avoid assuming sandbox board for bloblist test
> https://patchwork.ozlabs.org/project/uboot/patch/20201108210834.1.I08cec35c8482583834811d48894f358277c662aa at changeid/
I believe your patch was already applied, so there should not be a
patch conflict.
Yes there was a request to be able to run the test on boards other
than sandbox. I think we should try to do that if possible.
Regards,
Simon
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-11 14:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-09 4:08 [PATCH 1/2] test: Avoid assuming sandbox board for bloblist test Simon Glass
2020-11-09 4:08 ` [PATCH 2/2] test: Only enable bloblist test when supported Simon Glass
2020-11-09 7:42 ` Heinrich Schuchardt
2020-11-11 14:31 ` Simon Glass
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.