_log(log_uc_cat(cat), i, file, 100 + i, "func", "_log %d\n",
i);
}
+ /* test with LOGL_COUNT flag */
+ for (i = LOGL_FIRST; i < LOGL_COUNT; i++) {
+ _log(log_uc_cat(cat), i | LOGL_FORCE_DEBUG, file, 100 + i,
+ "func", "_log force %d\n", i);
+ }
gd->log_fmt = log_get_default_format();
return 0;
#define EXPECT_LOG BIT(0)
#define EXPECT_DIRECT BIT(1)
#define EXPECT_EXTRA BIT(2)
+#define EXPECT_FORCE BIT(3)
static int do_check_log_entries(struct unit_test_state *uts, int flags, int min,
int max)
for (; i <= LOGL_MAX ; i++)
ut_assert_nextline("func() _log %d", i);
+ for (i = LOGL_FIRST; i < LOGL_COUNT; i++) {
+ if (flags & EXPECT_FORCE)
+ ut_assert_nextline("func() _log force %d", i);
+ }
+
ut_assert_console_end();
return 0;
}
#define check_log_entries_flags(flags) \
check_log_entries_flags_levels(flags, LOGL_FIRST, _LOG_MAX_LEVEL)
-#define check_log_entries() check_log_entries_flags(EXPECT_LOG | EXPECT_DIRECT)
+#define check_log_entries() check_log_entries_flags(EXPECT_LOG | EXPECT_DIRECT | EXPECT_FORCE)
#define check_log_entries_extra() \
- check_log_entries_flags(EXPECT_LOG | EXPECT_DIRECT | EXPECT_EXTRA)
-#define check_log_entries_none() check_log_entries_flags(0)
+ check_log_entries_flags(EXPECT_LOG | EXPECT_DIRECT | EXPECT_EXTRA | EXPECT_FORCE)
+#define check_log_entries_none() check_log_entries_flags(EXPECT_FORCE)
/* Check a category filter using the first category */
int log_test_cat_allow(struct unit_test_state *uts)
ut_assertok(console_record_reset_enable());
log_run_file("file");
- check_log_entries_flags(EXPECT_DIRECT | EXPECT_EXTRA);
+ check_log_entries_flags(EXPECT_DIRECT | EXPECT_EXTRA | EXPECT_FORCE);
ut_assertok(console_record_reset_enable());
log_run_file("file2");
ut_assertok(console_record_reset_enable());
log_run_file("file2");
- check_log_entries_flags(EXPECT_DIRECT | EXPECT_EXTRA);
+ check_log_entries_flags(EXPECT_DIRECT | EXPECT_EXTRA | EXPECT_FORCE);
ut_assertok(log_remove_filter("console", filt));
return 0;
ut_assertok(console_record_reset_enable());
log_run();
- check_log_entries_flags_levels(EXPECT_LOG | EXPECT_DIRECT, LOGL_FIRST,
- LOGL_WARNING);
+ check_log_entries_flags_levels(EXPECT_LOG | EXPECT_DIRECT | EXPECT_FORCE,
+ LOGL_FIRST, LOGL_WARNING);
ut_assertok(log_remove_filter("console", filt));
return 0;
ut_assertok(console_record_reset_enable());
log_run();
- check_log_entries_flags_levels(EXPECT_LOG | EXPECT_DIRECT,
+ check_log_entries_flags_levels(EXPECT_LOG | EXPECT_DIRECT | EXPECT_FORCE,
LOGL_WARNING + 1, _LOG_MAX_LEVEL);
ut_assertok(log_remove_filter("console", filt1));
ut_assertok(console_record_reset_enable());
log_run();
- check_log_entries_flags_levels(EXPECT_LOG | EXPECT_DIRECT,
+ check_log_entries_flags_levels(EXPECT_LOG | EXPECT_DIRECT | EXPECT_FORCE,
LOGL_WARNING, LOGL_INFO - 1);
ut_assertok(log_remove_filter("console", filt1));