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:
parent
900b6723e7
commit
395bbb5122
3 changed files with 23 additions and 0 deletions
|
@ -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()
|
||||
|
|
13
tests/ztest/base/src/main_userspace.c
Normal file
13
tests/ztest/base/src/main_userspace.c
Normal 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);
|
||||
}
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue