Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
test_pipe.c File Reference
#include <ztest.h>

Data Structures

struct  pipe_sequence
 

Macros

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACKSIZE)
 
#define PIPE_SIZE   (256)
 
#define TOTAL_ELEMENTS   (sizeof(single_elements) / sizeof(struct pipe_sequence))
 
#define TOTAL_WAIT_ELEMENTS
 
#define TOTAL_TIMEOUT_ELEMENTS
 
#define NO_CONSTRAINT   (0U)
 
#define ATLEAST_1   (1U)
 
#define ALL_BYTES   (sizeof(tx_buffer))
 
#define RETURN_SUCCESS   (0)
 
#define TIMEOUT_VAL   (K_MSEC(10))
 
#define TIMEOUT_200MSEC   (K_MSEC(200))
 

Functions

 K_PIPE_DEFINE (test_pipe, 256, 4)
 Define and initialize test_pipe at compile time. More...
 
 K_THREAD_STACK_DEFINE (stack_1,(512+CONFIG_TEST_EXTRA_STACKSIZE))
 
 K_SEM_DEFINE (get_sem, 0, 1)
 
 K_SEM_DEFINE (put_sem, 1, 1)
 
 K_SEM_DEFINE (sync_sem, 0, 1)
 
 K_SEM_DEFINE (multiple_send_sem, 0, 1)
 
uint32_t rx_buffer_check (char *buffer, uint32_t size)
 
void pipe_put_single (void)
 
void pipe_get_single (void *p1, void *p2, void *p3)
 
void pipe_put_multiple (void)
 
void pipe_get_multiple (void *p1, void *p2, void *p3)
 
void pipe_put_forever_wait (void)
 
void pipe_get_forever_wait (void *pi, void *p2, void *p3)
 
void pipe_put_timeout (void)
 
void pipe_get_timeout (void *pi, void *p2, void *p3)
 
void pipe_get_on_empty_pipe (void)
 
void pipe_put_forever_timeout (void)
 
void pipe_get_forever_timeout (void *p1, void *p2, void *p3)
 
void pipe_put_get_timeout (void)
 
void k_sys_fatal_error_handler (unsigned int reason, const z_arch_esf_t *pEsf)
 Fatal error policy handler. More...
 
void test_pipe_on_single_elements (void)
 Verify pipe with 1 element insert. More...
 
void test_pipe_on_multiple_elements (void)
 Test when multiple items are present in the pipe. More...
 
void test_pipe_forever_wait (void)
 Test when multiple items are present with wait. More...
 
void test_pipe_timeout (void)
 Test pipes with timeout. More...
 
void test_pipe_get_on_empty_pipe (void)
 Test pipe get from a empty pipe. More...
 
void test_pipe_forever_timeout (void)
 Test the pipe_get with K_FOREVER as timeout. More...
 
void test_pipe_get_timeout (void)
 k_pipe_get timeout test More...
 
void test_pipe_get_invalid_size (void)
 Test pipe get of invalid size. More...
 
void test_pipe_get_min_xfer (void)
 Test pipe get returns immediately if >= min_xfer is available. More...
 
void test_pipe_put_min_xfer (void)
 Test pipe put returns immediately if >= min_xfer is available. More...
 
void test_pipe_define_at_runtime (void)
 Test defining and initializing pipes at run time. More...
 

Variables

ZTEST_BMEM uint8_t tx_buffer [(256)+1]
 
ZTEST_BMEM uint8_t rx_buffer [(256)+1]
 
static const struct pipe_sequence single_elements []
 
static const struct pipe_sequence multiple_elements []
 
static const struct pipe_sequence wait_elements []
 
static const struct pipe_sequence timeout_elements []
 
struct k_thread get_single_tid
 
ZTEST_BMEM bool valid_fault
 

Macro Definition Documentation

◆ ALL_BYTES

#define ALL_BYTES   (sizeof(tx_buffer))

◆ ATLEAST_1

#define ATLEAST_1   (1U)

◆ NO_CONSTRAINT

#define NO_CONSTRAINT   (0U)

◆ PIPE_SIZE

#define PIPE_SIZE   (256)

◆ RETURN_SUCCESS

#define RETURN_SUCCESS   (0)

◆ STACK_SIZE

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACKSIZE)

◆ TIMEOUT_200MSEC

#define TIMEOUT_200MSEC   (K_MSEC(200))

◆ TIMEOUT_VAL

#define TIMEOUT_VAL   (K_MSEC(10))

◆ TOTAL_ELEMENTS

#define TOTAL_ELEMENTS   (sizeof(single_elements) / sizeof(struct pipe_sequence))

◆ TOTAL_TIMEOUT_ELEMENTS

#define TOTAL_TIMEOUT_ELEMENTS
Value:
(sizeof(timeout_elements) / \
sizeof(struct pipe_sequence))
Definition: test_pipe.c:48
static const struct pipe_sequence timeout_elements[]
Definition: test_pipe.c:103

◆ TOTAL_WAIT_ELEMENTS

#define TOTAL_WAIT_ELEMENTS
Value:
(sizeof(wait_elements) / \
sizeof(struct pipe_sequence))
static const struct pipe_sequence wait_elements[]
Definition: test_pipe.c:94

Function Documentation

◆ K_PIPE_DEFINE()

K_PIPE_DEFINE ( test_pipe  ,
256  ,
 
)

Define and initialize test_pipe at compile time.

◆ K_SEM_DEFINE() [1/4]

K_SEM_DEFINE ( get_sem  ,
,
 
)

◆ K_SEM_DEFINE() [2/4]

K_SEM_DEFINE ( multiple_send_sem  ,
,
 
)

◆ K_SEM_DEFINE() [3/4]

K_SEM_DEFINE ( put_sem  ,
,
 
)

◆ K_SEM_DEFINE() [4/4]

K_SEM_DEFINE ( sync_sem  ,
,
 
)

◆ K_THREAD_STACK_DEFINE()

K_THREAD_STACK_DEFINE ( stack_1  ,
(512+CONFIG_TEST_EXTRA_STACKSIZE)   
)

◆ pipe_get_forever_timeout()

void pipe_get_forever_timeout ( void p1,
void p2,
void p3 
)

◆ pipe_get_forever_wait()

void pipe_get_forever_wait ( void pi,
void p2,
void p3 
)

◆ pipe_get_multiple()

void pipe_get_multiple ( void p1,
void p2,
void p3 
)

◆ pipe_get_on_empty_pipe()

void pipe_get_on_empty_pipe ( void  )

◆ pipe_get_single()

void pipe_get_single ( void p1,
void p2,
void p3 
)

◆ pipe_get_timeout()

void pipe_get_timeout ( void pi,
void p2,
void p3 
)

◆ pipe_put_forever_timeout()

void pipe_put_forever_timeout ( void  )

◆ pipe_put_forever_wait()

void pipe_put_forever_wait ( void  )

◆ pipe_put_get_timeout()

void pipe_put_get_timeout ( void  )

◆ pipe_put_multiple()

void pipe_put_multiple ( void  )

◆ pipe_put_single()

void pipe_put_single ( void  )

◆ pipe_put_timeout()

void pipe_put_timeout ( void  )

◆ rx_buffer_check()

uint32_t rx_buffer_check ( char *  buffer,
uint32_t  size 
)

Variable Documentation

◆ get_single_tid

struct k_thread get_single_tid

◆ multiple_elements

const struct pipe_sequence multiple_elements[]
static
Initial value:
= {
{ (256) / 3, (sizeof(tx_buffer)) , (256) / 3, (0) , },
{ (256) / 3, (sizeof(tx_buffer)) , (256) / 3, (0) , },
{ (256) / 3, (sizeof(tx_buffer)) , (256) / 3, (0) , },
{ (256) / 3, (sizeof(tx_buffer)) , 0, -EIO },
{ (256) / 3, (1U) , (256) / 3, (0) },
{ (256) / 3, (1U) , (256) / 3, (0) },
{ (256) / 3, (1U) , (256) / 3, (0) },
{ (256) / 3, (1U) , 1, (0) },
{ (256) / 3, (1U) , 0, -EIO },
{ (256) / 3, (0U) , (256) / 3, (0) },
{ (256) / 3, (0U) , (256) / 3, (0) },
{ (256) / 3, (0U) , (256) / 3, (0) },
{ (256) / 3, (0U) , 1, (0) },
{ (256) / 3, (0U) , 0, (0) }
}
#define EIO
Definition: errno.h:44
ZTEST_BMEM uint8_t tx_buffer[(256)+1]
Definition: test_pipe.c:24

◆ rx_buffer

ZTEST_BMEM uint8_t rx_buffer[(256)+1]

◆ single_elements

const struct pipe_sequence single_elements[]
static
Initial value:
= {
{ 0, (sizeof(tx_buffer)) , 0, 0 },
{ 1, (sizeof(tx_buffer)) , 1, (0) },
{ (256) - 1, (sizeof(tx_buffer)) , (256) - 1, (0) },
{ (256) , (sizeof(tx_buffer)) , (256) , (0) },
{ (256) + 1, (sizeof(tx_buffer)) , 0, -EIO },
{ 1, (1U) , 1, (0) },
{ (256) - 1, (1U) , (256) - 1, (0) },
{ (256) , (1U) , (256) , (0) },
{ (256) + 1, (1U) , (256) , (0) },
{ 0, (0U) , 0, 0 },
{ 1, (0U) , 1, (0) },
{ (256) - 1, (0U) , (256) - 1, (0) },
{ (256) , (0U) , (256) , (0) },
{ (256) + 1, (0U) , (256) , (0) }
}

◆ timeout_elements

const struct pipe_sequence timeout_elements[]
static
Initial value:
= {
{ 0, (sizeof(tx_buffer)) , 0, 0 },
{ 1, (sizeof(tx_buffer)) , 0, -EAGAIN },
{ (256) - 1, (sizeof(tx_buffer)) , 0, -EAGAIN },
{ (256) , (sizeof(tx_buffer)) , 0, -EAGAIN },
{ (256) + 1, (sizeof(tx_buffer)) , 0, -EAGAIN },
{ 1, (1U) , 0, -EAGAIN },
{ (256) - 1, (1U) , 0, -EAGAIN },
{ (256) , (1U) , 0, -EAGAIN },
{ (256) + 1, (1U) , 0, -EAGAIN }
}
#define EAGAIN
Definition: errno.h:50

◆ tx_buffer

ZTEST_BMEM uint8_t tx_buffer[(256)+1]

◆ valid_fault

ZTEST_BMEM bool valid_fault

◆ wait_elements

const struct pipe_sequence wait_elements[]
static
Initial value:
= {
{ 1, (sizeof(tx_buffer)) , 1, (0) },
{ (256) - 1, (sizeof(tx_buffer)) , (256) - 1, (0) },
{ (256) , (sizeof(tx_buffer)) , (256) , (0) },
{ (256) + 1, (sizeof(tx_buffer)) , (256) + 1, (0) },
{ (256) - 1, (1U) , (256) - 1, (0) },
}