distortos  v0.4.0
object-oriented C++ RTOS for microcontrollers
distortos::test::anonymous_namespace{SignalCatchingOperationsTestCase.cpp} Namespace Reference

Functions

bool phase1 ()
 Phase 1 of test case. More...
 
bool phase2 ()
 Phase 2 of test case. More...
 

Variables

constexpr size_t testThreadStackSize {512}
 size of stack for test threads, bytes More...
 
decltype(statistics::getContextSwitchCount()) constexpr phase2ThreadContextSwitchCount {2}
 

Function Documentation

◆ phase1()

bool distortos::test::anonymous_namespace{SignalCatchingOperationsTestCase.cpp}::phase1 ( )

Phase 1 of test case.

Tests various aspects of setting signal action, aiming for full coverage of execution paths through SignalsCatcherControlBlock::setAssociation(). Following cases are tested:

  • setting identical signal actions for multiple signal numbers must succeed as long as no more than CONFIG_MAIN_THREAD_SIGNAL_ACTIONS different signal actions are used at the same time;
  • setting the same signal action as the one that is currently set must always succeed;
  • clearing signal action must always succeed;
  • trying to change signal action for signal number must fail with EAGAIN if CONFIG_MAIN_THREAD_SIGNAL_ACTIONS different signal actions are already used and the one that is changed is used by multiple signal numbers;
  • trying to set new signal action for signal number must fail with EAGAIN when CONFIG_MAIN_THREAD_SIGNAL_ACTIONS different signal actions are already used;
Returns
true if test succeeded, false otherwise
Here is the caller graph for this function:

◆ phase2()

bool distortos::test::anonymous_namespace{SignalCatchingOperationsTestCase.cpp}::phase2 ( )

Phase 2 of test case.

Tests various error cases:

  • attempt to get/set signal action for invalid signal number must fail with EINVAL;
  • attempt to get/set signal action or to set signal mask in a thread that either has disabled reception of signals or has disabled catching/handling of signals must fail with ENOTSUP;
  • signal mask of a thread that either has disabled reception of signals or has disabled catching/handling of signals must be equal to "full" SignalSet;
Returns
true if test succeeded, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ phase2ThreadContextSwitchCount

decltype(statistics::getContextSwitchCount()) constexpr distortos::test::anonymous_namespace{SignalCatchingOperationsTestCase.cpp}::phase2ThreadContextSwitchCount {2}

expected number of context switches in phase2() block involving thread: 1 - main thread is preempted by test thread (main -> test), 2 - test thread terminates (test -> main)

◆ testThreadStackSize

constexpr size_t distortos::test::anonymous_namespace{SignalCatchingOperationsTestCase.cpp}::testThreadStackSize {512}

size of stack for test threads, bytes