tests: kernel/userspace: skip other thread tests if needed

With memory domain enabled, all threads within the same domain
have access to each other threads' stacks, especially with
CONFIG_ARCH_MEM_DOMAIN_SYNCHRONOUS_API enabled (as it is
expected behavior). So update the conditions to skip both
tests to read and write to other threads' stacks.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2024-01-30 11:15:40 -08:00 committed by Anas Nashif
parent 2fc55f3938
commit aa09b41f29

View file

@ -553,8 +553,16 @@ ZTEST_USER(userspace, test_read_other_stack)
/* Try to read from another thread's stack. */
unsigned int val;
#ifdef CONFIG_MMU
#if defined(CONFIG_MMU) || defined(CONFIG_MPU)
#if defined(CONFIG_ARCH_MEM_DOMAIN_SYNCHRONOUS_API)
/* With memory domain enabled, all threads within the same domain
* have access to each other threads' stacks, especially with
* CONFIG_ARCH_MEM_DOMAIN_SYNCHRONOUS_API=y (as it is expected
* behavior). The access would not fault which the test expects.
* So skip this test.
*/
ztest_test_skip();
#endif
#endif
k_thread_create(&test_thread, test_stack, STACKSIZE,
uthread_read_body, &val, NULL, NULL,
@ -575,8 +583,16 @@ ZTEST_USER(userspace, test_write_other_stack)
/* Try to write to another thread's stack. */
unsigned int val;
#ifdef CONFIG_MMU
#if defined(CONFIG_MMU) || defined(CONFIG_MPU)
#if defined(CONFIG_ARCH_MEM_DOMAIN_SYNCHRONOUS_API)
/* With memory domain enabled, all threads within the same domain
* have access to each other threads' stacks, especially with
* CONFIG_ARCH_MEM_DOMAIN_SYNCHRONOUS_API=y (as it is expected
* behavior). The access would not fault which the test expects.
* So skip this test.
*/
ztest_test_skip();
#endif
#endif
k_thread_create(&test_thread, test_stack, STACKSIZE,
uthread_write_body, &val, NULL, NULL,