Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace string with InputTag in IntTestAnalyzer #31490

Merged
merged 3 commits into from Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 18 additions & 11 deletions FWCore/Framework/test/stubs/ToyAnalyzers.cc
Expand Up @@ -46,26 +46,33 @@ namespace edmtest {

//--------------------------------------------------------------------
//
class IntTestAnalyzer : public edm::EDAnalyzer {
class IntTestAnalyzer : public edm::global::EDAnalyzer<> {
public:
IntTestAnalyzer(edm::ParameterSet const& iPSet)
: value_(iPSet.getUntrackedParameter<int>("valueMustMatch")),
moduleLabel_(iPSet.getUntrackedParameter<std::string>("moduleLabel"), "") {
consumes<IntProduct>(moduleLabel_);
token_(consumes(iPSet.getUntrackedParameter<edm::InputTag>("moduleLabel"))) {}

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.addUntracked<int>("valueMustMatch");
desc.addUntracked<edm::InputTag>("moduleLabel");
descriptions.addDefault(desc);
}

void analyze(edm::Event const& iEvent, edm::EventSetup const&) {
edm::Handle<IntProduct> handle;
iEvent.getByLabel(moduleLabel_, handle);
if (handle->value != value_) {
throw cms::Exception("ValueMissMatch") << "The value for \"" << moduleLabel_ << "\" is " << handle->value
<< " but it was supposed to be " << value_;
void analyze(edm::StreamID, edm::Event const& iEvent, edm::EventSetup const&) const {
auto const& prod = iEvent.get(token_);
if (prod.value != value_) {
edm::ProductLabels labels;
labelsForToken(token_, labels);
throw cms::Exception("ValueMissMatch")
makortel marked this conversation as resolved.
Show resolved Hide resolved
<< "The value for \"" << labels.module << ":" << labels.productInstance << ":" << labels.process << "\" is "
<< prod.value << " but it was supposed to be " << value_;
}
}

private:
int value_;
edm::InputTag moduleLabel_;
int const value_;
edm::EDGetTokenT<IntProduct> const token_;
};

//--------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/test/test_InputTag_cache_failure_cfg.py
Expand Up @@ -28,7 +28,7 @@

process.getOne = cms.EDAnalyzer("IntTestAnalyzer",
valueMustMatch = cms.untracked.int32(1),
moduleLabel = cms.untracked.string('one')
moduleLabel = cms.untracked.InputTag('one')
)

process.p = cms.Path(process.double+process.doubleTwo+process.zInt+process.getOne)
2 changes: 1 addition & 1 deletion FWCore/Framework/test/test_deepCall_unscheduled_cfg.py
Expand Up @@ -59,7 +59,7 @@

process.get = cms.EDAnalyzer("IntTestAnalyzer",
valueMustMatch = cms.untracked.int32(4),
moduleLabel = cms.untracked.string('result4')
moduleLabel = cms.untracked.InputTag('result4')
)

process.t = cms.Task(process.one, process.result1, process.result2, process.result4)
Expand Down
Expand Up @@ -33,7 +33,7 @@

process.get = cms.EDAnalyzer("IntTestAnalyzer",
valueMustMatch = cms.untracked.int32(4),
moduleLabel = cms.untracked.string('result4')
moduleLabel = cms.untracked.InputTag('result4')
)

process.t = cms.Task(process.result1, process.result2, process.result4)
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/test/test_offPath_unscheduled_cfg.py
Expand Up @@ -28,12 +28,12 @@

process.getOne = cms.EDAnalyzer("IntTestAnalyzer",
valueMustMatch = cms.untracked.int32(1),
moduleLabel = cms.untracked.string('one')
moduleLabel = cms.untracked.InputTag('one')
)

process.getTwo = cms.EDAnalyzer("IntTestAnalyzer",
valueMustMatch = cms.untracked.int32(2),
moduleLabel = cms.untracked.string('two')
moduleLabel = cms.untracked.InputTag('two')
)

process.t = cms.Task(process.one, process.two)
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/test/test_onPath_unscheduled_cfg.py
Expand Up @@ -47,12 +47,12 @@

process.getOne = cms.EDAnalyzer("IntTestAnalyzer",
valueMustMatch = cms.untracked.int32(1),
moduleLabel = cms.untracked.string('one')
moduleLabel = cms.untracked.InputTag('one')
)

process.getTwo = cms.EDAnalyzer("IntTestAnalyzer",
valueMustMatch = cms.untracked.int32(2),
moduleLabel = cms.untracked.string('two')
moduleLabel = cms.untracked.InputTag('two')
)

process.p = cms.Path(process.one*process.getOne+process.two*process.getTwo)
Expand Down
Expand Up @@ -27,12 +27,12 @@

process.getOne = cms.EDAnalyzer("IntTestAnalyzer",
valueMustMatch = cms.untracked.int32(1),
moduleLabel = cms.untracked.string('one')
moduleLabel = cms.untracked.InputTag('one')
)

process.getTwo = cms.EDAnalyzer("IntTestAnalyzer",
valueMustMatch = cms.untracked.int32(2),
moduleLabel = cms.untracked.string('two')
moduleLabel = cms.untracked.InputTag('two')
)

process.p = cms.Path(process.two*process.getOne+process.one*process.getTwo)
Expand Up @@ -76,8 +76,6 @@ ModuleCallingContext state = Running
++++ starting: source run
++++ finished: source run
++++ starting: global begin run 1 : time = 1000000
++++++ starting: global begin run for module: label = 'get' id = 3
++++++ finished: global begin run for module: label = 'get' id = 3
++++ finished: global begin run 1 : time = 1000000
++++ starting: begin run: stream = 0 run = 1 time = 1000000
++++++ starting: begin run for module: stream = 0 label = 'one' id = 4
Expand Down Expand Up @@ -108,8 +106,6 @@ ModuleCallingContext state = Running
++++ starting: source lumi
++++ finished: source lumi
++++ starting: global begin lumi: run = 1 lumi = 1 time = 1000000
++++++ starting: global begin lumi for module: label = 'get' id = 3
++++++ finished: global begin lumi for module: label = 'get' id = 3
++++ finished: global begin lumi: run = 1 lumi = 1 time = 1000000
++++ starting: begin lumi: stream = 0 run = 1 lumi = 1 time = 1000000
++++++ starting: begin lumi for module: stream = 0 label = 'one' id = 4
Expand Down Expand Up @@ -512,8 +508,6 @@ ModuleCallingContext state = Running

++++ finished: end lumi: stream = 0 run = 1 lumi = 1 time = 1000030
++++ starting: global end lumi: run = 1 lumi = 1 time = 1000000
++++++ starting: global end lumi for module: label = 'get' id = 3
++++++ finished: global end lumi for module: label = 'get' id = 3
++++ finished: global end lumi: run = 1 lumi = 1 time = 1000000
++++ starting: global write lumi: run = 1 lumi = 1 time = 1000000
++++ finished: global write lumi: run = 1 lumi = 1 time = 1000000
Expand Down Expand Up @@ -544,8 +538,6 @@ ModuleCallingContext state = Running

++++ finished: end run: stream = 0 run = 1 time = 1000030
++++ starting: global end run 1 : time = 1000030
++++++ starting: global end run for module: label = 'get' id = 3
++++++ finished: global end run for module: label = 'get' id = 3
++++ finished: global end run 1 : time = 1000030
++++ starting: global write run 1 : time = 1000030
++++ finished: global write run 1 : time = 1000030
Expand Down
Expand Up @@ -44,10 +44,6 @@
++++ starting: source run
++++ finished: source run
++++ starting: global begin run 1 : time = 1000000
++++++ starting: global begin run for module: label = 'getOne' id = 4
++++++ finished: global begin run for module: label = 'getOne' id = 4
++++++ starting: global begin run for module: label = 'getTwo' id = 6
++++++ finished: global begin run for module: label = 'getTwo' id = 6
++++ finished: global begin run 1 : time = 1000000
++++ starting: begin run: stream = 0 run = 1 time = 1000000
++++++ starting: begin run for module: stream = 0 label = 'two' id = 5
Expand All @@ -58,10 +54,6 @@
++++ starting: source lumi
++++ finished: source lumi
++++ starting: global begin lumi: run = 1 lumi = 1 time = 1000000
++++++ starting: global begin lumi for module: label = 'getOne' id = 4
++++++ finished: global begin lumi for module: label = 'getOne' id = 4
++++++ starting: global begin lumi for module: label = 'getTwo' id = 6
++++++ finished: global begin lumi for module: label = 'getTwo' id = 6
++++ finished: global begin lumi: run = 1 lumi = 1 time = 1000000
++++ starting: begin lumi: stream = 0 run = 1 lumi = 1 time = 1000000
++++++ starting: begin lumi for module: stream = 0 label = 'two' id = 5
Expand Down Expand Up @@ -160,10 +152,6 @@
++++++ finished: end lumi for module: stream = 0 label = 'one' id = 3
++++ finished: end lumi: stream = 0 run = 1 lumi = 1 time = 1000030
++++ starting: global end lumi: run = 1 lumi = 1 time = 1000000
++++++ starting: global end lumi for module: label = 'getOne' id = 4
++++++ finished: global end lumi for module: label = 'getOne' id = 4
++++++ starting: global end lumi for module: label = 'getTwo' id = 6
++++++ finished: global end lumi for module: label = 'getTwo' id = 6
++++ finished: global end lumi: run = 1 lumi = 1 time = 1000000
++++ starting: global write lumi: run = 1 lumi = 1 time = 1000000
++++ finished: global write lumi: run = 1 lumi = 1 time = 1000000
Expand All @@ -174,10 +162,6 @@
++++++ finished: end run for module: stream = 0 label = 'one' id = 3
++++ finished: end run: stream = 0 run = 1 time = 1000030
++++ starting: global end run 1 : time = 1000030
++++++ starting: global end run for module: label = 'getOne' id = 4
++++++ finished: global end run for module: label = 'getOne' id = 4
++++++ starting: global end run for module: label = 'getTwo' id = 6
++++++ finished: global end run for module: label = 'getTwo' id = 6
++++ finished: global end run 1 : time = 1000030
++++ starting: global write run 1 : time = 1000030
++++ finished: global write run 1 : time = 1000030
Expand Down
8 changes: 4 additions & 4 deletions FWCore/Integration/test/acquireTest_cfg.py
Expand Up @@ -42,19 +42,19 @@
process.busy3 = cms.EDProducer("BusyWaitIntProducer",ivalue = cms.int32(2), iterations = cms.uint32(10*1000*1000))

process.tester = cms.EDAnalyzer("IntTestAnalyzer",
moduleLabel = cms.untracked.string("waiter"),
moduleLabel = cms.untracked.InputTag("waiter"),
valueMustMatch = cms.untracked.int32(5))

process.filtertester = cms.EDAnalyzer("IntTestAnalyzer",
moduleLabel = cms.untracked.string("filterwaiter"),
moduleLabel = cms.untracked.InputTag("filterwaiter"),
valueMustMatch = cms.untracked.int32(5))

process.streamtester = cms.EDAnalyzer("IntTestAnalyzer",
moduleLabel = cms.untracked.string("streamwaiter"),
moduleLabel = cms.untracked.InputTag("streamwaiter"),
valueMustMatch = cms.untracked.int32(5))

process.streamfiltertester = cms.EDAnalyzer("IntTestAnalyzer",
moduleLabel = cms.untracked.string("streamfilterwaiter"),
moduleLabel = cms.untracked.InputTag("streamfilterwaiter"),
valueMustMatch = cms.untracked.int32(5))

process.task = cms.Task(process.busy1, process.busy2, process.busy3,
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Integration/test/testEDAliasAnalyze_cfg.py
Expand Up @@ -8,7 +8,7 @@
)

process.analyzer = cms.EDAnalyzer("IntTestAnalyzer",
moduleLabel = cms.untracked.string("intProducer"),
moduleLabel = cms.untracked.InputTag("intProducer"),
valueMustMatch = cms.untracked.int32(1)
)

Expand Down
2 changes: 1 addition & 1 deletion FWCore/Integration/test/waiting_thread_cfg.py
Expand Up @@ -21,7 +21,7 @@
process.busy2 = cms.EDProducer("BusyWaitIntProducer",ivalue = cms.int32(2), iterations = cms.uint32(10*1000*1000))

process.tester = cms.EDAnalyzer("IntTestAnalyzer",
moduleLabel = cms.untracked.string("waiter"),
moduleLabel = cms.untracked.InputTag("waiter"),
valueMustMatch = cms.untracked.int32(5))

process.task = cms.Task(process.busy1, process.busy2, process.waiter)
Expand Down
2 changes: 1 addition & 1 deletion FWCore/MessageService/test/bug75836b_cfg.py
Expand Up @@ -5,7 +5,7 @@

process.doit = cms.EDAnalyzer ("IntTestAnalyzer",
valueMustMatch = cms.untracked.int32(90),
moduleLabel = cms.untracked.string("missing"))
moduleLabel = cms.untracked.InputTag("missing"))

process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(3))

Expand Down
12 changes: 6 additions & 6 deletions HeterogeneousCore/SonicCore/test/sonicTest_cfg.py
Expand Up @@ -73,29 +73,29 @@

process.testerSync = cms.EDAnalyzer("IntTestAnalyzer",
valueMustMatch = cms.untracked.int32(-1),
moduleLabel = cms.untracked.string("dummySync"),
moduleLabel = cms.untracked.InputTag("dummySync"),
)

process.testerPseudoAsync = cms.EDAnalyzer("IntTestAnalyzer",
valueMustMatch = cms.untracked.int32(4),
moduleLabel = cms.untracked.string("dummyPseudoAsync"),
moduleLabel = cms.untracked.InputTag("dummyPseudoAsync"),
)

process.testerAsync = cms.EDAnalyzer("IntTestAnalyzer",
valueMustMatch = cms.untracked.int32(15),
moduleLabel = cms.untracked.string("dummyAsync"),
moduleLabel = cms.untracked.InputTag("dummyAsync"),
)

process.testerSyncRetry = process.testerSync.clone(
moduleLabel = cms.untracked.string("dummySyncRetry")
moduleLabel = "dummySyncRetry"
)

process.testerPseudoAsyncRetry = process.testerPseudoAsync.clone(
moduleLabel = cms.untracked.string("dummyPseudoAsyncRetry")
moduleLabel = "dummyPseudoAsyncRetry"
)

process.testerAsyncRetry = process.testerAsync.clone(
moduleLabel = cms.untracked.string("dummyAsyncRetry")
moduleLabel = "dummyAsyncRetry"
)

process.p1 = cms.Path(process.testerSync, process.task)
Expand Down