Skip to content

Commit d02ef74

Browse files
Tomasz Bursztykanashif
authored andcommitted
tests/ivshmem: Make sure it enters usermode before testing the driver
So it will also test the ivhmem usermode handlers. Signed-off-by: Tomasz Bursztyka <[email protected]>
1 parent 91970ad commit d02ef74

File tree

1 file changed

+17
-0
lines changed
  • tests/drivers/virtualization/ivshmem/src

1 file changed

+17
-0
lines changed

tests/drivers/virtualization/ivshmem/src/ivshmem.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,26 @@ void test_ivshmem_plain(void)
4848
"registering handlers should not be supported");
4949
}
5050

51+
#ifdef CONFIG_USERSPACE
52+
void test_is_usermode(void)
53+
{
54+
zassert_true(k_is_user_context(), "thread left in kernel mode");
55+
}
56+
57+
void test_quit_kernel(void)
58+
{
59+
k_thread_user_mode_enter((k_thread_entry_t)test_is_usermode,
60+
NULL, NULL, NULL);
61+
}
62+
#else
63+
void test_quit_kernel(void)
64+
{ }
65+
#endif /* CONFIG_USERSPACE */
66+
5167
void test_main(void)
5268
{
5369
ztest_test_suite(test_ivshmem,
70+
ztest_unit_test(test_quit_kernel),
5471
ztest_unit_test(test_ivshmem_plain));
5572
ztest_run_test_suite(test_ivshmem);
5673
}

0 commit comments

Comments
 (0)