Zephyr Project API 3.7.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
FIFOs

Tests for the FIFO kernel object. More...

Functions

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

Detailed Description

Tests for the FIFO kernel object.

Verify zephyr fifo apis under different context

Function Documentation

◆ test_timeout_setup()

static void * test_timeout_setup ( void  )
static

◆ ZTEST() [1/17]

ZTEST ( fifo_api  ,
test_fifo_get_fail   
)

#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

◆ ZTEST() [2/17]

ZTEST ( fifo_api  ,
test_fifo_is_empty_isr   
)

#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

◆ ZTEST() [3/17]

ZTEST ( fifo_api  ,
test_fifo_is_empty_thread   
)

#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

◆ ZTEST() [4/17]

ZTEST ( fifo_api  ,
test_fifo_isr2thread   
)

#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

◆ ZTEST() [5/17]

ZTEST ( fifo_api  ,
test_fifo_thread2isr   
)

#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

◆ ZTEST() [6/17]

ZTEST ( fifo_api_1cpu  ,
test_fifo_cancel_wait   
)

#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

◆ ZTEST() [7/17]

ZTEST ( fifo_api_1cpu  ,
test_fifo_loop   
)

#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()

◆ ZTEST() [8/17]

ZTEST ( fifo_api_1cpu  ,
test_fifo_thread2thread   
)

#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

◆ ZTEST() [9/17]

ZTEST ( fifo_timeout  ,
test_timeout_non_empty_fifo   
)

#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()

◆ ZTEST() [10/17]

ZTEST ( fifo_timeout_1cpu  ,
test_timeout_empty_fifo   
)

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

Test empty fifo with timeout and K_NO_WAIT.

See also
k_fifo_get()

◆ ZTEST() [11/17]

ZTEST ( fifo_timeout_1cpu  ,
test_timeout_fifo_thread   
)

#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()

◆ ZTEST() [12/17]

ZTEST ( fifo_timeout_1cpu  ,
test_timeout_threads_pend_fail_on_fifo   
)

#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()

◆ ZTEST() [13/17]

ZTEST ( fifo_timeout_1cpu  ,
test_timeout_threads_pend_on_dual_fifos   
)

#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()

◆ ZTEST() [14/17]

ZTEST ( fifo_timeout_1cpu  ,
test_timeout_threads_pend_on_fifo   
)

#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()

◆ ZTEST() [15/17]

ZTEST ( fifo_usage  ,
test_dual_fifo_play   
)

#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)

◆ ZTEST() [16/17]

ZTEST ( fifo_usage  ,
test_isr_fifo_play   
)

#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)

◆ ZTEST() [17/17]

ZTEST ( fifo_usage  ,
test_single_fifo_play   
)

#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)