Zephyr Project API 3.7.0
A Scalable Open Source RTOS
|
Tests for queue. More...
Macros | |
#define | QUEUE_NUM 10 |
Verify that multiple queues can be defined simultaneously. | |
Functions | |
ZTEST (queue_api_1cpu, test_queue_thread2thread) | |
Verify data passing between threads using queue. | |
ZTEST (queue_api, test_queue_thread2isr) | |
Verify data passing between thread and ISR. | |
ZTEST (queue_api, test_queue_isr2thread) | |
Verify data passing between ISR and thread. | |
ZTEST (queue_api_1cpu, test_queue_get_2threads) | |
Verify k_queue_get() | |
ZTEST (queue_api, test_queue_alloc) | |
Test queue alloc append and prepend. | |
ZTEST (queue_api_1cpu, test_queue_multithread_competition) | |
Test multi-threads to get data from a queue. | |
ZTEST (queue_api, test_queue_unique_append) | |
Verify k_queue_unique_append() | |
ZTEST (queue_api_1cpu, test_queue_get_fail) | |
Test k_queue_get() failure scenario. | |
ZTEST (queue_api, test_queue_append_list_error) | |
Test k_queue_append_list() failure scenario. | |
ZTEST (queue_api, test_queue_merge_list_error) | |
Test k_queue_merge_slist() failure scenario. | |
ZTEST_USER (queue_api, test_queue_init_null) | |
Test k_queue_init() failure scenario. | |
ZTEST_USER (queue_api, test_queue_alloc_append_null) | |
Test k_queue_alloc_append() failure scenario. | |
ZTEST_USER (queue_api, test_queue_alloc_prepend_null) | |
Test k_queue_alloc_prepend() failure scenario. | |
ZTEST_USER (queue_api, test_queue_get_null) | |
Test k_queue_get() failure scenario. | |
ZTEST_USER (queue_api, test_queue_is_empty_null) | |
Test k_queue_is_empty() failure scenario. | |
ZTEST_USER (queue_api, test_queue_peek_head_null) | |
Test k_queue_peek_head() failure scenario. | |
ZTEST_USER (queue_api, test_queue_peek_tail_null) | |
Test k_queue_peek_tail() failure scenario. | |
ZTEST_USER (queue_api, test_queue_cancel_wait_error) | |
Test k_queue_merge_slist() failure scenario. | |
ZTEST (queue_api_1cpu, test_queue_loop) | |
Test queue operations in loop. | |
ZTEST (queue_api_1cpu, test_queue_supv_to_user) | |
Verify queue elements and cancel wait from a user thread. | |
ZTEST_USER (queue_api, test_queue_alloc_prepend_user) | |
verify allocate and feature "Last In, First Out" | |
ZTEST_USER (queue_api, test_queue_alloc_append_user) | |
verify feature of queue "First In, First Out" | |
ZTEST (queue_api, test_auto_free) | |
Test to verify free of allocated elements of queue. | |
Tests for queue.
#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.
ZTEST | ( | queue_api | , |
test_auto_free | |||
) |
#include <tests/kernel/queue/src/test_queue_user.c>
Test to verify free of allocated elements of queue.
ZTEST | ( | queue_api | , |
test_queue_alloc | |||
) |
#include <tests/kernel/queue/src/test_queue_contexts.c>
Test queue alloc append and prepend.
ZTEST | ( | queue_api | , |
test_queue_append_list_error | |||
) |
#include <tests/kernel/queue/src/test_queue_fail.c>
Test k_queue_append_list() failure scenario.
According to the API k_queue_append_list to design some error condition to verify error branch of the API.
ZTEST | ( | queue_api | , |
test_queue_isr2thread | |||
) |
#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.
TESTPOINT: test k_queue_init queue
TESTPOINT: test K_QUEUE_DEFINE queue
ZTEST | ( | queue_api | , |
test_queue_merge_list_error | |||
) |
#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.
ZTEST | ( | queue_api | , |
test_queue_thread2isr | |||
) |
#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.
TESTPOINT: init via k_queue_init
TESTPOINT: test K_QUEUE_DEFINEed queue
ZTEST | ( | queue_api | , |
test_queue_unique_append | |||
) |
#include <tests/kernel/queue/src/test_queue_contexts.c>
Verify k_queue_unique_append()
Append the same data to the queue repeatedly, see if it returns expected value. And verify operation succeed if append different data to the queue.
ZTEST | ( | queue_api_1cpu | , |
test_queue_get_2threads | |||
) |
#include <tests/kernel/queue/src/test_queue_contexts.c>
Verify k_queue_get()
TESTPOINT: test k_queue_init queue
ZTEST | ( | queue_api_1cpu | , |
test_queue_get_fail | |||
) |
#include <tests/kernel/queue/src/test_queue_fail.c>
Test k_queue_get() failure scenario.
TESTPOINT: queue get returns NULL
ZTEST | ( | queue_api_1cpu | , |
test_queue_loop | |||
) |
#include <tests/kernel/queue/src/test_queue_loop.c>
Test queue operations in loop.
ZTEST | ( | queue_api_1cpu | , |
test_queue_multithread_competition | |||
) |
#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:
ZTEST | ( | queue_api_1cpu | , |
test_queue_supv_to_user | |||
) |
#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.
ZTEST | ( | queue_api_1cpu | , |
test_queue_thread2thread | |||
) |
#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.
TESTPOINT: init via k_queue_init
TESTPOINT: test K_QUEUE_DEFINEed queue
ZTEST_USER | ( | queue_api | , |
test_queue_alloc_append_null | |||
) |
#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.
ZTEST_USER | ( | queue_api | , |
test_queue_alloc_append_user | |||
) |
#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"
ZTEST_USER | ( | queue_api | , |
test_queue_alloc_prepend_null | |||
) |
#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.
ZTEST_USER | ( | queue_api | , |
test_queue_alloc_prepend_user | |||
) |
#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"
ZTEST_USER | ( | queue_api | , |
test_queue_cancel_wait_error | |||
) |
#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.
ZTEST_USER | ( | queue_api | , |
test_queue_get_null | |||
) |
#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.
ZTEST_USER | ( | queue_api | , |
test_queue_init_null | |||
) |
#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.
ZTEST_USER | ( | queue_api | , |
test_queue_is_empty_null | |||
) |
#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.
ZTEST_USER | ( | queue_api | , |
test_queue_peek_head_null | |||
) |
#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.
ZTEST_USER | ( | queue_api | , |
test_queue_peek_tail_null | |||
) |
#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.