LLVM OpenMP 22.0.0git
omptest::OmptSequencedAsserter Class Reference

Class that can assert in a sequenced fashion, i.e., events have to occur in the order they were registered. More...

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/openmp/tools/omptest/include/OmptAsserter.h"

Inheritance diagram for omptest::OmptSequencedAsserter:
[legend]

Public Member Functions

 OmptSequencedAsserter ()
void insert (omptest::OmptAssertEvent &&AE) override
 Add the event to the in-sequence set of events that the asserter should check for.
virtual void notifyImpl (omptest::OmptAssertEvent &&AE) override
 Implements the asserter's actual logic.
size_t getRemainingEventCount () override
 Get the number of currently remaining events, with: ObserveState::Always.
omptest::AssertState checkState () override
 Determine and return the asserter's state.
Public Member Functions inherited from omptest::OmptAsserter
 OmptAsserter ()
virtual ~OmptAsserter ()=default
void notify (omptest::OmptAssertEvent &&AE) override
 Called from the CallbackHandler with a corresponding AssertEvent to which callback was handled.
int getNotificationCount ()
 Get the total number of received, effective notifications.
int getSuccessfulAssertionCount ()
 Get the total number of successful assertion checks.
AssertMode getOperationMode ()
 Get the asserter's current operationmode: e.g.: Strict or Relaxed.
omptest::AssertState getState ()
 Return the asserter's current state.
std::shared_ptr< OmptEventGroupInterfacegetEventGroups () const
 Accessor for the event group interface.
std::shared_ptr< logging::LoggergetLog () const
 Accessor for the event group interface.
bool verifyEventGroups (const omptest::OmptAssertEvent &ExpectedEvent, const omptest::OmptAssertEvent &ObservedEvent)
 Check the observed events' group association.
void setOperationMode (AssertMode Mode)
 Set the asserter's mode of operation w.r.t. assertion.
Public Member Functions inherited from omptest::OmptListener
virtual ~OmptListener ()=default
void setActive (bool Enabled)
 Control whether this asserter should be considered 'active'.
bool isActive ()
 Check if this asserter is considered 'active'.
bool isSuppressedEventType (omptest::internal::EventTy EvTy)
 Check if the given event type is from the set of suppressed event types.
void permitEvent (omptest::internal::EventTy EvTy)
 Remove the given event type to the set of suppressed events.
void suppressEvent (omptest::internal::EventTy EvTy)
 Add the given event type to the set of suppressed events.

Public Attributes

bool AssertionSuspended {false}
size_t NextEvent {0}
 Index of the next, expected event.
std::vector< omptest::OmptAssertEventEvents {}

Protected Member Functions

bool consumeSyncPoint (const omptest::OmptAssertEvent &AE)
 Notification helper function, implementing SyncPoint logic.
bool checkExcessNotify (const omptest::OmptAssertEvent &AE)
 Notification helper function, implementing excess event notification logic.
bool consumeSuspend ()
 Notification helper function, implementing Suspend logic.
bool consumeRegularEvent (const omptest::OmptAssertEvent &AE)
 Notification helper function, implementing regular event notification logic.

Additional Inherited Members

Protected Attributes inherited from omptest::OmptAsserter
omptest::AssertState State {omptest::AssertState::Pass}
 The asserter's current state.
std::mutex AssertMutex
 Mutex to avoid data races w.r.t. event notifications and/or insertions.
std::shared_ptr< OmptEventGroupInterfaceEventGroups {nullptr}
 Pointer to the OmptEventGroupInterface.
std::shared_ptr< logging::LoggerLog {nullptr}
 Pointer to the logging instance.
AssertMode OperationMode {AssertMode::Strict}
 Operation mode during assertion / notification.
int NumNotifications {0}
 The total number of effective notifications.
int NumSuccessfulAsserts {0}
 The number of successful assertion checks.

Detailed Description

Class that can assert in a sequenced fashion, i.e., events have to occur in the order they were registered.

Definition at line 174 of file OmptAsserter.h.

Constructor & Destructor Documentation

◆ OmptSequencedAsserter()

omptest::OmptSequencedAsserter::OmptSequencedAsserter ( )
inline

Definition at line 176 of file OmptAsserter.h.

