16 #include <cppunit/extensions/TestFactoryRegistry.h>
17 #include <cppunit/TextTestRunner.h>
18 #include <cppunit/CompilerOutputter.h>
19 #include <cppunit/TextOutputter.h>
20 #include <cppunit/XmlOutputter.h>
37 #include "GaudiKernel/ISvcLocator.h"
43 ISvcLocator * m_svcLoc;
50 std::string filename_in[SZ] = {
"../cmt/CppUnit_jobOptions.txt",
"../test/CppUnit_jobOptions.txt",
"../share/CppUnit_jobOptions.txt"};
53 for (
int i=0;
i<SZ;
i++)
78 FileName =
"../run/CppUnit_jobOptions_generated.txt";
79 std::system(
"touch ../run/CppUnit_jobOptions_generated.txt; rm ../run/CppUnit_jobOptions_generated.txt");
80 std::ofstream jobopt(
"../run/CppUnit_jobOptions_generated.txt");
83 std::list<std::string>
opts;
84 opts.push_back(
"#pragma print off");
85 opts.push_back(
"ApplicationMgr.Dlls += { \"StoreGate\" };");
87 opts.push_back(
"ApplicationMgr.ExtSvc += { \"ClassIDSvc\" };");
88 opts.push_back(
"ApplicationMgr.ExtSvc += { \"StoreGateSvc\", \"StoreGateSvc/DetectorStore\", \"StoreGateSvc/HistoryStore\" };");
89 opts.push_back(
"ApplicationMgr.ExtSvc += { \"ActiveStoreSvc\" };");
90 opts.push_back(
"AuditorSvc.Auditors += { \"AlgContextAuditor\"};");
91 opts.push_back(
"StoreGateSvc.OutputLevel = 2;");
92 opts.push_back(
"StoreGateSvc.ActivateHistory = false;");
94 opts.push_back(
"MessageSvc.useColors = false;");
95 opts.push_back(
"MessageSvc.OutputLevel = 3;");
97 for ( std::list<std::string>::const_iterator iopt=
opts.begin();
98 iopt!=
opts.end(); ++iopt )
100 jobopt << *iopt << std::endl;
111 std::cerr <<
"This test can not be run" << std::endl;
114 CPPUNIT_ASSERT( 0 != m_svcLoc);
117 static const bool CREATE(
true);
118 bool sc = ( m_svcLoc->service(
"StoreGateSvc",
119 m_storeGate,
CREATE) ).isSuccess();
120 CPPUNIT_ASSERT(
sc );
121 CPPUNIT_ASSERT( 0 != m_storeGate );
123 if (
false ==
sc || 0 == m_storeGate ) {
124 std::string
error =
"No valid pointer to StoreGateSvc !!";
125 std::cerr <<
error << std::endl;
132 std::cerr <<
"Catched : " <<
e.what() << std::endl;
145 std::string
error =
"Could not setup StoreGateSvc !!";
146 throw std::runtime_error(
error);
150 CppUnit::Test *
suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
153 CppUnit::TextTestRunner
runner;
170 bool wasSuccessful =
runner.run(
"",
false,
true,
false);
173 if (!wasSuccessful)
return 1;