File indexing completed on 2025-05-09 22:37:32
0001 #include "FWCore/TestProcessor/interface/TestProcessor.h"
0002 #include "FWCore/Utilities/interface/Exception.h"
0003 #include "FWCore/ServiceRegistry/interface/Service.h"
0004
0005 #define CATCH_CONFIG_MAIN
0006 #include "catch.hpp"
0007
0008
0009
0010 void runTestForAnalyzer(const std::string& baseConfig, const std::string& analyzerName) {
0011 edm::test::TestProcessor::Config config{baseConfig};
0012
0013 SECTION(analyzerName + " base configuration is OK") { REQUIRE_NOTHROW(edm::test::TestProcessor(config)); }
0014
0015 SECTION("Run with no LuminosityBlocks") {
0016 edm::test::TestProcessor tester(config);
0017 REQUIRE_NOTHROW(tester.testRunWithNoLuminosityBlocks());
0018 }
0019 }
0020
0021
0022
0023 std::string generateBaseConfig(const std::string& cfiName, const std::string& analyzerName) {
0024
0025 constexpr const char* rawString = R"_(from FWCore.TestProcessor.TestProcess import *
0026 from DQM.EcalCommon.{}_cfi import {}
0027 process = TestProcess()
0028 process.harvester = {}
0029 process.moduleToTest(process.harvester)
0030 process.add_(cms.Service('MessageLogger'))
0031 process.add_(cms.Service('JobReportService'))
0032 process.add_(cms.Service('DQMStore'))
0033 )_";
0034
0035
0036 return fmt::format(rawString, cfiName, analyzerName, analyzerName);
0037 }
0038
0039
0040 TEST_CASE("EcalMEFormatter tests", "[EcalMEFormatter]") {
0041 const std::string baseConfig = generateBaseConfig("EcalMEFormatter", "ecalMEFormatter");
0042 runTestForAnalyzer(baseConfig, "EcalMEFormatter");
0043 }