tests: userspace: cover missing/bad syscalls
We were missing code coverage for bad or unimplemented system call IDs. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
31c4cc54fa
commit
777336ef38
3 changed files with 29 additions and 3 deletions
|
@ -762,7 +762,7 @@ static u32_t handler_bad_syscall(u32_t bad_id, u32_t arg2, u32_t arg3,
|
|||
{
|
||||
printk("Bad system call id %u invoked\n", bad_id);
|
||||
z_arch_syscall_oops(ssf);
|
||||
CODE_UNREACHABLE;
|
||||
CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
static u32_t handler_no_syscall(u32_t arg1, u32_t arg2, u32_t arg3,
|
||||
|
@ -770,7 +770,7 @@ static u32_t handler_no_syscall(u32_t arg1, u32_t arg2, u32_t arg3,
|
|||
{
|
||||
printk("Unimplemented system call\n");
|
||||
z_arch_syscall_oops(ssf);
|
||||
CODE_UNREACHABLE;
|
||||
CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
#include <syscall_dispatch.c>
|
||||
|
|
|
@ -1085,6 +1085,29 @@ void test_stack_buffer(void)
|
|||
|
||||
}
|
||||
|
||||
void z_impl_missing_syscall(void)
|
||||
{
|
||||
/* Shouldn't ever get here; no handler function compiled */
|
||||
k_panic();
|
||||
}
|
||||
|
||||
void test_unimplemented_syscall(void)
|
||||
{
|
||||
expect_fault = true;
|
||||
expected_reason = REASON_KERNEL_OOPS;
|
||||
|
||||
missing_syscall();
|
||||
}
|
||||
|
||||
void test_bad_syscall(void)
|
||||
{
|
||||
expect_fault = true;
|
||||
expected_reason = REASON_KERNEL_OOPS;
|
||||
|
||||
z_arch_syscall_invoke0(INT_MAX);
|
||||
|
||||
}
|
||||
|
||||
void test_main(void)
|
||||
{
|
||||
struct k_mem_partition *parts[] = {&part0, &part1,
|
||||
|
@ -1134,7 +1157,9 @@ void test_main(void)
|
|||
ztest_unit_test(domain_add_part_context_switch),
|
||||
ztest_unit_test(domain_remove_part_context_switch),
|
||||
ztest_unit_test(domain_remove_thread_context_switch),
|
||||
ztest_unit_test(test_stack_buffer)
|
||||
ztest_unit_test(test_stack_buffer),
|
||||
ztest_user_unit_test(test_unimplemented_syscall),
|
||||
ztest_user_unit_test(test_bad_syscall)
|
||||
);
|
||||
ztest_run_test_suite(userspace);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
__syscall void stack_info_get(u32_t *start_addr, u32_t *size);
|
||||
__syscall int check_perms(void *addr, size_t size, int write);
|
||||
__syscall void missing_syscall(void);
|
||||
|
||||
#include <syscalls/test_syscall.h>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue