ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
AtlasTest
GoogleTestTools
src
InitGaudiGoogleTest.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
GoogleTestTools/InitGaudiGoogleTest.h
"
6
7
#include "GaudiKernel/Bootstrap.h"
8
#include "GaudiKernel/IAppMgrUI.h"
9
10
#include <iostream>
11
#include <fstream>
12
13
namespace
Athena_test
{
14
15
InitGaudiGoogleTest::InitGaudiGoogleTest
(
const
std::string& jobOptsPath, MSG::Level level ) :
16
// create a new ApplicationMgr w/o singleton behaviour
17
theApp
(
Gaudi
::createApplicationMgrEx(
"GaudiCoreSvc"
,
"ApplicationMgr"
) ),
18
propMgr
(
theApp
),
19
svcLoc
(
theApp
),
20
svcMgr
(
theApp
),
21
toolSvc
(
svcLoc
->service(
"ToolSvc"
) )
22
{
23
EXPECT_TRUE(
theApp
!=
nullptr
);
24
EXPECT_TRUE(
propMgr
.isValid() );
25
EXPECT_TRUE(
svcLoc
.isValid() );
26
EXPECT_TRUE(
svcMgr
.isValid() );
27
EXPECT_TRUE(
toolSvc
.isValid() );
28
// set the new ApplicationMgr as instance in Gaudi
29
Gaudi::setInstance(
theApp
);
30
31
EXPECT_TRUE(
propMgr
->setProperty(
"OutputLevel"
, std::to_string( level ) ).isSuccess() );
32
if
(jobOptsPath.empty()) {
33
EXPECT_TRUE(
propMgr
->setProperty(
"JobOptionsType"
,
"NONE"
).isSuccess() );
34
}
35
else
{
36
EXPECT_TRUE(
propMgr
->setProperty(
"JobOptionsType"
,
"FILE"
).isSuccess() );
37
EXPECT_TRUE(
propMgr
->setProperty(
"JobOptionsPath"
, jobOptsPath ).isSuccess() );
38
}
39
EXPECT_TRUE(
theApp
->configure().isSuccess() );
40
EXPECT_TRUE(
theApp
->initialize().isSuccess() );
41
}
42
43
// Finalize and terminate Gaudi, more to make sure that things
44
// went clean than anything else because we are throwing away the
45
// ApplicationMgr anyway
46
InitGaudiGoogleTest::~InitGaudiGoogleTest
() {
47
EXPECT_TRUE(
theApp
->finalize().isSuccess() );
48
EXPECT_TRUE(
theApp
->terminate().isSuccess() );
49
}
50
51
InitGaudiGoogleTest::InitGaudiGoogleTest
(
const
std::string& jobOptsPath ) :
52
InitGaudiGoogleTest
(jobOptsPath,
MSG
::INFO) {}
53
54
InitGaudiGoogleTest::InitGaudiGoogleTest
( MSG::Level level ) :
55
InitGaudiGoogleTest
({}, level) {}
56
57
}
58
InitGaudiGoogleTest.h
Gaudi initialisation fixture base class for googletest based unit tests. Test fixture classes for tes...
Athena_test::InitGaudiGoogleTest::theApp
IAppMgrUI * theApp
public members are visible in tests
Definition
InitGaudiGoogleTest.h:52
Athena_test::InitGaudiGoogleTest::svcMgr
SmartIF< ISvcManager > svcMgr
Definition
InitGaudiGoogleTest.h:55
Athena_test::InitGaudiGoogleTest::propMgr
SmartIF< IProperty > propMgr
Definition
InitGaudiGoogleTest.h:53
Athena_test::InitGaudiGoogleTest::svcLoc
SmartIF< ISvcLocator > svcLoc
Definition
InitGaudiGoogleTest.h:54
Athena_test::InitGaudiGoogleTest::InitGaudiGoogleTest
InitGaudiGoogleTest(MSG::Level level=MSG::INFO)
Create GoogleTest fixture.
Definition
InitGaudiGoogleTest.cxx:54
Athena_test::InitGaudiGoogleTest::~InitGaudiGoogleTest
virtual ~InitGaudiGoogleTest()
dtor
Definition
InitGaudiGoogleTest.cxx:46
Athena_test::InitGaudiGoogleTest::toolSvc
SmartIF< IToolSvc > toolSvc
Definition
InitGaudiGoogleTest.h:56
Athena_test
functions & macros to test the difference between floats
Definition
InitGaudiGoogleTest.h:30
Gaudi
=============================================================================
Definition
CaloGPUClusterAndCellDataMonitorOptions.h:273
MSG
Definition
MsgLevel.h:28
Generated on
for ATLAS Offline Software by
1.17.0