tests: lib: Add test for mpsc_pbuf
Added suite for multiple producer, single consumer packet buffer. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
1fd71ca043
commit
345d12e8e0
6 changed files with 1075 additions and 5 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
/*
|
||||
* Copyright (c) 2021 Nordic Semiconductor ASA
|
||||
*
|
||||
|
@ -28,8 +27,8 @@ extern "C" {
|
|||
* Multi producer, single consumer packet buffer allows to allocate variable
|
||||
* length consecutive space for storing a packet. When space is allocated
|
||||
* it can be filled by the user (except for the first 2 bits) and when packet
|
||||
* is ready it is commited. It is allowed to allocate another packet before
|
||||
* commiting the previous one.
|
||||
* is ready it is committed. It is allowed to allocate another packet before
|
||||
* committing the previous one.
|
||||
*
|
||||
* If buffer is full and packet cannot be allocated then null is returned unless
|
||||
* overwrite mode is selected. In that mode, oldest entry are dropped (user is
|
||||
|
@ -43,7 +42,8 @@ extern "C" {
|
|||
*/
|
||||
|
||||
/**@defgroup MPSC_PBUF_FLAGS MPSC packet buffer flags
|
||||
* @{ */
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Flag indicating that buffer size is power of 2.
|
||||
*
|
||||
|
|
|
@ -434,4 +434,3 @@ bool mpsc_pbuf_is_pending(struct mpsc_pbuf_buffer *buffer)
|
|||
|
||||
return a ? true : false;
|
||||
}
|
||||
|
||||
|
|
8
tests/lib/mpsc_pbuf/CMakeLists.txt
Normal file
8
tests/lib/mpsc_pbuf/CMakeLists.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
cmake_minimum_required(VERSION 3.13.1)
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(mpsc_pbuf)
|
||||
|
||||
FILE(GLOB app_sources src/*.c)
|
||||
target_sources(app PRIVATE ${app_sources})
|
3
tests/lib/mpsc_pbuf/prj.conf
Normal file
3
tests/lib/mpsc_pbuf/prj.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
CONFIG_ZTEST=y
|
||||
CONFIG_MPSC_PBUF=y
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
1053
tests/lib/mpsc_pbuf/src/main.c
Normal file
1053
tests/lib/mpsc_pbuf/src/main.c
Normal file
File diff suppressed because it is too large
Load diff
7
tests/lib/mpsc_pbuf/testcase.yaml
Normal file
7
tests/lib/mpsc_pbuf/testcase.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
tests:
|
||||
lib.mpsc_pbuf:
|
||||
tags: mpsc_pbuf
|
||||
platform_allow: >
|
||||
qemu_arc_em qemu_arc_hs qemu_cortex_a53 qemu_cortex_m0 qemu_cortex_m3
|
||||
qemu_cortex_r5 qemu_leon3 qemu_nios2 qemu_riscv32 qemu_riscv64 qemu_x86
|
||||
qemu_x86_64 qemu_xtensa
|
Loading…
Add table
Add a link
Reference in a new issue