8# pragma GCC diagnostic push
9# pragma GCC diagnostic ignored "-Wpedantic"
11#include "tbb/parallel_reduce.h"
12#include "tbb/blocked_range.h"
14# pragma GCC diagnostic pop
30 RedirStderr (
const RedirStderr&) =
delete;
31 RedirStderr& operator= (
const RedirStderr&) =
delete;
40RedirStderr::RedirStderr()
42 if (dlsym (RTLD_DEFAULT,
"__ubsan_handle_add_overflow") != NULL) {
43 m_nullfd =
open (
"/dev/null", O_WRONLY);
50 m_nullfd = m_stderr = -1;
56RedirStderr::~RedirStderr()
72 return tbb::parallel_reduce( tbb::blocked_range<int>( 0, nrepeats, 1 ),
74 [&]( tbb::blocked_range<int>,
bool statusSoFar ) ->
bool {
77 [](
bool allCallsStatus,
bool thisCallStatus ) ->
bool {
78 return allCallsStatus and thisCallStatus;
92 return tbb::parallel_reduce( tbb::blocked_range< std::vector<ParallelCallTest*>::const_iterator >( tests.begin(), tests.end() ),
94 [&]( tbb::blocked_range< std::vector<ParallelCallTest*>::const_iterator > groupOfTests,
bool statusSoFar ) ->
bool {
96 for ( auto test : groupOfTests ) {
97 success = test->run( nrepeats ) and success;
99 return statusSoFar and success;
101 [](
bool allCallsStatus,
bool thisCallStatus ) ->
bool {
102 return allCallsStatus and thisCallStatus;
bool run(size_t nrepeats)
runs the stress test by invoking it the firstCall and then repetitively the callAndCompare
virtual bool callAndCompare() const =0
a function that performs request, and compares the results obtained with the result of the first exec...
virtual void firstCall()=0
a method that will be called to obtain first results from the service It should set the reference qua...
static bool launchTests(size_t nrepeats, const std::vector< ParallelCallTest * > &tests)
Method to run launch number of tests in parallel (increasing the stress of the calle) It has a potent...