Skip to content
Snippets Groups Projects
Commit 6acccd72 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'thread.InDetEtaDependentCuts-20200630' into 'master'

InDetEtaDependentCuts: Avoid thread-safety checker warnings.

See merge request atlas/athena!34318
parents 7e05c137 538a8dee
No related branches found
No related tags found
No related merge requests found
......@@ -24,17 +24,18 @@ ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // This is for unit tests and a static variab
struct IDEDC_GaudiFixtureBase{
ISvcLocator* svcLoc{};
static bool gaudiIsInitialised;
const std::string jobOpts{};
IDEDC_GaudiFixtureBase(const std::string & jobOptionFile = "InDetEtaDependentCutsTestJobOpts.txt"):jobOpts(jobOptionFile){
static bool initGaudi (const std::string & jobOptionFile, ISvcLocator*& svcLoc)
{
CxxUtils::ubsan_suppress ([]() { TInterpreter::Instance(); } );
if (not gaudiIsInitialised){
std::string fullJobOptsName="InDetEtaDependentCuts/" + jobOpts;
gaudiIsInitialised=Athena_test::initGaudi(fullJobOptsName, svcLoc);
}
std::string fullJobOptsName="InDetEtaDependentCuts/" + jobOptionFile;
return Athena_test::initGaudi(fullJobOptsName, svcLoc);
}
IDEDC_GaudiFixtureBase(const std::string & jobOptionFile = "InDetEtaDependentCutsTestJobOpts.txt"):jobOpts(jobOptionFile){
static const bool gaudiIsInitialized [[maybe_unused]]
= initGaudi (jobOptionFile, svcLoc);
}
};
bool IDEDC_GaudiFixtureBase::gaudiIsInitialised=false;
#endif
......@@ -36,22 +36,24 @@ struct GaudiKernelFixture:public IDEDC_GaudiFixtureBase{
using namespace InDet;
BOOST_AUTO_TEST_SUITE(EtaDependentCutsSvcTest)
GaudiKernelFixture g(testJobOptionsFile);
const GaudiKernelFixture g(testJobOptionsFile);
const auto & svcLoc=g.svcLoc;
ServiceHandle<IInDetEtaDependentCutsSvc> idEDCSvc ("InDet::InDetEtaDependentCutsSvc", "test");
BOOST_AUTO_TEST_CASE( sanityCheck ){
const bool svcLocatorIsOk=(svcLoc != nullptr);
BOOST_TEST(svcLocatorIsOk);
}
BOOST_AUTO_TEST_CASE( retrieveSvc ){
ServiceHandle<IInDetEtaDependentCutsSvc> idEDCSvc ("InDet::InDetEtaDependentCutsSvc", "test");
BOOST_TEST (idEDCSvc.retrieve().isSuccess());
}
BOOST_AUTO_TEST_CASE( interfaceID ){
ServiceHandle<IInDetEtaDependentCutsSvc> idEDCSvc ("InDet::InDetEtaDependentCutsSvc", "test");
InterfaceID testId("IInDetEtaDependentCutsSvc",1,0);
BOOST_TEST(idEDCSvc->interfaceID()==testId);
}
BOOST_AUTO_TEST_CASE(publicMethods){
ServiceHandle<IInDetEtaDependentCutsSvc> idEDCSvc ("InDet::InDetEtaDependentCutsSvc", "test");
BOOST_TEST(idEDCSvc->getMaxEta() == 4.0);
}
BOOST_AUTO_TEST_SUITE_END()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment