summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-11-27 11:20:58 +0100
committerTom Rini <trini@konsulko.com>2021-01-15 14:36:11 -0500
commit742346f6cc1d7053e95d26c82d235e00dd8c1e40 (patch)
tree902ade5e6ef58babe75fb7424c1d940b18fe83d3
parentbf80edb91a9b7d61621c1413c15495348f8f0fcc (diff)
downloadu-boot-742346f6cc1d7053e95d26c82d235e00dd8c1e40.tar.gz
test: log: add test for console output of dropped messages
Add a new test to check the content of the dropped messages sent to console puts function. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--test/log/log_test.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/log/log_test.c b/test/log/log_test.c
index 6bafc1e315..82234a6994 100644
--- a/test/log/log_test.c
+++ b/test/log/log_test.c
@@ -52,6 +52,7 @@ static int do_log_run(struct unit_test_state *uts, int cat, const char *file)
#define EXPECT_DIRECT BIT(1)
#define EXPECT_EXTRA BIT(2)
#define EXPECT_FORCE BIT(3)
+#define EXPECT_DEBUG BIT(4)
static int do_check_log_entries(struct unit_test_state *uts, int flags, int min,
int max)
@@ -63,6 +64,10 @@ static int do_check_log_entries(struct unit_test_state *uts, int flags, int min,
ut_assert_nextline("do_log_run() log %d", i);
if (flags & EXPECT_DIRECT)
ut_assert_nextline("func() _log %d", i);
+ if (flags & EXPECT_DEBUG) {
+ ut_assert_nextline("log %d", i);
+ ut_assert_nextline("_log %d", i);
+ }
}
if (flags & EXPECT_EXTRA)
for (; i <= LOGL_MAX ; i++)
@@ -71,6 +76,8 @@ static int do_check_log_entries(struct unit_test_state *uts, int flags, int min,
for (i = LOGL_FIRST; i < LOGL_COUNT; i++) {
if (flags & EXPECT_FORCE)
ut_assert_nextline("func() _log force %d", i);
+ if (flags & EXPECT_DEBUG)
+ ut_assert_nextline("_log force %d", i);
}
ut_assert_console_end();
@@ -413,6 +420,7 @@ int log_test_dropped(struct unit_test_state *uts)
log_run();
ut_asserteq(gd->log_drop_count, 3 * (LOGL_COUNT - LOGL_FIRST - 1));
+ check_log_entries_flags_levels(EXPECT_DEBUG, LOGL_FIRST, CONFIG_LOG_DEFAULT_LEVEL);
gd->flags |= GD_FLG_LOG_READY;
gd->log_drop_count = 0;