Skip to content

Commit ad4fc07

Browse files
committed
tests: lib: Add test for mpsc_pbuf
Added suite for multiple producer, single consumer packet buffer. Signed-off-by: Krzysztof Chruscinski <[email protected]>
1 parent d163a83 commit ad4fc07

File tree

6 files changed

+1075
-5
lines changed

6 files changed

+1075
-5
lines changed

include/sys/mpsc_pbuf.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Copyright (c) 2021 Nordic Semiconductor ASA
43
*
@@ -28,8 +27,8 @@ extern "C" {
2827
* Multi producer, single consumer packet buffer allows to allocate variable
2928
* length consecutive space for storing a packet. When space is allocated
3029
* it can be filled by the user (except for the first 2 bits) and when packet
31-
* is ready it is commited. It is allowed to allocate another packet before
32-
* commiting the previous one.
30+
* is ready it is committed. It is allowed to allocate another packet before
31+
* committing the previous one.
3332
*
3433
* If buffer is full and packet cannot be allocated then null is returned unless
3534
* overwrite mode is selected. In that mode, oldest entry are dropped (user is
@@ -43,7 +42,8 @@ extern "C" {
4342
*/
4443

4544
/**@defgroup MPSC_PBUF_FLAGS MPSC packet buffer flags
46-
* @{ */
45+
* @{
46+
*/
4747

4848
/** @brief Flag indicating that buffer size is power of 2.
4949
*

lib/os/mpsc_pbuf.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,4 +434,3 @@ bool mpsc_pbuf_is_pending(struct mpsc_pbuf_buffer *buffer)
434434

435435
return a ? true : false;
436436
}
437-

tests/lib/mpsc_pbuf/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
cmake_minimum_required(VERSION 3.13.1)
4+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
5+
project(mpsc_pbuf)
6+
7+
FILE(GLOB app_sources src/*.c)
8+
target_sources(app PRIVATE ${app_sources})

tests/lib/mpsc_pbuf/prj.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONFIG_ZTEST=y
2+
CONFIG_MPSC_PBUF=y
3+
CONFIG_TEST_RANDOM_GENERATOR=y

0 commit comments

Comments
 (0)