Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS

Tests for queue. More...

Macros

#define QUEUE_NUM   10
 Verify that multiple queues can be defined simultaneously. More...
 

Functions

void test_queue_thread2thread (void)
 Verify data passing between threads using queue. More...
 
void test_queue_thread2isr (void)
 Verify data passing between thread and ISR. More...
 
void test_queue_isr2thread (void)
 Verify data passing between ISR and thread. More...
 
void test_queue_get_2threads (void)
 Verify k_queue_get() More...
 
void test_queue_alloc (void)
 Test queue alloc append and prepend. More...
 
void test_queue_multithread_competition (void)
 Test multi-threads to get data from a queue. More...
 
void test_queue_get_fail (void)
 Test k_queue_get() failure scenario. More...
 
void test_queue_append_list_error (void)
 Test k_queue_append_list() failure scenario. More...
 
void test_queue_merge_list_error (void)
 Test k_queue_merge_slist() failure scenario. More...
 
void test_queue_init_null (void)
 Test k_queue_init() failure scenario. More...
 
void test_queue_alloc_append_null (void)
 Test k_queue_alloc_append() failure scenario. More...
 
void test_queue_alloc_prepend_null (void)
 Test k_queue_alloc_prepend() failure scenario. More...
 
void test_queue_get_null (void)
 Test k_queue_get() failure scenario. More...
 
void test_queue_is_empty_null (void)
 Test k_queue_is_empty() failure scenario. More...
 
void test_queue_peek_head_null (void)
 Test k_queue_peek_head() failure scenario. More...
 
void test_queue_peek_tail_null (void)
 Test k_queue_peek_tail() failure scenario. More...
 
void test_queue_cancel_wait_error (void)
 Test k_queue_merge_slist() failure scenario. More...
 
void test_queue_loop (void)
 Test queue operations in loop. More...
 
void test_queue_supv_to_user (void)
 Verify queue elements and cancel wait from a user thread. More...
 
void test_queue_alloc_prepend_user (void)
 verify allocate and feature "Last In, First Out" More...
 
void test_queue_alloc_append_user (void)
 verify feature of queue "First In, First Out" More...
 
void test_auto_free (void)
 Test to verify free of allocated elements of queue. More...
 

Detailed Description

Tests for queue.

Macro Definition Documentation

◆ QUEUE_NUM

#define QUEUE_NUM   10

#include <tests/kernel/queue/src/test_queue_contexts.c>

Verify that multiple queues can be defined simultaneously.

define multiple queues to verify they can work.

See also
k_queue_init()

Function Documentation

◆ test_auto_free()

void test_auto_free ( void  )

#include <tests/kernel/queue/src/test_queue_user.c>

Test to verify free of allocated elements of queue.

◆ test_queue_alloc()

void test_queue_alloc ( void  )

#include <tests/kernel/queue/src/test_queue_contexts.c>

Test queue alloc append and prepend.

See also
k_queue_alloc_append(), k_queue_alloc_prepend(), z_thread_heap_assign(), k_queue_is_empty(), k_queue_get(), k_queue_remove()

◆ test_queue_alloc_append_null()

void test_queue_alloc_append_null ( void  )

#include <tests/kernel/queue/src/test_queue_fail.c>

Test k_queue_alloc_append() failure scenario.

Verify that the parameter of the API is NULL, what will happen.

See also
k_queue_alloc_append()

◆ test_queue_alloc_append_user()

void test_queue_alloc_append_user ( void  )

#include <tests/kernel/queue/src/test_queue_user.c>

verify feature of queue "First In, First Out"

Create a new queue And allocated memory for the queue Initialize and insert data item in sequence. Verify the feather "First in,First out"

See also
k_queue_init(), k_queue_alloc_append()

◆ test_queue_alloc_prepend_null()

void test_queue_alloc_prepend_null ( void  )

#include <tests/kernel/queue/src/test_queue_fail.c>

Test k_queue_alloc_prepend() failure scenario.

Verify that the parameter of the API is NULL, what will happen.

See also
k_queue_alloc_prepend()

◆ test_queue_alloc_prepend_user()

void test_queue_alloc_prepend_user ( void  )

#include <tests/kernel/queue/src/test_queue_user.c>

verify allocate and feature "Last In, First Out"

Create a new queue And allocated memory for the queue Initialize and insert data item in sequence. Verify the feather "Last in,First out"

See also
k_queue_alloc_prepend()

◆ test_queue_append_list_error()

void test_queue_append_list_error ( void  )

#include <tests/kernel/queue/src/test_queue_fail.c>

Test k_queue_append_list() failure scenario.

Accroding to the API k_queue_append_list to design some error condition to verify error branch of the API.

  1. Verify that the list's head is empty.
  2. Verify that the list's tail is empty.
  3. Verify that append list to the queue when a sub-thread is waiting for data.
See also
k_queue_append_list()

◆ test_queue_cancel_wait_error()

void test_queue_cancel_wait_error ( void  )

#include <tests/kernel/queue/src/test_queue_fail.c>

Test k_queue_merge_slist() failure scenario.

Verify that the parameter of the API is NULL, what will happen.

See also
k_queue_merge_slist()

◆ test_queue_get_2threads()

void test_queue_get_2threads ( void  )

◆ test_queue_get_fail()

void test_queue_get_fail ( void  )

#include <tests/kernel/queue/src/test_queue_fail.c>

Test k_queue_get() failure scenario.

See also
k_queue_get()

TESTPOINT: queue get returns NULL

◆ test_queue_get_null()

void test_queue_get_null ( void  )

#include <tests/kernel/queue/src/test_queue_fail.c>

Test k_queue_get() failure scenario.

Verify that the parameter of the API is NULL, what will happen.

See also
k_queue_get()

◆ test_queue_init_null()

void test_queue_init_null ( void  )

#include <tests/kernel/queue/src/test_queue_fail.c>

Test k_queue_init() failure scenario.

Verify that the parameter of API k_queue_init() is NULL, what will happen.

See also
k_queue_init()

◆ test_queue_is_empty_null()

void test_queue_is_empty_null ( void  )

#include <tests/kernel/queue/src/test_queue_fail.c>

Test k_queue_is_empty() failure scenario.

Verify that the parameter of the API is NULL, what will happen.

See also
k_queue_is_empty()

◆ test_queue_isr2thread()

void test_queue_isr2thread ( void  )

#include <tests/kernel/queue/src/test_queue_contexts.c>

Verify data passing between ISR and thread.

Create a new ISR and ready for getting data And current thread is used for inserting data Verify if the rx_data is equal insert-data address.

See also
k_queue_init(), k_queue_insert(), k_queue_get(), k_queue_append(), k_queue_remove()

TESTPOINT: test k_queue_init queue

TESTPOINT: test K_QUEUE_DEFINE queue

◆ test_queue_loop()

void test_queue_loop ( void  )

◆ test_queue_merge_list_error()

void test_queue_merge_list_error ( void  )

#include <tests/kernel/queue/src/test_queue_fail.c>

Test k_queue_merge_slist() failure scenario.

Verify the API k_queue_merge_slist when a slist is empty or a slist's tail is null.

See also
k_queue_merge_slist()

◆ test_queue_multithread_competition()

void test_queue_multithread_competition ( void  )

#include <tests/kernel/queue/src/test_queue_contexts.c>

Test multi-threads to get data from a queue.

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 on an empty FIFO simultaneously.
  2. When a data item is added, it is given to the highest priority thread that has waited longest.

◆ test_queue_peek_head_null()

void test_queue_peek_head_null ( void  )

#include <tests/kernel/queue/src/test_queue_fail.c>

Test k_queue_peek_head() failure scenario.

Verify that the parameter of the API is NULL, what will happen.

See also
k_queue_peek_head()

◆ test_queue_peek_tail_null()

void test_queue_peek_tail_null ( void  )

#include <tests/kernel/queue/src/test_queue_fail.c>

Test k_queue_peek_tail() failure scenario.

Verify that the parameter of the API is NULL, what will happen.

See also
k_queue_peek_tail()

◆ test_queue_supv_to_user()

void test_queue_supv_to_user ( void  )

#include <tests/kernel/queue/src/test_queue_user.c>

Verify queue elements and cancel wait from a user thread.

The test adds elements to queue and then verified by the child user thread. Get data from a empty queue,and use K_FORVER to wait for available And to cancel wait from current thread.

See also
k_queue_append(), k_queue_alloc_append(), k_queue_init(), k_queue_cancel_wait()

◆ test_queue_thread2isr()

void test_queue_thread2isr ( void  )

#include <tests/kernel/queue/src/test_queue_contexts.c>

Verify data passing between thread and ISR.

Create a new ISR to insert data And current thread is used for getting data Verify if the rx_data is equal insert-data address. If the received data address is the same as the created array, prove that the queue data structures are stored within the provided data items.

See also
k_queue_init(), k_queue_insert(), k_queue_append()

TESTPOINT: init via k_queue_init

TESTPOINT: test K_QUEUE_DEFINEed queue

◆ test_queue_thread2thread()

void test_queue_thread2thread ( void  )

#include <tests/kernel/queue/src/test_queue_contexts.c>

Verify data passing between threads using queue.

Static define and Dynamic define queues, Then initialize them. Create a new thread to wait for reading data. Current thread will append item into queue. Verify if rx_data is equal insert-data address. Verify queue can be define at compile time.

See also
k_queue_init(), k_queue_insert(), k_queue_append() K_THREAD_STACK_DEFINE()

TESTPOINT: init via k_queue_init

TESTPOINT: test K_QUEUE_DEFINEed queue