Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sanitycheck: CONFIG_TEST_USERSPACE / userspace tag cleanup #16466

Merged
merged 1 commit into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion kernel/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ k_tid_t z_impl_k_thread_create(struct k_thread *new_thread,
/* Special case, only for unit tests */
#if defined(CONFIG_TEST) && defined(CONFIG_ARCH_HAS_USERSPACE) && !defined(CONFIG_USERSPACE)
__ASSERT((options & K_USER) == 0,
"Platform is capable of user mode, and test thread created with K_USER option, but CONFIG_TEST_USERSPACE or CONFIG_USERSPACE is not set\n");
"Platform is capable of user mode, and test thread created with K_USER option,"
" but neither CONFIG_TEST_USERSPACE nor CONFIG_USERSPACE is set\n");
#endif

z_setup_new_thread(new_thread, stack, stack_size, entry, p1, p2, p3,
Expand Down
13 changes: 8 additions & 5 deletions subsys/testsuite/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,19 @@ config TEST_USERSPACE
bool "Indicate that this test exercises user mode"
help
This option indicates that a test case puts threads in user mode,
and that the build system should enable userspace if the platform
supports it. It should be set on a per-test basis.
and that the build system will [override and] enable USERSPACE
if the platform supports it. It should be set in a .conf file on
a per-test basis and is not meant to be used outside test cases.
Tests with this option should also have the "userspace" filtering
tag in their testcase.yaml file.

The userspace APIs are no-ops if userspace is not enabled, so it is
OK to enable this even if the test will run on platforms which do
not support userspace. The test should still run on those platforms,
just with all threads in supervisor mode.

If a test *requires* that userspace be enabled in order to
function, CONFIG_ARCH_HAS_USERSPACE should be filtered in its
pass, CONFIG_ARCH_HAS_USERSPACE should be filtered in its
testcase.yaml.

config TEST_ENABLE_USERSPACE
Expand All @@ -84,8 +87,8 @@ config TEST_ENABLE_USERSPACE
select DYNAMIC_OBJECTS
default y
help
This hidden option will help test the userspace mode. This will be
enabled only when CONFIG_ARCH_HAS_USERSPACE is set, and that the test
This hidden option implements the TEST_USERSPACE logic. It turns on
USERSPACE when CONFIG_ARCH_HAS_USERSPACE is set and the test
case itself indicates that it exercises user mode via
CONFIG_TEST_USERSPACE.

Expand Down
2 changes: 0 additions & 2 deletions tests/kernel/critical/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ tests:
kernel.common.nsim:
platform_whitelist: nsim_sem_mpu_stack_guard nsim_em_mpu_stack_guard
extra_configs:
- CONFIG_TEST_USERSPACE=n
- CONFIG_TEST_HW_STACK_PROTECTION=n

2 changes: 1 addition & 1 deletion tests/kernel/fatal/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ tests:
tags: kernel ignore_faults userspace
kernel.common.stack_sentinel:
extra_args: CONF_FILE=sentinel.conf
tags: kernel ignore_faults userspace
tags: kernel ignore_faults
2 changes: 1 addition & 1 deletion tests/kernel/lifo/lifo_usage/testcase.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests:
kernel.lifo.usage:
min_ram: 32
tags: kernel userspace
tags: kernel
platform_exclude: m2gl025_miv
2 changes: 1 addition & 1 deletion tests/kernel/timer/timer_api/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ tests:
build_only: true
extra_args: CONF_FILE="prj_tickless.conf"
arch_exclude: riscv32 nios2 posix
tags: kernel userspace
tags: kernel
2 changes: 1 addition & 1 deletion tests/net/socket/getaddrinfo/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ common:
tests:
net.socket:
min_ram: 21
tags: net socket getaddrinfo
tags: net socket getaddrinfo userspace
1 change: 0 additions & 1 deletion tests/net/socket/register/prj.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONFIG_ZTEST=y
CONFIG_TEST_USERSPACE=n

# Asserts must be disabled as we are feeding invalid values to various
# functions and want that those do not cause abort.
Expand Down
2 changes: 0 additions & 2 deletions tests/posix/common/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ tests:
platform_whitelist: nsim_sem_mpu_stack_guard nsim_em_mpu_stack_guard
extra_configs:
- CONFIG_NEWLIB_LIBC=n
- CONFIG_TEST_USERSPACE=n
- CONFIG_TEST_HW_STACK_PROTECTION=n
portability.posix.newlib.nsim:
platform_whitelist: nsim_sem_mpu_stack_guard nsim_em_mpu_stack_guard
filter: TOOLCHAIN_HAS_NEWLIB == 1
extra_configs:
- CONFIG_NEWLIB_LIBC=y
- CONFIG_TEST_USERSPACE=n
- CONFIG_TEST_HW_STACK_PROTECTION=n