ztest: add userspace tests to base tests

Add a test that verifies that ZTEST_USER is actually being run in
user context.

Signed-off-by: Yuval Peress <peress@google.com>
This commit is contained in:
Yuval Peress 2022-04-13 00:07:57 -06:00 committed by Anas Nashif
commit 395bbb5122
3 changed files with 23 additions and 0 deletions

View file

@ -11,4 +11,6 @@ else()
project(base)
target_sources(app PRIVATE src/main.c)
target_sources_ifdef(CONFIG_USERSPACE app PRIVATE src/main_userspace.c)
endif()

View file

@ -0,0 +1,13 @@
/*
* Copyright (c) 2022 Google Inc
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <kernel.h>
#include <ztest.h>
ZTEST_USER(framework_tests, test_userspace_is_user)
{
zassert_true(k_is_user_context(), NULL);
}

View file

@ -7,6 +7,14 @@ tests:
tags: test_framework
integration_platforms:
- native_posix
testing.ztest.base.verbose_0_userspace:
filter: CONFIG_ARCH_HAS_USERSPACE
extra_args: CONF_FILE=prj_verbose_0.conf
tags: test_framework userspace
extra_configs:
- CONFIG_TEST_USERSPACE=y
integration_platforms:
- native_posix
testing.ztest.base.verbose_1:
extra_args: CONF_FILE=prj_verbose_1.conf
tags: test_framework