diff --git a/tests/subsys/logging/log_api/src/test.inc b/tests/subsys/logging/log_api/src/test.inc index cf932cc5353..edcde375148 100644 --- a/tests/subsys/logging/log_api/src/test.inc +++ b/tests/subsys/logging/log_api/src/test.inc @@ -641,6 +641,31 @@ static void test_log_panic(void) 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++ */ 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_msg_dropped_notification, TEST_SUFFIX) WRAP_TEST(test_log_panic, TEST_SUFFIX) +WRAP_TEST(test_log_printk, TEST_SUFFIX) diff --git a/tests/subsys/logging/log_api/testcase.yaml b/tests/subsys/logging/log_api/testcase.yaml index eae6bcb26dd..4bbfbbea82a 100644 --- a/tests/subsys/logging/log_api/testcase.yaml +++ b/tests/subsys/logging/log_api/testcase.yaml @@ -81,6 +81,16 @@ tests: - CONFIG_LOG_MODE_DEFERRED=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: # FIXME:see #38041 platform_exclude: qemu_arc_hs6x @@ -102,6 +112,13 @@ tests: extra_configs: - 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: # FIXME: qemu_arc_hs6x excluded, see #38041 platform_exclude: qemu_arc_hs6x