Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
Poll tests

Test cases to verify poll. More...

Functions

void test_poll_no_wait (void)
 Test poll events with no wait. More...
 
void test_poll_wait (void)
 Test polling with wait. More...
 
void test_poll_cancel (bool is_main_low_prio)
 Test polling of cancelled fifo. More...
 
void test_poll_multi (void)
 Test polling of multiple events. More...
 
void test_poll_threadstate (void)
 Test polling of events by manipulating polling thread state. More...
 
void test_detect_is_polling (void)
 Detect is_polling is false in signal_poll_event() More...
 
void test_condition_met_type_err (void)
 Test API k_poll with error events type in kernel mode. More...
 
void test_poll_lower_prio (void)
 Test polling of multiple events by lower priority thread. More...
 
void test_k_poll_user_num_err (void)
 Test API k_poll with error number events in user mode. More...
 
void test_k_poll_user_mem_err (void)
 Test API k_poll with error member of events in user mode. More...
 
void test_k_poll_user_type_sem_err (void)
 Test API k_poll with NULL sem event in user mode. More...
 
void test_k_poll_user_type_signal_err (void)
 Test API k_poll with NULL signal event in user mode. More...
 
void test_k_poll_user_type_fifo_err (void)
 Test API k_poll with NULL fifo event in user mode. More...
 
void test_k_poll_user_type_msgq_err (void)
 Test API k_poll with NULL message queue event in user mode. More...
 
void test_poll_signal_init_null (void)
 Test API k_poll_signal_init with NULL in user mode. More...
 
void test_poll_signal_check_obj (void)
 Test API k_poll_signal_check with NULL object in user mode. More...
 
void test_poll_signal_check_signal (void)
 Test API k_poll_signal_check with unread address in user mode. More...
 
void test_poll_signal_check_result (void)
 Test API k_poll_signal_check with unread address in user mode. More...
 
void test_poll_signal_raise_null (void)
 Test API k_poll_signal_raise with unread address in user mode. More...
 
void test_poll_signal_reset_null (void)
 Test API k_poll_signal_reset with unread address in user mode. More...
 

Detailed Description

Test cases to verify poll.

Function Documentation

◆ test_condition_met_type_err()

void test_condition_met_type_err ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test API k_poll with error events type in kernel mode.

Define a poll event and initialize by k_poll_event_init(), and using API k_poll with error events type as parameter check if a error will be met.

See also
k_poll()

◆ test_detect_is_polling()

void test_detect_is_polling ( void  )

#include <tests/kernel/poll/src/test_poll.c>

Detect is_polling is false in signal_poll_event()

Define and initialize a signal event, and spawn a thread to poll event, and set dticks as invalid, check if the value of is_polling in function signal_poll_event().

◆ test_k_poll_user_mem_err()

void test_k_poll_user_mem_err ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test API k_poll with error member of events in user mode.

Using API k_poll with error member as parameter to check if a error will be met.

See also
k_poll()

◆ test_k_poll_user_num_err()

void test_k_poll_user_num_err ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test API k_poll with error number events in user mode.

Using API k_poll with error number as parameter to check if a error will be met.

See also
k_poll()

◆ test_k_poll_user_type_fifo_err()

void test_k_poll_user_type_fifo_err ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test API k_poll with NULL fifo event in user mode.

Define a poll, and using API k_poll with NULL fifo as parameter to check if a error will be met.

See also
k_poll()

◆ test_k_poll_user_type_msgq_err()

void test_k_poll_user_type_msgq_err ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test API k_poll with NULL message queue event in user mode.

Define a poll, and using API k_poll with NULL message queue as parameter to check if a error will be met.

See also
k_poll()

◆ test_k_poll_user_type_sem_err()

void test_k_poll_user_type_sem_err ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test API k_poll with NULL sem event in user mode.

Define a poll event, and using API k_poll with NULL sem as parameter to check if a error will be met.

See also
k_poll()

◆ test_k_poll_user_type_signal_err()

void test_k_poll_user_type_signal_err ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test API k_poll with NULL signal event in user mode.

Define a poll, and using API k_poll with NULL signal as parameter to check if a error will be met.

See also
k_poll()

◆ test_poll_cancel()

void test_poll_cancel ( bool  is_main_low_prio)

#include <tests/kernel/poll/src/test_poll.c>

