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:
Krzysztof Chruscinski 2021-01-14 08:02:35 +01:00 committed by Anas Nashif
commit 345d12e8e0
6 changed files with 1075 additions and 5 deletions

View file

@ -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.
*

View file

@ -434,4 +434,3 @@ bool mpsc_pbuf_is_pending(struct mpsc_pbuf_buffer *buffer)
return a ? true : false;
}

View 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})

View file

@ -0,0 +1,3 @@
CONFIG_ZTEST=y
CONFIG_MPSC_PBUF=y
CONFIG_TEST_RANDOM_GENERATOR=y

File diff suppressed because it is too large Load diff

View 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