Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS

Tests for the FIFO kernel object. More...

Functions

void test_fifo_cancel_wait (void)
 Test cancel waiting on a FIFO queue. More...
 
void test_fifo_thread2thread (void)
 Test thread to thread data passing via fifo. More...
 
void test_fifo_thread2isr (void)
 Test isr to thread data passing via fifo. More...
 
void test_fifo_isr2thread (void)
 Test thread to isr data passing via fifo. More...
 
void test_fifo_is_empty_thread (void)
 Test empty fifo. More...
 
void test_fifo_is_empty_isr (void)
 Test empty fifo in interrupt context. More...
 
void test_fifo_get_fail (void *p1, void *p2, void *p3)
 Test FIFO get fail. More...
 
void test_fifo_loop (void)
 Verify zephyr fifo continuous read write in loop. More...
 
static void test_timeout_empty_fifo (void)
 Test empty fifo with timeout and K_NO_WAIT. More...
 
static void test_timeout_non_empty_fifo (void)
 Test non empty fifo with timeout and K_NO_WAIT. More...
 
static void test_timeout_fifo_thread (void)
 Test fifo with timeout and K_NO_WAIT. More...
 
static void test_timeout_threads_pend_on_fifo (void)
 Test fifo with different timeouts. More...
 
static void test_timeout_threads_pend_on_dual_fifos (void)
 Test multiple fifos with different timeouts. More...
 
static void test_timeout_threads_pend_fail_on_fifo (void)
 Test same fifo with different timeouts. More...
 
static void test_timeout_setup (void)
 Test fifo init. More...
 
static void test_single_fifo_play (void)
 Tests single fifo get and put operation in thread context. More...
 
static void test_dual_fifo_play (void)
 Tests dual fifo get and put operation in thread context. More...
 
static void test_isr_fifo_play (void)
 Tests fifo put and get operation in interrupt context. More...
 

Detailed Description

Tests for the FIFO kernel object.

Verify zephyr fifo apis under different context

Function Documentation

◆ test_dual_fifo_play()

static void test_dual_fifo_play ( void  )
static

#include <tests/kernel/fifo/fifo_usage/src/main.c>

Tests dual fifo get and put operation in thread context.

test Thread enters an item into fifo2, starts a Child Thread and extract an item from fifo1 once the item is there. The Child Thread will extract an item from fifo2 once the item is there and and enter an item to fifo1. The flow of control goes from Test Thread to Child Thread and so forth.

See also
k_fifo_get(), k_fifo_is_empty(), k_fifo_put(), K_FIFO_DEFINE(x)

◆ test_fifo_cancel_wait()

void test_fifo_cancel_wait ( void  )

#include <tests/kernel/fifo/fifo_api/src/test_fifo_cancel.c>

Test cancel waiting on a FIFO queue.

This routine causes first thread pending on fifo (if any), to return from k_fifo_get() with NULL value (as if timeout expired).

See also
k_fifo_init(),k_fifo_get(), k_fifo_cancel_wait()

TESTPOINT: init via k_fifo_init

TESTPOINT: test K_FIFO_DEFINEed fifo

◆ test_fifo_get_fail()

void test_fifo_get_fail ( void p1,
void p2,
void p3 
)

#include <tests/kernel/fifo/fifo_api/src/test_fifo_fail.c>

Test FIFO get fail.

test zephyr fifo_get when no data to read, it should returns NULL.

See also
k_fifo_init(), k_fifo_get()

TESTPOINT: fifo get returns NULL

◆ test_fifo_is_empty_isr()

void test_fifo_is_empty_isr ( void  )

#include <tests/kernel/fifo/fifo_api/src/test_fifo_contexts.c>

Test empty fifo in interrupt context.

See also
k_fifo_init(), fifo_is_empty(), k_fifo_put(), k_fifo_get()

TESTPOINT: check fifo is empty from isr

◆ test_fifo_is_empty_thread()

void test_fifo_is_empty_thread ( void  )

#include <tests/kernel/fifo/fifo_api/src/test_fifo_contexts.c>

Test empty fifo.

See also
k_fifo_init(), k_fifo_is_empty(), k_fifo_put(), k_fifo_get()

TESTPOINT: k_fifo_is_empty after init

TESTPONT: check fifo is empty from thread

◆ test_fifo_isr2thread()

void test_fifo_isr2thread ( void  )

#include <tests/kernel/fifo/fifo_api/src/test_fifo_contexts.c>

Test thread to isr data passing via fifo.

See also
k_fifo_init(), k_fifo_put(), k_fifo_get()

TESTPOINT: test k_fifo_init fifo

TESTPOINT: test K_FIFO_DEFINE fifo

◆ test_fifo_loop()

void test_fifo_loop ( void  )

