Skip to content

Commit

Permalink
Merge pull request #33549 from Dr15Jones/stopExtraThreadsInTests
Browse files Browse the repository at this point in the history
Use only 1 thread when testing EventProcessor
  • Loading branch information
cmsbuild authored Apr 28, 2021
2 parents 32d5a10 + 82ff50a commit a188477
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions FWCore/Framework/test/eventprocessor2_t.cppunit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Test of the EventProcessor class.
#include "FWCore/PluginManager/interface/standard.h"
#include "FWCore/ParameterSetReader/interface/ParameterSetReader.h"

#include "tbb/global_control.h"

// to be called also by the other cppunit...
void doInit() {
static bool firstTime = true;
Expand All @@ -32,8 +34,13 @@ class testeventprocessor2 : public CppUnit::TestFixture {
CPPUNIT_TEST(eventprocessor2Test);
CPPUNIT_TEST_SUITE_END();

edm::propagate_const<std::unique_ptr<tbb::global_control>> m_control;

public:
void setUp() {
if (not m_control) {
m_control = std::make_unique<tbb::global_control>(tbb::global_control::max_allowed_parallelism, 1);
}
//std::cout << "setting up testeventprocessor2" << std::endl;
doInit();
}
Expand Down
6 changes: 6 additions & 0 deletions FWCore/Framework/test/eventprocessor_t.cppunit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Test of the EventProcessor class.

#include "cppunit/extensions/HelperMacros.h"

#include "tbb/global_control.h"

#include <regex>

#include <exception>
Expand All @@ -47,6 +49,9 @@ class testeventprocessor : public CppUnit::TestFixture {
public:
void setUp() {
//std::cout << "setting up testeventprocessor" << std::endl;
if (not m_control) {
m_control = std::make_unique<tbb::global_control>(tbb::global_control::max_allowed_parallelism, 1);
}
doInit();
m_handler = std::make_unique<edm::AssertHandler>(); // propagate_const<T> has no reset() function
sleep_secs_ = 0;
Expand All @@ -63,6 +68,7 @@ class testeventprocessor : public CppUnit::TestFixture {

private:
edm::propagate_const<std::unique_ptr<edm::AssertHandler>> m_handler;
edm::propagate_const<std::unique_ptr<tbb::global_control>> m_control;
void work() {
//std::cout << "work in testeventprocessor" << std::endl;
std::string configuration(
Expand Down

0 comments on commit a188477

Please sign in to comment.