File indexing completed on 2024-06-07 02:29:40
0001 #define CATCH_CONFIG_MAIN
0002 #include "catch.hpp"
0003
0004 #include "FWCore/ParameterSetReader/interface/ParameterSetReader.h"
0005 #include "FWCore/PluginManager/interface/PluginManager.h"
0006 #include "FWCore/PluginManager/interface/standard.h"
0007 #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
0008
0009 class ServiceRegistryListener : public Catch::TestEventListenerBase {
0010 public:
0011 using Catch::TestEventListenerBase::TestEventListenerBase;
0012
0013 void testRunStarting(Catch::TestRunInfo const& testRunInfo) override {
0014 edmplugin::PluginManager::configure(edmplugin::standard::config());
0015
0016 const std::string config{
0017 R"_(import FWCore.ParameterSet.Config as cms
0018 process = cms.Process('Test')
0019 process.CUDAService = cms.Service('CUDAService')
0020 process.AsyncService = cms.Service('AsyncService')
0021 )_"};
0022
0023 std::unique_ptr<edm::ParameterSet> params;
0024 edm::makeParameterSets(config, params);
0025 edm::ServiceToken tempToken(edm::ServiceRegistry::createServicesFromConfig(std::move(params)));
0026 operate_.reset(new edm::ServiceRegistry::Operate(tempToken));
0027 }
0028
0029 private:
0030 std::unique_ptr<edm::ServiceRegistry::Operate> operate_;
0031 };
0032 CATCH_REGISTER_LISTENER(ServiceRegistryListener);