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

Typedefs

using TestThreadFunction = void(SequenceAsserter &, unsigned int)
 type of test thread function More...
 
using Trigger = bool(Thread &, size_t, const TestPhase &)
 function executed to trigger unblocking of test thread More...
 
using Stage = std::pair< const TestThreadFunction &, const Trigger & >
 pair with functions for one stage More...
 

Functions

void generatedSignalsThread (SequenceAsserter &sequenceAsserter, const unsigned int firstSequencePoint)
 Test thread for signals that were "generated". More...
 
bool generatedSignalsTrigger (Thread &thread, const size_t index, const TestPhase &phase)
 Trigger function that "generates" signals. More...
 
void queuedSignalsThread (SequenceAsserter &sequenceAsserter, const unsigned int firstSequencePoint)
 Test thread for signals that were "queued". More...
 
bool queuedSignalsTrigger (Thread &thread, const size_t index, const TestPhase &phase)
 Trigger function that "queues" signals. More...
 
DynamicThread makeTestThread (const TestThreadFunction &testThreadFunction, const uint8_t priority, SequenceAsserter &sequenceAsserter, const unsigned int firstSequencePoint)
 Builder of test threads. More...
 

Variables

constexpr size_t testThreadStackSize {512}
 size of stack for test thread, bytes More...
 
constexpr size_t signalNumberShift {(sizeof(decltype(sigval{}.sival_int)) / 2) * 8}
 bit shift of signal number encoded in signal value More...
 
decltype(sigval{}.sival_int) constexpr signalValueMask {(1 << signalNumberShift) - 1}
 mask used to obtain sequence point from signal value (by removing encoded signal number) More...
 
const std::array< Stage, 2 > stages
 test stages More...
 

Typedef Documentation

◆ Stage

using distortos::test::anonymous_namespace{SignalsWaitTestCase.cpp}::Stage = typedef std::pair<const TestThreadFunction&, const Trigger&>

pair with functions for one stage

◆ TestThreadFunction

using distortos::test::anonymous_namespace{SignalsWaitTestCase.cpp}::TestThreadFunction = typedef void(SequenceAsserter&, unsigned int)

type of test thread function

◆ Trigger

using distortos::test::anonymous_namespace{SignalsWaitTestCase.cpp}::Trigger = typedef bool(Thread&, size_t, const TestPhase&)

function executed to trigger unblocking of test thread

Function Documentation

◆ generatedSignalsThread()

void distortos::test::anonymous_namespace{SignalsWaitTestCase.cpp}::generatedSignalsThread ( SequenceAsserter sequenceAsserter,
const unsigned int  firstSequencePoint 
)

Test thread for signals that were "generated".

Marks the first sequence point in SequenceAsserter, waits for any possible signal. The signal number of first accepted signal is used to calculate "sequence point offset". This value is then used to mark sequence points for all following signals that will be accepted.

It is assumed that totalThreads signals will be generated for each test thread.

First totalThreads sequence points will be marked before test threads block waiting for signal. Then each test thread must mark sequence points in the range [totalThreads * (i + 1); totalThreads * (i + 2)), where i is the index of unblocked thread in [0; totalThreads) range. Because it is not possible to fit all required sequence points into signal number values, these are "encoded". The ranges of sequence points mentioned earlier are obtained from ranges of received signal numbers in the following form [0 + 1; totalThreads + i).

Parameters
[in]sequenceAsserteris a reference to SequenceAsserter shared object
[in]firstSequencePointis the first sequence point of this instance
Here is the call graph for this function:

◆ generatedSignalsTrigger()

bool distortos::test::anonymous_namespace{SignalsWaitTestCase.cpp}::generatedSignalsTrigger ( Thread thread,
const size_t  index,
const TestPhase phase 
)

Trigger function that "generates" signals.

Parameters
[in]threadis a reference to test thread that will be triggered
[in]indexis the index of currently triggered thread - equal to the order in which this function is called during single phase
[in]phaseis a reference to current TestPhase
Returns
true if trigger check succeeded, false otherwise
Here is the call graph for this function:

◆ makeTestThread()

DynamicThread distortos::test::anonymous_namespace{SignalsWaitTestCase.cpp}::makeTestThread ( const TestThreadFunction testThreadFunction,
const uint8_t  priority,
SequenceAsserter sequenceAsserter,
const unsigned int  firstSequencePoint 
)

Builder of test threads.

Parameters
[in]testThreadFunctionis a reference to test thread function that will be used in test thread
[in]priorityis the thread's priority
[in]sequenceAsserteris a reference to SequenceAsserter shared object
[in]firstSequencePointis the first sequence point for this instance - equal to the order in which this thread will be started
Returns
constructed DynamicThread object
Here is the call graph for this function:
Here is the caller graph for this function:

◆ queuedSignalsThread()

void distortos::test::anonymous_namespace{SignalsWaitTestCase.cpp}::queuedSignalsThread ( SequenceAsserter sequenceAsserter,
const unsigned int  firstSequencePoint 
)

Test thread for signals that were "queued".

Marks the first sequence point in SequenceAsserter, waits for any possible signal. Value of each accepted signal is split into two parts:

  • sequence point which is obtained by masking with signalValueMask,
  • signal number which is obtained by shifting right by signalNumberShift. Signal number taken from SignalInformation object must be equal to signal number encoded in signal value.
Parameters
[in]sequenceAsserteris a reference to SequenceAsserter shared object
[in]firstSequencePointis the first sequence point of this instance
Here is the call graph for this function:

◆ queuedSignalsTrigger()

bool distortos::test::anonymous_namespace{SignalsWaitTestCase.cpp}::queuedSignalsTrigger ( Thread thread,
const size_t  index,
const TestPhase phase 
)

Trigger function that "queues" signals.

Parameters
[in]threadis a reference to test thread that will be triggered
[in]indexis the index of currently triggered thread - equal to the order in which this function is called during single phase
[in]phaseis a reference to current TestPhase
Returns
true if trigger check succeeded, false otherwise
Here is the call graph for this function:

Variable Documentation

◆ signalNumberShift

constexpr size_t distortos::test::anonymous_namespace{SignalsWaitTestCase.cpp}::signalNumberShift {(sizeof(decltype(sigval{}.sival_int)) / 2) * 8}

bit shift of signal number encoded in signal value

◆ signalValueMask

decltype(sigval{}.sival_int) constexpr distortos::test::anonymous_namespace{SignalsWaitTestCase.cpp}::signalValueMask {(1 << signalNumberShift) - 1}

mask used to obtain sequence point from signal value (by removing encoded signal number)

◆ stages

const std::array<Stage, 2> distortos::test::anonymous_namespace{SignalsWaitTestCase.cpp}::stages
Initial value:
{{
}}
bool generatedSignalsTrigger(Thread &thread, const size_t index, const TestPhase &phase)
Trigger function that "generates" signals.
Definition: SignalsWaitTestCase.cpp:111
void queuedSignalsThread(SequenceAsserter &sequenceAsserter, const unsigned int firstSequencePoint)
Test thread for signals that were "queued".
Definition: SignalsWaitTestCase.cpp:136
bool queuedSignalsTrigger(Thread &thread, const size_t index, const TestPhase &phase)
Trigger function that "queues" signals.
Definition: SignalsWaitTestCase.cpp:170
void generatedSignalsThread(SequenceAsserter &sequenceAsserter, const unsigned int firstSequencePoint)
Test thread for signals that were "generated".
Definition: SignalsWaitTestCase.cpp:80

test stages

◆ testThreadStackSize

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

size of stack for test thread, bytes