diff --git a/tests/subsys/logging/log_core_additional/log_user.conf b/tests/subsys/logging/log_core_additional/log_user.conf index ae3240c0e21..1f1c1609934 100644 --- a/tests/subsys/logging/log_core_additional/log_user.conf +++ b/tests/subsys/logging/log_core_additional/log_user.conf @@ -5,9 +5,11 @@ CONFIG_TEST_LOGGING_DEFAULTS=n CONFIG_LOG=y CONFIG_LOG_OUTPUT=y CONFIG_LOG_RUNTIME_FILTERING=y +CONFIG_LOG_ALWAYS_RUNTIME=y CONFIG_LOG_PROCESS_THREAD=n CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD=1 CONFIG_THREAD_MONITOR=y -CONFIG_LOG_PRINTK=y +CONFIG_LOG_PRINTK=n CONFIG_LOG_BLOCK_IN_THREAD=y CONFIG_MAIN_STACK_SIZE=4096 +CONFIG_STACK_SENTINEL=n diff --git a/tests/subsys/logging/log_core_additional/src/log_test.c b/tests/subsys/logging/log_core_additional/src/log_test.c index 2479cbe59f6..5dcc783ca22 100644 --- a/tests/subsys/logging/log_core_additional/src/log_test.c +++ b/tests/subsys/logging/log_core_additional/src/log_test.c @@ -20,6 +20,7 @@ #include #include #include +#include #define TEST_MESSAGE "test msg" @@ -33,6 +34,18 @@ ZTEST_BMEM uint32_t source_id; ZTEST_BMEM uint8_t domain, level; ZTEST_DMEM uint32_t msg_data = 0x1234; +/* Memory domain for tests with threads in user space (ZTEST_USER) */ +#if CONFIG_USERSPACE +static struct k_mem_domain mem_domain; +static struct k_mem_partition *mem_parts[] = { +#if Z_LIBC_PARTITION_EXISTS + &z_libc_partition, +#endif + &ztest_mem_partition, + &k_log_partition +}; +#endif + static uint8_t buf; static int char_out(uint8_t *data, size_t length, void *ctx) { @@ -571,6 +584,12 @@ static void *test_log_core_additional_setup(void) #ifdef CONFIG_LOG_PROCESS_THREAD k_thread_foreach(promote_log_thread, NULL); #endif + +#if CONFIG_USERSPACE + /* Set memory domain for threads in user space */ + k_mem_domain_init(&mem_domain, ARRAY_SIZE(mem_parts), mem_parts); + k_mem_domain_add_thread(&mem_domain, k_current_get()); +#endif return NULL; } diff --git a/tests/subsys/logging/log_core_additional/testcase.yaml b/tests/subsys/logging/log_core_additional/testcase.yaml index 3fc9db4902a..3ce2648b26d 100644 --- a/tests/subsys/logging/log_core_additional/testcase.yaml +++ b/tests/subsys/logging/log_core_additional/testcase.yaml @@ -14,3 +14,11 @@ tests: extra_args: CONF_FILE=log_thread.conf integration_platforms: - native_sim + logging.log_user: + tags: logging + filter: CONFIG_USERSPACE + extra_args: + - CONF_FILE=log_user.conf + - USERSPACE_TEST=1 + integration_platforms: + - qemu_x86