#include <tests/kernel/fifo/fifo_api/src/test_fifo_loop.c>

Verify zephyr fifo continuous read write in loop.

  • Test Steps
    1. fifo put from main thread
    2. fifo read from isr
    3. fifo put from isr
    4. fifo get from spawn thread
    5. loop above steps for LOOPs times
  • Expected Results
    1. fifo data pass correctly and stably across contexts
See also
k_fifo_init(), k_fifo_put(), k_fifo_get()

◆ test_fifo_thread2isr()

void test_fifo_thread2isr ( void  )

#include <tests/kernel/fifo/fifo_api/src/test_fifo_contexts.c>

Test isr to thread data passing via fifo.

See also
k_fifo_init(), k_fifo_put(), k_fifo_get()

TESTPOINT: init via k_fifo_init

TESTPOINT: test K_FIFO_DEFINEed fifo

◆ test_fifo_thread2thread()

void test_fifo_thread2thread ( void  )

#include <tests/kernel/fifo/fifo_api/src/test_fifo_contexts.c>

Test thread to thread data passing via fifo.

See also
k_fifo_init(), k_fifo_put(), k_fifo_get(), k_fifo_put_list()

TESTPOINT: init via k_fifo_init

TESTPOINT: test K_FIFO_DEFINEed fifo

◆ test_isr_fifo_play()

static void test_isr_fifo_play ( void  )
static

#include <tests/kernel/fifo/fifo_usage/src/main.c>

Tests fifo put and get operation in interrupt context.

Tests the ISR interfaces. Test thread puts items into fifo2 and gives control to the Child thread. Child thread gets items from fifo2 and then puts items into fifo1. Child thread gives back control to the Test thread and Test thread gets the items from fifo1. All the Push and Pop operations happen in ISR Context.

See also
k_fifo_get(), k_fifo_is_empty(), k_fifo_put(), K_FIFO_DEFINE(x)

◆ test_single_fifo_play()

static void test_single_fifo_play ( void  )
static

#include <tests/kernel/fifo/fifo_usage/src/main.c>

Tests single fifo get and put operation in thread context.

Test Thread enters items into a fifo, starts the Child Thread and waits for a semaphore. Child thread extracts all items from the fifo and enters some items back into the fifo. Child Thread gives the semaphore for Test Thread to continue. Once the control is returned back to Test Thread, it extracts all items from the fifo.

See also
k_fifo_get(), k_fifo_is_empty(), k_fifo_put(), K_FIFO_DEFINE(x)

◆ test_timeout_empty_fifo()

static void test_timeout_empty_fifo ( void  )
static

#include <tests/kernel/fifo/fifo_timeout/src/main.c>

Test empty fifo with timeout and K_NO_WAIT.

See also
k_fifo_get()

◆ test_timeout_fifo_thread()

static void test_timeout_fifo_thread ( void  )
static

#include <tests/kernel/fifo/fifo_timeout/src/main.c>

Test fifo with timeout and K_NO_WAIT.

In first scenario test fifo with some timeout where child thread puts data on the fifo on time. In second scenario test k_fifo_get with timeout of K_NO_WAIT and the fifo should be filled by the child thread based on the data availability on another fifo. In third scenario test k_fifo_get with timeout of K_FOREVER and the fifo should be filled by the child thread based on the data availability on another fifo.

See also
k_fifo_get(), k_fifo_put()

◆ test_timeout_non_empty_fifo()

static void test_timeout_non_empty_fifo ( void  )
static

#include <tests/kernel/fifo/fifo_timeout/src/main.c>

Test non empty fifo with timeout and K_NO_WAIT.

See also
k_fifo_get(), k_fifo_put()

◆ test_timeout_setup()

static void test_timeout_setup ( void  )
static

◆ test_timeout_threads_pend_fail_on_fifo()

static void test_timeout_threads_pend_fail_on_fifo ( void  )
static

#include <tests/kernel/fifo/fifo_timeout/src/main.c>

Test same fifo with different timeouts.

test multiple threads pending on the same fifo with different timeouts but getting the data in time

See also
k_fifo_get(), k_fifo_put()

◆ test_timeout_threads_pend_on_dual_fifos()

static void test_timeout_threads_pend_on_dual_fifos ( void  )
static

#include <tests/kernel/fifo/fifo_timeout/src/main.c>

Test multiple fifos with different timeouts.

test multiple threads pending on different fifos with different timeouts

See also
k_fifo_get(), k_fifo_put()

◆ test_timeout_threads_pend_on_fifo()

static void test_timeout_threads_pend_on_fifo ( void  )
static

#include <tests/kernel/fifo/fifo_timeout/src/main.c>

Test fifo with different timeouts.

test multiple threads pending on the same fifo with different timeouts

See also
k_fifo_get(), k_fifo_put()