#include "GaudiEnv.h"
#include <Gaudi/Algorithm.h>
#include <Gaudi/PluginService.h>
#include <GaudiKernel/Bootstrap.h>
#include <GaudiKernel/IAlgorithm.h>
#include <regex>
#include <typeinfo>
Go to the source code of this file.
◆ main()
Definition at line 20 of file ToolVisitorTest_test.cpp.
22 const auto& reg = Gaudi::PluginService::Details::Registry::instance();
25 const auto& info = reg.getInfo(
"GaudiTesting::TestAlg",
true );
26 using Traits = Gaudi::PluginService::Details::Traits<
IAlgorithm*(
const std::string&,
ISvcLocator* )>;
27 using FactoryType =
typename Traits::FactoryType;
29 DEBUG_TRACE( std::cout <<
"DEBUG get factory " << info.library <<
"\n type : " << info.factory.type().name()
30 <<
"\n exp. : " <<
typeid( FactoryType ).name() << std::endl );
31 auto alg = std::any_cast<FactoryType>( info.factory )(
"TestAlg", &( *(
gaudi.m_svcLoc ) ) );
32 std::cout <<
"INFO got alg " <<
alg->name()
33 <<
" with some inputs renounced. Should not \"have\" implicit circular dependencies." << std::endl;
35 if (
alg->sysInitialize().isFailure() )
return 1;
36 DEBUG_TRACE( std::cout <<
"DEBUG finalize " <<
alg->name() << std::endl );
37 if (
alg->sysFinalize().isFailure() )
return 1;
38 DEBUG_TRACE( std::cout <<
"DEBUG FINALIZED " <<
alg->name() << std::endl );
40 alg = std::any_cast<FactoryType>( info.factory )(
"TestAlgBug", &( *(
gaudi.m_svcLoc ) ) );
43 <<
"INFO Now check that initialize will fail when there are circular dependencies which should be the case for "
44 <<
alg->name() << std::endl;
45 if ( !
alg->sysInitialize().isFailure() ) {
46 DEBUG_TRACE( std::cout <<
"DEBUG finalize " <<
alg->name() << std::endl );
47 if (
alg->sysFinalize().isFailure() )
return 1;
48 DEBUG_TRACE( std::cout <<
"DEBUG FINALIZED " <<
alg->name() << std::endl );
51 std::cout <<
"INFO Good. Initialize of " <<
alg->name() <<
" failed as it should." << std::endl;
54 std::cout <<
"INFO Test passed." << std::endl;