References NextEvent, and omptest::OmptAsserter::OmptAsserter().

Member Function Documentation

◆ checkExcessNotify()

bool OmptSequencedAsserter::checkExcessNotify ( const omptest::OmptAssertEvent & AE)
protected

Notification helper function, implementing excess event notification logic.

Returns true when no more events were expected, indicating early exit of notification.

Definition at line 261 of file OmptAsserter.cpp.

References AssertionSuspended, Events, omptest::Fail, omptest::OmptAsserter::Log, NextEvent, omptest::OmptAsserter::NumNotifications, omptest::OmptAsserter::NumSuccessfulAsserts, and omptest::OmptAsserter::State.

Referenced by notifyImpl().

◆ checkState()

AssertState OmptSequencedAsserter::checkState ( )
overridevirtual

Determine and return the asserter's state.

Reimplemented from omptest::OmptAsserter.

Definition at line 333 of file OmptAsserter.cpp.

References omptest::Always, Events, omptest::Fail, getRemainingEventCount(), i, omptest::OmptAsserter::Log, NextEvent, and omptest::OmptAsserter::State.

◆ consumeRegularEvent()

bool OmptSequencedAsserter::consumeRegularEvent ( const omptest::OmptAssertEvent & AE)
protected

Notification helper function, implementing regular event notification logic.

Returns true when a matching event was encountered, indicating early exit of notification.

Definition at line 297 of file OmptAsserter.cpp.

References omptest::Always, AssertionSuspended, Events, omptest::Fail, omptest::OmptAsserter::Log, omptest::Never, NextEvent, omptest::OmptAsserter::NumSuccessfulAsserts, omptest::OmptAsserter::State, and omptest::OmptAsserter::verifyEventGroups().

Referenced by notifyImpl().

◆ consumeSuspend()

bool OmptSequencedAsserter::consumeSuspend ( )
protected

Notification helper function, implementing Suspend logic.

Returns true in case of consumed event, indicating early exit of notification.

Definition at line 282 of file OmptAsserter.cpp.

References AssertionSuspended, Events, and NextEvent.

Referenced by notifyImpl().

◆ consumeSyncPoint()

bool OmptSequencedAsserter::consumeSyncPoint ( const omptest::OmptAssertEvent & AE)
protected

Notification helper function, implementing SyncPoint logic.

Returns true in case of consumed event, indicating early exit of notification.

Definition at line 239 of file OmptAsserter.cpp.

References Events, omptest::Fail, omptest::OmptAssertEvent::getEventType(), getRemainingEventCount(), omptest::OmptAsserter::Log, omptest::OmptAsserter::NumSuccessfulAsserts, and omptest::OmptAsserter::State.

Referenced by notifyImpl().

◆ getRemainingEventCount()

size_t OmptSequencedAsserter::getRemainingEventCount ( )
overridevirtual

Get the number of currently remaining events, with: ObserveState::Always.

Implements omptest::OmptAsserter.

Definition at line 324 of file OmptAsserter.cpp.

References Events, and omptest::OmptAsserter::NumSuccessfulAsserts.

Referenced by checkState(), and consumeSyncPoint().

◆ insert()

void OmptSequencedAsserter::insert ( omptest::OmptAssertEvent && AE)
overridevirtual

Add the event to the in-sequence set of events that the asserter should check for.

Reimplemented from omptest::OmptAsserter.

Definition at line 205 of file OmptAsserter.cpp.

References omptest::OmptAsserter::AssertMutex, and Events.

◆ notifyImpl()

Member Data Documentation

◆ AssertionSuspended

bool omptest::OmptSequencedAsserter::AssertionSuspended {false}

Definition at line 189 of file OmptAsserter.h.

Referenced by checkExcessNotify(), consumeRegularEvent(), consumeSuspend(), and notifyImpl().

◆ Events

std::vector<omptest::OmptAssertEvent> omptest::OmptSequencedAsserter::Events {}

◆ NextEvent

size_t omptest::OmptSequencedAsserter::NextEvent {0}

Index of the next, expected event.

Definition at line 212 of file OmptAsserter.h.

Referenced by checkExcessNotify(), checkState(), consumeRegularEvent(), consumeSuspend(), notifyImpl(), and OmptSequencedAsserter().


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