Test polling of cancelled fifo.

Test the FIFO(queue) data available/cancelable events as events in poll.

See also
k_poll(), k_fifo_cancel_wait(), k_fifo_alloc_put

◆ test_poll_lower_prio()

void test_poll_lower_prio ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test polling of multiple events by lower priority thread.

  • Test the multiple semaphore events as waitable events in poll.
See also
K_POLL_EVENT_INITIALIZER(), k_poll(), k_poll_event_init()

◆ test_poll_multi()

void test_poll_multi ( void  )

#include <tests/kernel/poll/src/test_poll.c>

Test polling of multiple events.

  • Test the multiple semaphore events as waitable events in poll.
See also
K_POLL_EVENT_INITIALIZER(), k_poll(), k_poll_event_init()

◆ test_poll_no_wait()

◆ test_poll_signal_check_obj()

void test_poll_signal_check_obj ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test API k_poll_signal_check with NULL object in user mode.

Using API k_poll with NULL object as parameter to check if a error will be met.

See also
k_poll_signal_check()

◆ test_poll_signal_check_result()

void test_poll_signal_check_result ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test API k_poll_signal_check with unread address in user mode.

Using k_poll_signal_check with unread signaled as parameter to check if a error will be met.

See also
k_poll_signal_check()

◆ test_poll_signal_check_signal()

void test_poll_signal_check_signal ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test API k_poll_signal_check with unread address in user mode.

Using k_poll_signal_check with unread results as parameter to check if a error will be met.

See also
k_poll_signal_check()

◆ test_poll_signal_init_null()

void test_poll_signal_init_null ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test API k_poll_signal_init with NULL in user mode.

Using API k_poll_signal_init with NULL as parameter to check if a error will be met.

See also
k_poll_signal_init()

◆ test_poll_signal_raise_null()

void test_poll_signal_raise_null ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test API k_poll_signal_raise with unread address in user mode.

Using k_poll_signal_raise with NULL as parameter to check if a error will be met.

See also
k_poll_signal_raise()

◆ test_poll_signal_reset_null()

void test_poll_signal_reset_null ( void  )

#include <tests/kernel/poll/src/test_poll_fail.c>

Test API k_poll_signal_reset with unread address in user mode.

Using k_poll_signal_reset with NULL as parameter to check if a error will be met.

See also
k_poll_signal_reset()

◆ test_poll_threadstate()

void test_poll_threadstate ( void  )

#include <tests/kernel/poll/src/test_poll.c>

Test polling of events by manipulating polling thread state.

  • manipulating thread state to consider case where no polling thread is available during event signalling.
  • defined a signal poll as waitable events in poll and verify the result after siganl raised
See also
K_POLL_EVENT_INITIALIZER(), k_poll(), k_poll_signal_init(), k_poll_signal_check(), k_poll_signal_raise()

◆ test_poll_wait()

void test_poll_wait ( void  )

#include <tests/kernel/poll/src/test_poll.c>

Test polling with wait.

Test Objective:

  • Test the poll operation which enables waiting concurrently for one/two/all conditions to be fulfilled.
  • set a single timeout argument indicating the maximum amount of time a thread shall wait.

Testing techniques:

  • function and block box testing.
  • Interface testing.
  • Dynamic analysis and testing.

Prerequisite Conditions:

  • CONFIG_TEST_USERSPACE
  • CONFIG_DYNAMIC_OBJECTS
  • CONFIG_POLL

Input Specifications:

  • N/A

Test Procedure:

  1. Use FIFO/semaphore/signal/message queue object to define poll event.
  2. Initialize the FIFO/semaphore/signal/message queue object.
  3. Create a thread to put FIFO, give semaphore, raise signal, and put message queue.
  4. Check the result when signal is raised, semaphore is given, fifo is filled, and message is received.
  5. Check the result when no event is satisfied.
  6. Check the result when only semaphore is given.
  7. Check the result when only FIFO is filled.
  8. Check the result when only signal is raised.
  9. Check the result when only message is received.

Expected Test Result:

  • FIFO/semaphore/signal/message queue events available/waitable in poll.

Pass/Fail Criteria:

  • Successful if check points in test procedure are all passed, otherwise failure.

Assumptions and Constraints:

  • N/A
See also
k_poll_signal_init(), k_poll()