aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Anderson <seanga2@gmail.com>2020-10-27 19:55:31 -0400
committerTom Rini <trini@konsulko.com>2020-10-30 10:55:26 -0400
commit122730440055bb3b4f047f88be61a45ef7fe1a65 (patch)
tree4bc55d56067da09a0370e0bfcf8d84fd91f68b41
parent40455a6915e1f08e74a71d5c859ef93b6d815899 (diff)
downloadu-boot-122730440055bb3b4f047f88be61a45ef7fe1a65.zip
u-boot-122730440055bb3b4f047f88be61a45ef7fe1a65.tar.gz
u-boot-122730440055bb3b4f047f88be61a45ef7fe1a65.tar.bz2
test: Add test for LOGFF_MIN
This tests log filters matching on a minimum level. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--test/log/log_test.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/log/log_test.c b/test/log/log_test.c
index e4ab999..ea4fc6b 100644
--- a/test/log/log_test.c
+++ b/test/log/log_test.c
@@ -359,3 +359,26 @@ int log_test_level_deny(struct unit_test_state *uts)
return 0;
}
LOG_TEST_FLAGS(log_test_level_deny, UT_TESTF_CONSOLE_REC);
+
+/* Check matching based on minimum level */
+int log_test_min(struct unit_test_state *uts)
+{
+ int filt1, filt2;
+
+ filt1 = log_add_filter_flags("console", NULL, LOGL_WARNING, NULL,
+ LOGFF_LEVEL_MIN);
+ ut_assert(filt1 >= 0);
+ filt2 = log_add_filter_flags("console", NULL, LOGL_INFO, NULL,
+ LOGFF_DENY | LOGFF_LEVEL_MIN);
+ ut_assert(filt2 >= 0);
+
+ ut_assertok(console_record_reset_enable());
+ log_run();
+ check_log_entries_flags_levels(EXPECT_LOG | EXPECT_DIRECT,
+ LOGL_WARNING, LOGL_INFO - 1);
+
+ ut_assertok(log_remove_filter("console", filt1));
+ ut_assertok(log_remove_filter("console", filt2));
+ return 0;
+}
+LOG_TEST_FLAGS(log_test_min, UT_TESTF_CONSOLE_REC);