distortos  v0.5.0
object-oriented C++ RTOS for microcontrollers
distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep Class Referenceabstract

base of test steps More...

Inheritance diagram for distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep:
[legend]

Public Member Functions

constexpr TestStep (const uint8_t totalSequencePoints, const uint8_t expectedContextSwitchCount, const uint8_t signalingThreadSequencePoint1, const uint8_t signalHandlerSequencePoint, const uint8_t joinSequencePoint, const uint8_t signalingThreadSequencePoint2)
 TestStep's constructor. More...
 
virtual ~TestStep ()
 TestStep's virtual destructor. More...
 
bool run (SequenceAsserter &sequenceAsserter)
 Runs test step. More...
 
std::pair< uint8_t, uint8_t > getParameters () const
 Gets execution parameters of test step. More...
 

Private Member Functions

virtual bool block ()=0
 Executes the action that will block current thread. More...
 
virtual bool postcondition ()
 Checks postcondition of the test step. More...
 
void signalingThreadFunction (SequenceAsserter &sequenceAsserter, Thread &thread) const
 Queues signal to provided thread. More...
 

Private Attributes

uint8_t totalSequencePoints_
 total number of sequence points used in test step More...
 
uint8_t expectedContextSwitchCount_
 expected number of context switches during test step More...
 
uint8_t signalingThreadSequencePoint1_
 first sequence point used in signalingThreadFunction() More...
 
uint8_t signalHandlerSequencePoint_
 sequence point used in SignalsInterruptionTestCase::signalHandler() More...
 
uint8_t joinSequencePoint_
 sequence point used before joining with the thread that executes signalingThreadFunction() More...
 
uint8_t signalingThreadSequencePoint2_
 second sequence point used in signalingThreadFunction() More...
 

Detailed Description

base of test steps

Constructor & Destructor Documentation

◆ TestStep()

constexpr distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep::TestStep ( const uint8_t  totalSequencePoints,
const uint8_t  expectedContextSwitchCount,
const uint8_t  signalingThreadSequencePoint1,
const uint8_t  signalHandlerSequencePoint,
const uint8_t  joinSequencePoint,
const uint8_t  signalingThreadSequencePoint2 
)
inline

TestStep's constructor.

Parameters
[in]totalSequencePointsis the total number of sequence points used in test step
[in]expectedContextSwitchCountis the expected number of context switches during test step
[in]signalingThreadSequencePoint1is the first sequence point used in signalingThreadFunction()
[in]signalHandlerSequencePointis the sequence point used in SignalsInterruptionTestCase::signalHandler()
[in]joinSequencePointis the sequence point used before joining with the thread that executes signalingThreadFunction()
[in]signalingThreadSequencePoint2is the second sequence point used in signalingThreadFunction()

◆ ~TestStep()

virtual distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep::~TestStep ( )
inlinevirtual

TestStep's virtual destructor.

Member Function Documentation

◆ block()

◆ getParameters()

std::pair<uint8_t, uint8_t> distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep::getParameters ( ) const
inline

Gets execution parameters of test step.

Returns
std::pair with total number of sequence points used in test step (first element) and expected number of context switches during test step (second element)

◆ postcondition()

virtual bool distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep::postcondition ( )
inlineprivatevirtual

Checks postcondition of the test step.

This should be overridden by derived classes if there is some postcondition to check.

Returns
true if postcondition was satisfied, false otherwise

Reimplemented in distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::SemaphoreTestStep, distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::MutexTestStep, and distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::ConditionVariableTestStep.

◆ run()

bool distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep::run ( SequenceAsserter sequenceAsserter)
inline

Runs test step.

Creates and starts a thread that executes signalingThreadFunction(). Then pure virtual block() is called and its execution time is measured. After that the thread is joined, duration of block() execution is checked (must be 0) and pure virtual postiondition() is called.

Parameters
[in]sequenceAsserteris a reference to shared SequenceAsserter object
Returns
true if the test step succeeded, false otherwise
Here is the call graph for this function:

◆ signalingThreadFunction()

void distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep::signalingThreadFunction ( SequenceAsserter sequenceAsserter,
Thread thread 
) const
inlineprivate

Queues signal to provided thread.

Parameters
[in]sequenceAsserteris a reference to shared SequenceAsserter object
[in]threadis a reference to Thread to which the signal will be queued
Here is the call graph for this function:

Member Data Documentation

◆ expectedContextSwitchCount_

uint8_t distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep::expectedContextSwitchCount_
private

expected number of context switches during test step

◆ joinSequencePoint_

uint8_t distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep::joinSequencePoint_
private

sequence point used before joining with the thread that executes signalingThreadFunction()

◆ signalHandlerSequencePoint_

uint8_t distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep::signalHandlerSequencePoint_
private

◆ signalingThreadSequencePoint1_

uint8_t distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep::signalingThreadSequencePoint1_
private

first sequence point used in signalingThreadFunction()

◆ signalingThreadSequencePoint2_

uint8_t distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep::signalingThreadSequencePoint2_
private

second sequence point used in signalingThreadFunction()

◆ totalSequencePoints_

uint8_t distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep::totalSequencePoints_
private

total number of sequence points used in test step


The documentation for this class was generated from the following file: