tests: custom_data: run in user mode
main.c and test_customdata_api.c merged. Preemptive priority case now run in user mode. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
60e6632e65
commit
a9557ef219
5 changed files with 15 additions and 41 deletions
|
@ -1,3 +1,3 @@
|
|||
include $(ZEPHYR_BASE)/tests/Makefile.test
|
||||
|
||||
obj-y = main.o test_customdata_api.o
|
||||
obj-y = test_customdata_api.o
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <ztest.h>
|
||||
#include "test_cdata.h"
|
||||
|
||||
/**
|
||||
* @addtogroup t_threads_customdata
|
||||
* @{
|
||||
* @defgroup t_threads_customdata_api test_threads_customdata_api
|
||||
* @}
|
||||
*/
|
||||
|
||||
/*test case main entry*/
|
||||
void test_main(void)
|
||||
{
|
||||
ztest_test_suite(test_customdata_api,
|
||||
ztest_unit_test(test_customdata_get_set_coop),
|
||||
ztest_unit_test(test_customdata_get_set_preempt));
|
||||
ztest_run_test_suite(test_customdata_api);
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __TEST_CUSTOMDATA_H__
|
||||
#define __TEST_CUSTOMDATA_H__
|
||||
|
||||
void test_customdata_get_set_coop(void);
|
||||
void test_customdata_get_set_preempt(void);
|
||||
|
||||
#endif /* __TEST_CUSTOMDATA_H__ */
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
/*local variables*/
|
||||
static K_THREAD_STACK_DEFINE(tstack, STACK_SIZE);
|
||||
static struct k_thread tdata;
|
||||
__kernel static struct k_thread tdata;
|
||||
|
||||
static void customdata_entry(void *p1, void *p2, void *p3)
|
||||
{
|
||||
|
@ -58,9 +58,20 @@ void test_customdata_get_set_preempt(void)
|
|||
/** TESTPOINT: custom data of preempt thread */
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
customdata_entry, NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(0), 0, 0);
|
||||
K_PRIO_PREEMPT(0), K_USER, 0);
|
||||
k_sleep(500);
|
||||
|
||||
/* cleanup environment */
|
||||
k_thread_abort(tid);
|
||||
}
|
||||
|
||||
/*test case main entry*/
|
||||
void test_main(void)
|
||||
{
|
||||
k_thread_access_grant(k_current_get(), &tdata, tstack, NULL);
|
||||
|
||||
ztest_test_suite(test_customdata_api,
|
||||
ztest_unit_test(test_customdata_get_set_coop),
|
||||
ztest_user_unit_test(test_customdata_get_set_preempt));
|
||||
ztest_run_test_suite(test_customdata_api);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
tests:
|
||||
- test:
|
||||
tags: kernel threads
|
||||
tags: kernel threads userspace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue