tests: stack: improve test documentation

Add references to APIs being tested and groups tests correctly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2018-05-23 08:54:37 -04:00
parent 876195de4d
commit d73e970084
4 changed files with 59 additions and 6 deletions

View file

@ -29,7 +29,13 @@ extern struct k_stack stack;
extern struct k_thread thread_data;
extern struct k_sem end_sema;
K_THREAD_STACK_EXTERN(threadstack);
/**
*
* @defgroup kernel_stack_tests Stacks
* @ingroup all_tests
* @{
* @}
*/
/*test case main entry*/
void test_main(void)
{

View file

@ -86,18 +86,28 @@ static void tstack_thread_isr(struct k_stack *pstack)
irq_offload(tIsr_entry_pop, pstack);
}
/*test cases*/
/**
* @addtogroup kernel_stack_tests
* @{
*/
/**
* @see k_stack_init(), k_stack_push(), #K_STACK_DEFINE(x), k_stack_pop()
*/
void test_stack_thread2thread(void)
{
/**TESTPOINT: test k_stack_init stack*/
k_stack_init(&stack, data, STACK_LEN);
tstack_thread_thread(&stack);
/**TESTPOINT: test K_STACK_INIT stack*/
/**TESTPOINT: test K_STACK_DEFINE stack*/
tstack_thread_thread(&kstack);
}
#ifdef CONFIG_USERSPACE
/**
* @see k_stack_init(), k_stack_push(), #K_STACK_DEFINE(x), k_stack_pop()
*/
void test_stack_user_thread2thread(void)
{
struct k_stack *stack = k_object_alloc(K_OBJ_STACK);
@ -110,12 +120,19 @@ void test_stack_user_thread2thread(void)
}
#endif
/**
* @see k_stack_init(), k_stack_push(), #K_STACK_DEFINE(x), k_stack_pop()
*/
void test_stack_thread2isr(void)
{
/**TESTPOINT: test k_stack_init stack*/
k_stack_init(&stack, data, STACK_LEN);
tstack_thread_isr(&stack);
/**TESTPOINT: test K_STACK_INIT stack*/
/**TESTPOINT: test K_STACK_DEFINE stack*/
tstack_thread_isr(&kstack);
}
/**
* @}
*/

View file

@ -13,7 +13,6 @@
static u32_t data[STACK_LEN];
extern struct k_stack stack;
/*test cases*/
static void stack_pop_fail(struct k_stack *stack)
{
u32_t rx_data;
@ -24,6 +23,14 @@ static void stack_pop_fail(struct k_stack *stack)
zassert_equal(k_stack_pop(stack, &rx_data, TIMEOUT), -EAGAIN, NULL);
}
/**
* @addtogroup kernel_stack_tests
* @{
*/
/**
* @see k_stack_init(), k_stack_pop()
*/
void test_stack_pop_fail(void)
{
k_stack_init(&stack, data, STACK_LEN);
@ -32,6 +39,9 @@ void test_stack_pop_fail(void)
}
#ifdef CONFIG_USERSPACE
/**
* @see k_stack_init(), k_stack_pop()
*/
void test_stack_user_pop_fail(void)
{
struct k_stack *alloc_stack = k_object_alloc(K_OBJ_STACK);
@ -43,3 +53,6 @@ void test_stack_user_pop_fail(void)
stack_pop_fail(alloc_stack);
}
#endif
/**
* @}
*/

View file

@ -131,7 +131,14 @@ static void thread_entry_fn_isr(void *p1, void *p2, void *p3)
k_sem_give(&end_sema);
}
/*test cases*/
/**
* @addtogroup kernel_stack_tests
* @{
*/
/**
* @see k_stack_push(), #K_STACK_DEFINE(x), k_stack_pop()
*/
static void test_single_stack_play(void)
{
u32_t tmp[STACK_LEN];
@ -165,6 +172,9 @@ static void test_single_stack_play(void)
k_thread_abort(tid);
}
/**
* @see k_stack_push(), #K_STACK_DEFINE(x), k_stack_pop()
*/
static void test_dual_stack_play(void)
{
u32_t tmp[STACK_LEN];
@ -190,6 +200,9 @@ static void test_dual_stack_play(void)
k_thread_abort(tid);
}
/**
* @see k_stack_push(), #K_STACK_DEFINE(x), k_stack_pop()
*/
static void test_isr_stack_play(void)
{
/* Init kernel objects */
@ -217,6 +230,10 @@ static void test_isr_stack_play(void)
k_thread_abort(tid);
}
/**
* @}
*/
/*test case main entry*/
void test_main(void)
{