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

test step for mutexes More...

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

Public Types

enum  Type : uint8_t { Type::lock, Type::tryLockFor, Type::tryLockUntil }
 type of mutex test step More...
 

Public Member Functions

 MutexTestStep (const Type type, SequenceAsserter &sequenceAsserter)
 MutexTestStep's constructor. More...
 
 ~MutexTestStep () override
 MutexTestStep's virtual destructor. More...
 
- Public Member Functions inherited from distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep
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

bool block () override
 Executes the action that will block current thread. More...
 
void mutexLockerThreadFunction ()
 Main function of internal "mutex locker" thread. More...
 
bool postcondition () override
 Checks postcondition of the test step. More...
 

Private Attributes

DynamicThread mutexLockerThread_
 internal "mutex locker" thread More...
 
Mutex mutex_
 tested object More...
 
SequenceAssertersequenceAsserter_
 reference to shared SequenceAsserter object More...
 
Type type_
 type of test step More...
 

Detailed Description

test step for mutexes

Member Enumeration Documentation

◆ Type

enum distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::MutexTestStep::Type : uint8_t
strong

type of mutex test step

Enumerator
lock 

uses Mutex::lock()

tryLockFor 

uses Mutex::tryLockFor()

tryLockUntil 

uses Mutex::tryLockUntil()

Constructor & Destructor Documentation

◆ MutexTestStep()

distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::MutexTestStep::MutexTestStep ( const Type  type,
SequenceAsserter sequenceAsserter 
)
inline

MutexTestStep's constructor.

Parameters
[in]typeis the type of test step
[in]sequenceAsserteris a reference to shared SequenceAsserter object

◆ ~MutexTestStep()

distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::MutexTestStep::~MutexTestStep ( )
inlineoverride

MutexTestStep's virtual destructor.

Joins the "mutex locker" thread.

Member Function Documentation

◆ block()

bool distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::MutexTestStep::block ( )
inlineoverrideprivatevirtual

Executes the action that will block current thread.

Starts internal "mutex locker" thread. Then calls Mutex::lock(), Mutex::tryLockFor() or Mutex::tryLockUntil() - depending on the type of test step - and ensures that the function completes successfully.

Returns
true if execution of blocking action succeeded, false otherwise

Implements distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep.

Here is the call graph for this function:

◆ mutexLockerThreadFunction()

void distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::MutexTestStep::mutexLockerThreadFunction ( )
inlineprivate

Main function of internal "mutex locker" thread.

Locks the mutex, changes its priority to veryLowPriority (causing preemption) and unlocks the mutex.

Here is the call graph for this function:

◆ postcondition()

bool distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::MutexTestStep::postcondition ( )
inlineoverrideprivatevirtual

Checks postcondition of the test step.

Checks state of mutex after test step.

Returns
true if postcondition was satisfied, false otherwise

Reimplemented from distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::TestStep.

Member Data Documentation

◆ mutex_

Mutex distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::MutexTestStep::mutex_
private

tested object

◆ mutexLockerThread_

DynamicThread distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::MutexTestStep::mutexLockerThread_
private

internal "mutex locker" thread

◆ sequenceAsserter_

SequenceAsserter& distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::MutexTestStep::sequenceAsserter_
private

reference to shared SequenceAsserter object

◆ type_

Type distortos::test::anonymous_namespace{SignalsInterruptionTestCase.cpp}::MutexTestStep::type_
private

type of test step


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