Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Stacks

Tests for Kernel stack objects. More...

Functions

 ZTEST_USER (stack_usage, test_single_stack_play)
 Verify data passing between threads using single stack.
 
 ZTEST_USER (stack_usage_1cpu, test_dual_stack_play)
 Verify data passing between threads using dual stack.
 
 ZTEST (stack_usage_1cpu, test_isr_stack_play)
 Verify data passing between thread and ISR.
 
void thread_entry_wait (void *p1, void *p2, void *p3)
 
 ZTEST (stack_usage, test_stack_pop_can_wait)
 Test that the stack pop can be waited if no item available.
 
 ZTEST (stack_contexts, test_stack_thread2thread)
 Test to verify data passing between threads via stack.
 
 ZTEST_USER (stack_contexts, test_stack_user_thread2thread)
 Verifies data passing between user threads via stack.
 
 ZTEST (stack_contexts, test_stack_thread2isr)
 Verifies data passing between thread and ISR via stack.
 
 ZTEST (stack_contexts, test_stack_alloc_thread2thread)
 
static void low_prio_wait_for_stack (void *p1, void *p2, void *p3)
 
static void high_prio_t1_wait_for_stack (void *p1, void *p2, void *p3)
 
static void high_prio_t2_wait_for_stack (void *p1, void *p2, void *p3)
 
 ZTEST (stack_contexts, test_stack_multithread_competition)
 Test multi-threads to get data from stack.
 
 ZTEST (stack_contexts, test_stack_alloc_null)
 Test case of requesting a buffer larger than resource pool.
 
void tStack_pop_entry (void *p1, void *p2, void *p3)
 
 ZTEST (stack_fail, test_stack_pop_fail)
 Verifies stack pop functionality.
 
 ZTEST (stack_fail, test_stack_cleanup_error)
 Verifies cleanup a stack that still be needed by another thread.
 
 ZTEST (stack_fail, test_stack_push_full)
 Verifies push a data in the full stack.
 
 ZTEST_USER (stack_fail, test_stack_user_pop_fail)
 Verifies stack pop from a user thread.
 
 ZTEST_USER (stack_fail, test_stack_user_init_null)
 Verifies stack alloc and initialize a null pointer.
 
 ZTEST_USER (stack_fail, test_stack_user_init_invalid_value)
 Verify that alloc and initialize a stack with 0 memory.
 
 ZTEST_USER (stack_fail, test_stack_user_push_null)
 Verify that push some data into a NULL pointer.
 
 ZTEST_USER (stack_fail, test_stack_user_pop_null)
 Verifies pop data from a NULL pointer.
 
 ZTEST_USER (stack_fail, test_stack_user_pop_permission)
 Verifies cleanup a stack that its data still be waited by another thread.
 

Detailed Description

Tests for Kernel stack objects.

Function Documentation

◆ high_prio_t1_wait_for_stack()

static void high_prio_t1_wait_for_stack ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ high_prio_t2_wait_for_stack()

static void high_prio_t2_wait_for_stack ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ low_prio_wait_for_stack()

static void low_prio_wait_for_stack ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ thread_entry_wait()

void thread_entry_wait ( void *  p1,
void *  p2,
void *  p3 
)

◆ tStack_pop_entry()

void tStack_pop_entry ( void *  p1,
void *  p2,
void *  p3 
)

◆ ZTEST() [1/10]

ZTEST ( stack_contexts  ,
test_stack_alloc_null   
)

#include <tests/kernel/stack/stack/src/test_stack_contexts.c>

Test case of requesting a buffer larger than resource pool.

Try to request a buffer larger than resource pool for stack, then see if returns an expected value.

◆ ZTEST() [2/10]

ZTEST ( stack_contexts  ,
test_stack_alloc_thread2thread   
)

#include <tests/kernel/stack/stack/src/test_stack_contexts.c>

See also
k_stack_alloc_init(), k_stack_push(), K_STACK_DEFINE(x), k_stack_pop(), k_stack_cleanup()

TESTPOINT: thread-thread data passing via stack

Requested buffer allocation from the test pool.

◆ ZTEST() [3/10]

ZTEST ( stack_contexts  ,
test_stack_multithread_competition   
)

#include <tests/kernel/stack/stack/src/test_stack_contexts.c>

Test multi-threads to get data from stack.

Define three threads, and set a higher priority for two of them, and set a lower priority for the last one. Then Add a delay between creating the two high priority threads. Test point:

  1. Any number of threads may wait(K_FOREVER set) on an empty stack simultaneously.
  2. When data is pushed, it is given to the highest priority thread that has waited longest.

◆ ZTEST() [4/10]

ZTEST ( stack_contexts  ,
test_stack_thread2isr   
)

#include <tests/kernel/stack/stack/src/test_stack_contexts.c>

Verifies data passing between thread and ISR via stack.

See also
k_stack_init(), k_stack_push(), K_STACK_DEFINE(x), k_stack_pop()

TESTPOINT: test k_stack_init stack

TESTPOINT: test K_STACK_DEFINE stack

◆ ZTEST() [5/10]

ZTEST ( stack_contexts  ,
test_stack_thread2thread   
)

#include <tests/kernel/stack/stack/src/test_stack_contexts.c>

Test to verify data passing between threads via stack.

Static define and Dynamic define stacks, Then initialize them. Current thread push or pop data item into the stack. Create a new thread pop or push data item into the stack. Controlled by semaphore. Verify data passing between threads via stack And verify stack can be define at compile time.

See also
k_stack_init(), k_stack_push(), K_STACK_DEFINE(x), k_stack_pop()

TESTPOINT: test k_stack_init stack

TESTPOINT: test K_STACK_DEFINE stack

◆ ZTEST() [6/10]

ZTEST ( stack_fail  ,
test_stack_cleanup_error   
)

#include <tests/kernel/stack/stack/src/test_stack_fail.c>

Verifies cleanup a stack that still be needed by another thread.

See also
k_stack_cleanup()

◆ ZTEST() [7/10]

ZTEST ( stack_fail  ,
test_stack_pop_fail   
)

#include <tests/kernel/stack/stack/src/test_stack_fail.c>

Verifies stack pop functionality.

See also
k_stack_init(), k_stack_pop()

◆ ZTEST() [8/10]

ZTEST ( stack_fail  ,
test_stack_push_full   
)

#include <tests/kernel/stack/stack/src/test_stack_fail.c>

Verifies push a data in the full stack.

See also
k_stack_push()

◆ ZTEST() [9/10]

ZTEST ( stack_usage  ,
test_stack_pop_can_wait   
)

#include <tests/kernel/stack/stack/src/main.c>

Test that the stack pop can be waited if no item available.

Create and initialize a new stack Set two timeout parameters to indicate the maximum amount of time the thread will wait.

See also
k_stack_push(), K_STACK_DEFINE(x), k_stack_pop()

◆ ZTEST() [10/10]

ZTEST ( stack_usage_1cpu  ,
test_isr_stack_play   
)

#include <tests/kernel/stack/stack/src/main.c>

Verify data passing between thread and ISR.

See also
k_stack_push(), K_STACK_DEFINE(x), k_stack_pop()

◆ ZTEST_USER() [1/9]

ZTEST_USER ( stack_contexts  ,
test_stack_user_thread2thread   
)

#include <tests/kernel/stack/stack/src/test_stack_contexts.c>

Verifies data passing between user threads via stack.

See also
k_stack_init(), k_stack_push(), K_STACK_DEFINE(x), k_stack_pop()

◆ ZTEST_USER() [2/9]

ZTEST_USER ( stack_fail  ,
test_stack_user_init_invalid_value   
)

#include <tests/kernel/stack/stack/src/test_stack_fail.c>

Verify that alloc and initialize a stack with 0 memory.

See also
k_stack_alloc_init()

◆ ZTEST_USER() [3/9]

ZTEST_USER ( stack_fail  ,
test_stack_user_init_null   
)

#include <tests/kernel/stack/stack/src/test_stack_fail.c>

Verifies stack alloc and initialize a null pointer.

See also
k_stack_alloc_init()

◆ ZTEST_USER() [4/9]

ZTEST_USER ( stack_fail  ,
test_stack_user_pop_fail   
)

#include <tests/kernel/stack/stack/src/test_stack_fail.c>

Verifies stack pop from a user thread.

See also
k_stack_init(), k_stack_pop()

◆ ZTEST_USER() [5/9]

ZTEST_USER ( stack_fail  ,
test_stack_user_pop_null   
)

#include <tests/kernel/stack/stack/src/test_stack_fail.c>

Verifies pop data from a NULL pointer.

See also
k_stack_pop()

◆ ZTEST_USER() [6/9]

ZTEST_USER ( stack_fail  ,
test_stack_user_pop_permission   
)

#include <tests/kernel/stack/stack/src/test_stack_fail.c>

Verifies cleanup a stack that its data still be waited by another thread.

See also
k_stack_pop()

◆ ZTEST_USER() [7/9]

ZTEST_USER ( stack_fail  ,
test_stack_user_push_null   
)

#include <tests/kernel/stack/stack/src/test_stack_fail.c>

Verify that push some data into a NULL pointer.

See also
k_stack_push()

◆ ZTEST_USER() [8/9]

ZTEST_USER ( stack_usage  ,
test_single_stack_play   
)

#include <tests/kernel/stack/stack/src/main.c>

Verify data passing between threads using single stack.

See also
k_stack_push(), K_STACK_DEFINE(x), k_stack_pop()

◆ ZTEST_USER() [9/9]

ZTEST_USER ( stack_usage_1cpu  ,
test_dual_stack_play   
)

#include <tests/kernel/stack/stack/src/main.c>

Verify data passing between threads using dual stack.

See also
k_stack_push(), K_STACK_DEFINE(x), k_stack_pop()