tests: arch: arm: move test arm_thread_swap to new ztest API

Migrate the testsuite tests/arch/arm/arm_thread_swap to the
new ztest API.

Signed-off-by: Shaoan Li <shaoanx.li@intel.com>
This commit is contained in:
Shaoan Li 2022-07-08 09:34:09 +08:00 committed by Carles Cufí
commit bfd59b17a1
4 changed files with 7 additions and 18 deletions

View file

@ -1,5 +1,6 @@
CONFIG_ZTEST=y
CONFIG_DYNAMIC_INTERRUPTS=y
CONFIG_ZTEST_NEW_API=y
CONFIG_TEST_USERSPACE=y
CONFIG_APPLICATION_DEFINED_SYSCALL=y
CONFIG_MAIN_STACK_SIZE=1024

View file

@ -150,7 +150,7 @@ static void user_thread_entry(uint32_t irq_line)
#endif
}
void test_arm_syscalls(void)
ZTEST(arm_thread_swap, test_arm_syscalls)
{
int i = 0;
@ -163,7 +163,6 @@ void test_arm_syscalls(void)
* - PSPLIM register guards the default stack
* - MSPLIM register guards the interrupt stack
*/
zassert_true((_current->arch.mode & CONTROL_nPRIV_Msk) == 0,
"mode variable not set to PRIV mode for supervisor thread\n");
@ -279,7 +278,7 @@ static inline void z_vrfy_test_arm_cpu_write_reg(void)
*
* @ingroup kernel_memprotect_tests
*/
void test_syscall_cpu_scrubs_regs(void)
ZTEST_USER(arm_thread_swap, test_syscall_cpu_scrubs_regs)
{
uint32_t arm_reg_val[4];
@ -297,12 +296,12 @@ void test_syscall_cpu_scrubs_regs(void)
}
}
#else
void test_syscall_cpu_scrubs_regs(void)
ZTEST_USER(arm_thread_swap, test_syscall_cpu_scrubs_regs)
{
ztest_test_skip();
}
void test_arm_syscalls(void)
ZTEST(arm_thread_swap, test_arm_syscalls)
{
ztest_test_skip();
}

View file

@ -403,7 +403,7 @@ static void alt_thread_entry(void)
"Alternative thread: switch flag not false on thread exit\n");
}
void test_arm_thread_swap(void)
ZTEST(arm_thread_swap, test_arm_thread_swap)
{
int test_flag;

View file

@ -6,15 +6,4 @@
#include <ztest.h>
extern void test_arm_thread_swap(void);
extern void test_arm_syscalls(void);
extern void test_syscall_cpu_scrubs_regs(void);
void test_main(void)
{
ztest_test_suite(arm_thread_swap,
ztest_unit_test(test_arm_thread_swap),
ztest_unit_test(test_arm_syscalls),
ztest_user_unit_test(test_syscall_cpu_scrubs_regs));
ztest_run_test_suite(arm_thread_swap);
}
ZTEST_SUITE(arm_thread_swap, NULL, NULL, NULL, NULL, NULL);