tests: stack_api: run in user mode when possible
All non ISR tests now run in user mode. userspace added to testcase.yaml tag list. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
bcd3803180
commit
60e6632e65
4 changed files with 19 additions and 9 deletions
|
@ -16,12 +16,21 @@ extern void test_stack_thread2thread(void);
|
|||
extern void test_stack_thread2isr(void);
|
||||
extern void test_stack_pop_fail(void);
|
||||
|
||||
extern struct k_stack kstack;
|
||||
extern struct k_stack stack;
|
||||
extern struct k_thread thread_data;
|
||||
extern struct k_sem end_sema;
|
||||
K_THREAD_STACK_EXTERN(threadstack);
|
||||
|
||||
/*test case main entry*/
|
||||
void test_main(void)
|
||||
{
|
||||
k_thread_access_grant(k_current_get(), &kstack, &stack, &thread_data,
|
||||
&end_sema, &threadstack, NULL);
|
||||
|
||||
ztest_test_suite(test_stack_api,
|
||||
ztest_unit_test(test_stack_thread2thread),
|
||||
ztest_user_unit_test(test_stack_thread2thread),
|
||||
ztest_unit_test(test_stack_thread2isr),
|
||||
ztest_unit_test(test_stack_pop_fail));
|
||||
ztest_user_unit_test(test_stack_pop_fail));
|
||||
ztest_run_test_suite(test_stack_api);
|
||||
}
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
|
||||
/**TESTPOINT: init via K_STACK_DEFINE*/
|
||||
K_STACK_DEFINE(kstack, STACK_LEN);
|
||||
static struct k_stack stack;
|
||||
__kernel struct k_stack stack;
|
||||
|
||||
static K_THREAD_STACK_DEFINE(threadstack, STACK_SIZE);
|
||||
static struct k_thread thread_data;
|
||||
K_THREAD_STACK_DEFINE(threadstack, STACK_SIZE);
|
||||
__kernel struct k_thread thread_data;
|
||||
static u32_t data[STACK_LEN] = { 0xABCD, 0x1234 };
|
||||
static struct k_sem end_sema;
|
||||
__kernel struct k_sem end_sema;
|
||||
|
||||
static void tstack_push(struct k_stack *pstack)
|
||||
{
|
||||
|
@ -75,7 +75,8 @@ static void tstack_thread_thread(struct k_stack *pstack)
|
|||
/**TESTPOINT: thread-thread data passing via stack*/
|
||||
k_tid_t tid = k_thread_create(&thread_data, threadstack, STACK_SIZE,
|
||||
tThread_entry, pstack, NULL, NULL,
|
||||
K_PRIO_PREEMPT(0), 0, 0);
|
||||
K_PRIO_PREEMPT(0), K_USER |
|
||||
K_INHERIT_PERMS, 0);
|
||||
tstack_push(pstack);
|
||||
k_sem_take(&end_sema, K_FOREVER);
|
||||
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
#define STACK_LEN 2
|
||||
|
||||
static u32_t data[STACK_LEN];
|
||||
extern struct k_stack stack;
|
||||
|
||||
/*test cases*/
|
||||
void test_stack_pop_fail(void *p1, void *p2, void *p3)
|
||||
{
|
||||
struct k_stack stack;
|
||||
u32_t rx_data;
|
||||
|
||||
k_stack_init(&stack, data, STACK_LEN);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
tests:
|
||||
- test:
|
||||
tags: kernel
|
||||
tags: kernel userspace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue