Skip to content

Commit

Permalink
Include EDAlias and SwitchProducer in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
makortel committed Apr 24, 2020
1 parent 245c58a commit 69596df
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions FWCore/Framework/test/test_module_delete_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# - event/lumi/run product with the same module label and instance name but with skipCurrentProcess, module deleted
# - DAG of event/lumi/run producers that are not consumed by an always-running module, whole DAG deleted
# - DAG of event(/lumi/run) producers that are partly consumed (kept) and partly non-consumed (delete)
# - EDAlias with one instance consumed (original producer kept) and another non-consumed (original producer deleted)
# - SwitchProducer non-chosen case deleted

intEventProducer = cms.EDProducer("IntProducer", ivalue = cms.int32(1))
intNonEventProducer = cms.EDProducer("NonEventIntProducer", ivalue = cms.int32(1))
Expand Down Expand Up @@ -83,6 +85,42 @@ def nonEventConsumer(transition, sourcePattern, expected):
srcEvent = cms.untracked.VInputTag("producerEventPartiallyConsumedChain2", "producerEventPartiallyConsumedChain4")
)

process.producerEventAliasNotConsumed = cms.EDProducer("edmtest::TestModuleDeleteProducer")
process.producerEventAliasConsumed = intEventProducerMustRun.clone()
process.producerEventAlias = cms.EDAlias(
producerEventAliasNotConsumed = cms.VPSet(
cms.PSet(
type = cms.string("edmtestIntProduct"),
fromProductInstance = cms.string(""),
toProductInstance = cms.string("notConsumed"),
)
),
producerEventAliasConsumed = cms.VPSet(
cms.PSet(
type = cms.string("edmtestIntProduct"),
fromProductInstance = cms.string(""),
toProductInstance = cms.string("consumed"),
)
)
)
process.consumerEventAlias = cms.EDAnalyzer("edmtest::GenericIntsAnalyzer",
srcEvent = cms.untracked.VInputTag("producerEventAlias:consumed")
)

class SwitchProducerTest(cms.SwitchProducer):
def __init__(self, **kargs):
super(SwitchProducerTest,self).__init__(
dict(
test1 = lambda: (True, -10),
test2 = lambda: (True, -9)
), **kargs)
process.producerEventSwitchProducerNotConsumed = cms.EDProducer("edmtest::TestModuleDeleteProducer")
process.producerEventSwitchProducerConsumed = intEventProducerMustRun.clone()
process.producerEventSwitchProducer = SwitchProducerTest(
test1 = cms.EDProducer("AddIntsProducer", labels = cms.vstring("producerEventSwitchProducerNotConsumed")),
test2 = cms.EDProducer("AddIntsProducer", labels = cms.vstring("producerEventSwitchProducerConsumed")),
)

process.consumerNotExist = cms.EDAnalyzer("edmtest::GenericIntsAnalyzer",
inputShouldBeMissing = cms.untracked.bool(True),
srcBeginRun = cms.untracked.VInputTag(
Expand Down Expand Up @@ -124,6 +162,12 @@ def nonEventConsumer(transition, sourcePattern, expected):
process.producerEventPartiallyConsumedChain1,
process.producerEventPartiallyConsumedChain3,
process.producerEventPartiallyConsumedChain4,
#
process.producerEventAliasNotConsumed,
process.producerEventAliasConsumed,
#
process.producerEventSwitchProducerNotConsumed,
process.producerEventSwitchProducerConsumed,
)

process.p = cms.Path(
Expand All @@ -139,6 +183,10 @@ def nonEventConsumer(transition, sourcePattern, expected):
#
process.producerEventPartiallyConsumedChain2+
#
process.consumerEventAlias+
#
process.producerEventSwitchProducer+
#
process.intAnalyzerDelete
,
process.t
Expand Down

0 comments on commit 69596df

Please sign in to comment.