Lumiera  0.pre.03
»edit your freedom«
DiagnosticContext_test Class Reference

Description

Test:
verify a diagnostic facility to collect and access contextual information.

DiagnosticContext frames are placed into automatic storage (as local variable within some function scope). Based on thread-local storage, the next reachable frame can be accessed from anywhere within the callstack. This feature is useful for collecting information regarding features cross-cutting the usual dependency hierarchy.

See also
lib::DiagnosticContext
lib::ThreadJoinable

Definition at line 88 of file diagnostic-context-test.cpp.

Classes

struct  TestThread
 build a call stack within separate thread and capture diagnostics More...
 

Private Member Functions

virtual void run (Arg)
 
void verify_heavilyParallelUsage ()
 
void verify_simpleAccess ()
 

Static Private Member Functions

static VecI descend (uint current)
 
static VecI verifyDiagnosticStack ()
 the actual test operation running in a separate thread produces a descending number sequence, and only odd values will be captured into the diagnostic stack
 

Member Function Documentation

◆ verify_simpleAccess()

void verify_simpleAccess ( )
inlineprivate
Test:
create nested scopes and place a DiagnosticContext frame into each.

Access the next reachable frame.

Definition at line 105 of file diagnostic-context-test.cpp.

References DiagnosticContext< VAL >::access(), DiagnosticContext< VAL >::extractStack(), lib::test::anonymous_namespace{builder-qualifier-support-test.cpp}::one(), lib::test::anonymous_namespace{builder-qualifier-support-test.cpp}::two(), and VERIFY_ERROR.

+ Here is the call graph for this function:

◆ verify_heavilyParallelUsage()

void verify_heavilyParallelUsage ( )
inlineprivate
Test:
verify the thread local property of ContextStack.

Create several threads, each of which processes a sequence of numbers starting from a random initial value down to one. Whenever a simple division by two leads to an odd value, this value is placed onto the ContextStack. At recursion end, we take a snapshot of the full ContextStack and then unwind. Thus the captured numbers must from a decreasing sequence of odd values.

Warning
this test case seems to cause memory pressure. When running the test suite with VSize limit 500MB, we frequently got aborts even with 40 threads. This is surprising, since all of the lists generated in the individual threads are of size below 20 elements.

Definition at line 163 of file diagnostic-context-test.cpp.

+ Inheritance diagram for DiagnosticContext_test:
+ Collaboration diagram for DiagnosticContext_test:

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