tests: logging: log_api: Add test for LOG_PRINTK
Added test that validates CONFIG_LOG_PRINTK option where printk is redirected to logging. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
9302a0119f
commit
c5989c21aa
2 changed files with 43 additions and 0 deletions
|
@ -641,6 +641,31 @@ static void test_log_panic(void)
|
||||||
process_and_validate(false, true);
|
process_and_validate(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_log_printk(void)
|
||||||
|
{
|
||||||
|
if (!IS_ENABLED(CONFIG_LOG_PRINTK)) {
|
||||||
|
ztest_test_skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
log_timestamp_t exp_timestamp = TIMESTAMP_INIT_VAL;
|
||||||
|
|
||||||
|
log_setup(false);
|
||||||
|
|
||||||
|
mock_log_backend_record(&backend1, 0,
|
||||||
|
CONFIG_LOG_DOMAIN_ID, LOG_LEVEL_INTERNAL_RAW_STRING,
|
||||||
|
exp_timestamp++, "test 100");
|
||||||
|
printk("test %d", 100);
|
||||||
|
|
||||||
|
log_panic();
|
||||||
|
|
||||||
|
mock_log_backend_record(&backend1, 0,
|
||||||
|
CONFIG_LOG_DOMAIN_ID, LOG_LEVEL_INTERNAL_RAW_STRING,
|
||||||
|
exp_timestamp++, "test 101");
|
||||||
|
printk("test %d", 101);
|
||||||
|
|
||||||
|
process_and_validate(false, true);
|
||||||
|
}
|
||||||
|
|
||||||
/* Disable backends because same suite may be executed again but compiled by C++ */
|
/* Disable backends because same suite may be executed again but compiled by C++ */
|
||||||
static void log_api_suite_teardown(void *data)
|
static void log_api_suite_teardown(void *data)
|
||||||
{
|
{
|
||||||
|
@ -711,3 +736,4 @@ WRAP_TEST(test_log_arguments, TEST_SUFFIX)
|
||||||
WRAP_TEST(test_log_from_declared_module, TEST_SUFFIX)
|
WRAP_TEST(test_log_from_declared_module, TEST_SUFFIX)
|
||||||
WRAP_TEST(test_log_msg_dropped_notification, TEST_SUFFIX)
|
WRAP_TEST(test_log_msg_dropped_notification, TEST_SUFFIX)
|
||||||
WRAP_TEST(test_log_panic, TEST_SUFFIX)
|
WRAP_TEST(test_log_panic, TEST_SUFFIX)
|
||||||
|
WRAP_TEST(test_log_printk, TEST_SUFFIX)
|
||||||
|
|
|
@ -81,6 +81,16 @@ tests:
|
||||||
- CONFIG_LOG_MODE_DEFERRED=y
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
||||||
|
|
||||||
|
logging.log2_api_deferred_printk:
|
||||||
|
# FIXME:see #38041
|
||||||
|
platform_exclude: qemu_arc_hs6x
|
||||||
|
extra_configs:
|
||||||
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
|
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
||||||
|
- CONFIG_LOG_PRINTK=y
|
||||||
|
#When LOG_PRINTK is enabled, thread must process otherwise test output would be lost.
|
||||||
|
- CONFIG_LOG_PROCESS_THREAD=y
|
||||||
|
|
||||||
logging.log2_api_deferred_func_prefix:
|
logging.log2_api_deferred_func_prefix:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
platform_exclude: qemu_arc_hs6x
|
platform_exclude: qemu_arc_hs6x
|
||||||
|
@ -102,6 +112,13 @@ tests:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_LOG_MODE_IMMEDIATE=y
|
- CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
|
|
||||||
|
logging.log2_api_immediate_printk:
|
||||||
|
# FIXME: qemu_arc_hs6x excluded, see #38041
|
||||||
|
platform_exclude: qemu_arc_hs6x
|
||||||
|
extra_configs:
|
||||||
|
- CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
|
- CONFIG_LOG_PRINTK=y
|
||||||
|
|
||||||
logging.log2_api_immediate_rt_filter:
|
logging.log2_api_immediate_rt_filter:
|
||||||
# FIXME: qemu_arc_hs6x excluded, see #38041
|
# FIXME: qemu_arc_hs6x excluded, see #38041
|
||||||
platform_exclude: qemu_arc_hs6x
|
platform_exclude: qemu_arc_hs6x
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue