samples/microkernel: add test for private tasks
This adds unit test for microkernel private tasks. The code piggybacks to the public task test (by including the same source file), so any updates to the test will be applied to both. Note that the prj.mdef are different for both tests, since the private tasks test move the tasks inside source code. So, both mdef files will need to be updated at the same time. Change-Id: I2890f70be460c0e45208ce03d6e7897d2662f6f0 Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
2bc5880d85
commit
62077917b6
@ -70,6 +70,16 @@ static int helperData;
|
||||
|
||||
static volatile int mainTaskNotReady = 0;
|
||||
|
||||
#ifdef TEST_PRIV_TASKS
|
||||
/* Note this is in reverse order of what is defined under
|
||||
* test_task/prj.mdef. This is due to compiler filling linker
|
||||
* section like a stack. This is to preserve the same order
|
||||
* in memory as test_task.
|
||||
*/
|
||||
DEFINE_TASK(RT_TASKID, 10, RegressionTask, 2048, EXE);
|
||||
DEFINE_TASK(HT_TASKID, 20, HelperTask, 2048, EXE);
|
||||
#endif
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief ISR handler to call isr_task_id_get() and isr_task_priority_get()
|
||||
|
||||
9
samples/microkernel/test/test_task_priv/Makefile
Normal file
9
samples/microkernel/test/test_task_priv/Makefile
Normal file
@ -0,0 +1,9 @@
|
||||
MDEF_FILE = prj.mdef
|
||||
KERNEL_TYPE = micro
|
||||
PLATFORM_CONFIG ?= basic_atom
|
||||
CONF_FILE = prj_$(ARCH).conf
|
||||
|
||||
# Enable testing for private microkernel task objects
|
||||
CFLAGS = -DTEST_PRIV_TASKS
|
||||
|
||||
include ${ZEPHYR_BASE}/Makefile.inc
|
||||
46
samples/microkernel/test/test_task_priv/README.txt
Normal file
46
samples/microkernel/test/test_task_priv/README.txt
Normal file
@ -0,0 +1,46 @@
|
||||
Title: test_task_priv
|
||||
|
||||
Description:
|
||||
|
||||
This test verifies that the microkernel task APIs operate as expected. This
|
||||
also verifies the mechanism to define private task objects and their usage.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Building and Running Project:
|
||||
|
||||
This microkernel project outputs to the console. It can be built and executed
|
||||
on QEMU as follows:
|
||||
|
||||
make qemu
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Troubleshooting:
|
||||
|
||||
Problems caused by out-dated project information can be addressed by
|
||||
issuing one of the following commands then rebuilding the project:
|
||||
|
||||
make clean # discard results of previous builds
|
||||
# but keep existing configuration info
|
||||
or
|
||||
make pristine # discard results of previous builds
|
||||
# and restore pre-defined configuration info
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Sample Output:
|
||||
|
||||
tc_start() - Test Microkernel Task API
|
||||
===================================================================
|
||||
Microkernel objects initialized
|
||||
Testing isr_task_id_get() and isr_task_priority_get()
|
||||
Testing task_id_get() and task_priority_get()
|
||||
Testing task_priority_set()
|
||||
Testing task_sleep()
|
||||
Testing task_yield()
|
||||
Testing task_suspend() and task_resume()
|
||||
===================================================================
|
||||
PASS - RegressionTask.
|
||||
===================================================================
|
||||
PROJECT EXECUTION SUCCESSFUL
|
||||
17
samples/microkernel/test/test_task_priv/prj.mdef
Normal file
17
samples/microkernel/test/test_task_priv/prj.mdef
Normal file
@ -0,0 +1,17 @@
|
||||
% Application : test microkernel task APIs
|
||||
|
||||
% Please keep this in-sync with ../test_task/prj.mdef
|
||||
% except those specified below
|
||||
|
||||
% TASK HT_TASKID and RT_TASKID are defined within
|
||||
% the source file, so keep them commented out.
|
||||
%
|
||||
% TASK NAME PRIO ENTRY STACK GROUPS
|
||||
% ==================================================
|
||||
% TASK HT_TASKID 20 HelperTask 2048 [EXE]
|
||||
% TASK RT_TASKID 10 RegressionTask 2048 [EXE]
|
||||
|
||||
% SEMA NAME
|
||||
% ===========
|
||||
SEMA HT_SEM
|
||||
SEMA RT_SEM
|
||||
2
samples/microkernel/test/test_task_priv/prj_arm.conf
Normal file
2
samples/microkernel/test/test_task_priv/prj_arm.conf
Normal file
@ -0,0 +1,2 @@
|
||||
CONFIG_NUM_TASK_PRIORITIES=32
|
||||
CONFIG_NUM_IRQS=2
|
||||
7
samples/microkernel/test/test_task_priv/prj_x86.conf
Normal file
7
samples/microkernel/test/test_task_priv/prj_x86.conf
Normal file
@ -0,0 +1,7 @@
|
||||
CONFIG_NUM_TASK_PRIORITIES=32
|
||||
|
||||
# Let stack canaries use non-random number generator.
|
||||
# This option is NOT to be used in production code.
|
||||
CONFIG_DRV_RANDOM=y
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
CONFIG_NUM_DYNAMIC_STUBS=2
|
||||
3
samples/microkernel/test/test_task_priv/src/Makefile
Normal file
3
samples/microkernel/test/test_task_priv/src/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
ccflags-y += ${PROJECTINCLUDE} -I${srctree}/samples/include
|
||||
|
||||
obj-y = task.o
|
||||
1
samples/microkernel/test/test_task_priv/src/task.c
Normal file
1
samples/microkernel/test/test_task_priv/src/task.c
Normal file
@ -0,0 +1 @@
|
||||
#include "../../test_task/src/task.c"
|
||||
3
samples/microkernel/test/test_task_priv/testcase.ini
Normal file
3
samples/microkernel/test/test_task_priv/testcase.ini
Normal file
@ -0,0 +1,3 @@
|
||||
[test]
|
||||
tags = core
|
||||
|
||||
@ -51,6 +51,7 @@ microkernel/test/test_sema_priv <uq> basic_cortex_m3! fsl_frdm_k64f
|
||||
microkernel/test/test_sprintf <u> basic_cortex_m3! fsl_frdm_k64f
|
||||
microkernel/test/test_stackprot <u> basic_cortex_m3! fsl_frdm_k64f
|
||||
microkernel/test/test_task <uq> basic_cortex_m3! fsl_frdm_k64f
|
||||
microkernel/test/test_task_priv <uq> basic_cortex_m3! fsl_frdm_k64f
|
||||
microkernel/test/test_task_irq <u> basic_cortex_m3! fsl_frdm_k64f
|
||||
microkernel/test/test_timer <uq> basic_cortex_m3! fsl_frdm_k64f
|
||||
microkernel/test/test_xip <uq> basic_cortex_m3! fsl_frdm_k64f
|
||||
@ -74,6 +75,7 @@ microkernel/test/test_sprintf <u> basic_minuteia! basic_atom! galileo
|
||||
microkernel/test/test_stackprot <u> basic_minuteia! basic_atom! galileo
|
||||
microkernel/test/test_static_idt <uq> basic_minuteia! basic_atom! galileo
|
||||
microkernel/test/test_task <uq> basic_minuteia! basic_atom! galileo
|
||||
microkernel/test/test_task_priv <uq> basic_minuteia! basic_atom! galileo
|
||||
microkernel/test/test_task_irq <u> basic_minuteia! basic_atom! galileo
|
||||
microkernel/test/test_tickless <uq> basic_minuteia! basic_atom! galileo
|
||||
microkernel/test/test_timer <uq> basic_minuteia! basic_atom! galileo
|
||||
|
||||
Loading…
Reference in New Issue
Block a user