From ef7e264944a21c0a78378bf4d28db5bcacbc5b45 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 8 Nov 2020 21:08:43 -0700 Subject: test: Avoid assuming sandbox board for bloblist test 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 Signed-off-by: Simon Glass --- test/ut.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/ut.c') diff --git a/test/ut.c b/test/ut.c index 95bdd66de6..44ed1ba2d3 100644 --- a/test/ut.c +++ b/test/ut.c @@ -8,6 +8,9 @@ #include #include #include +#ifdef CONFIG_SANDBOX +#include +#endif #include #include @@ -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); +} -- cgit v1.2.3