aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt2022-07-11 08:21:30 +0200
committerSimon Glass2022-07-26 02:30:56 -0600
commit59ec024e563c9faab52f1c86736102562201c5fc (patch)
treebf3a0569defa5b33c331922c1a949f9df493b0f4
parent53fbaa4a4ae1dde1f83b2dda39ccf70a0b69373d (diff)
test: fix log tests
Consider CONFIG_LOG_MAX_LEVEL and gd->default_log_level in * do_log_test_helpers() * log_test_dropped() * log_test_level_deny() Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--test/log/log_test.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/log/log_test.c b/test/log/log_test.c
index db7170f3042..c5abff80d11 100644
--- a/test/log/log_test.c
+++ b/test/log/log_test.c
@@ -277,7 +277,7 @@ int do_log_test_helpers(struct unit_test_state *uts)
log_content("level %d\n", LOGL_DEBUG_CONTENT);
log_io("level %d\n", LOGL_DEBUG_IO);
- for (i = LOGL_EMERG; i <= _LOG_MAX_LEVEL; i++)
+ for (i = LOGL_EMERG; i <= gd->default_log_level; i++)
ut_assert_nextline("%*s() level %d", CONFIG_LOGF_FUNC_PAD,
__func__, i);
ut_assert_console_end();
@@ -381,7 +381,8 @@ int log_test_level_deny(struct unit_test_state *uts)
ut_assertok(console_record_reset_enable());
log_run();
check_log_entries_flags_levels(EXPECT_LOG | EXPECT_DIRECT | EXPECT_FORCE,
- LOGL_WARNING + 1, _LOG_MAX_LEVEL);
+ LOGL_WARNING + 1,
+ min(gd->default_log_level, LOGL_INFO));
ut_assertok(log_remove_filter("console", filt1));
ut_assertok(log_remove_filter("console", filt2));
@@ -420,9 +421,11 @@ int log_test_dropped(struct unit_test_state *uts)
gd->log_drop_count = 0;
ut_assertok(console_record_reset_enable());
- log_run();
- ut_asserteq(gd->log_drop_count, 3 * (LOGL_COUNT - LOGL_FIRST - 1));
+ log_run();
+ ut_asserteq(2 * (LOGL_COUNT - LOGL_FIRST) +
+ _LOG_MAX_LEVEL - LOGL_FIRST + 1,
+ gd->log_drop_count);
check_log_entries_flags_levels(EXPECT_DEBUG, LOGL_FIRST, CONFIG_LOG_DEFAULT_LEVEL);
gd->flags |= GD_FLG_LOG_READY;