Commit 9f04c741 authored by Andrew Boie's avatar Andrew Boie Committed by Anas Nashif
Browse files

kernel: enforce usage of CONFIG_TEST_USERSPACE



If a test tries to create a user thread, and the platform
suppors user mode, and CONFIG_TEST_USERSPACE has not been
enabled, fail an assertion.

Signed-off-by: default avatarAndrew Boie <andrew.p.boie@intel.com>
parent 7b1ee5cf
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -433,6 +433,12 @@ k_tid_t z_impl_k_thread_create(struct k_thread *new_thread,
{
	__ASSERT(!z_is_in_isr(), "Threads may not be created in ISRs");

	/* 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");
#endif

	z_setup_new_thread(new_thread, stack, stack_size, entry, p1, p2, p3,
			  prio, options, NULL);