Skip to content

Commit

Permalink
test .py files to test each aspect of MessageLogger cfg validation.
Browse files Browse the repository at this point in the history
the testing is not automated:  one must enable each of the prepared
failing cases, and look at the log to see that the message produced
is clear.
  • Loading branch information
Mark Steven Fischler committed Jun 14, 2009
1 parent e802e38 commit 546e000
Show file tree
Hide file tree
Showing 13 changed files with 1,096 additions and 0 deletions.
115 changes: 115 additions & 0 deletions FWCore/MessageService/test/PsetValidationSamples/cat_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Test of a feature of PSet validation:
# Category nested PSets

import FWCore.ParameterSet.Config as cms

process = cms.Process("TEST")

import FWCore.Framework.test.cmsExceptionsFatal_cff
process.options = FWCore.Framework.test.cmsExceptionsFatal_cff.options

process.load("FWCore.MessageService.test.Services_cff")

process.MessageLogger = cms.Service("MessageLogger",

destinations = cms.untracked.vstring( 'u1_warnings', 'u1_errors',
'u1_infos', 'u1_debugs', 'u1_default', 'u1_x'),
statistics = cms.untracked.vstring( 'u1_warnings', 'u1_default', 'u1_y' ),
fwkJobReports = cms.untracked.vstring( 'u1_f' ),
categories = cms.untracked.vstring('preEventProcessing','FwkJob',
'cat_A','cat_B', 'cat_J', 'cat_K'),

# enabling any of these acter the first one should fail:

cat_J = cms.untracked.PSet(
limit = cms.untracked.int32(100),
reportEvery = cms.untracked.int32(10),
timespan = cms.untracked.int32(10)
),

# cat_K = cms.untracked.PSet(
# limit = cms.untracked.int32(100),
# reportEvery = cms.untracked.int32(10),
# timespan = cms.untracked.int32(10),
# nonsense = cms.untracked.int32(10)
# ),

# enabling any of these except the first 5 should fail:

u1_x = cms.untracked.PSet(
threshold = cms.untracked.string('INFO'),
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
# cat_K = cms.untracked.PSet(
# limit = cms.untracked.int32(100),
# reportEvery = cms.untracked.int32(10),
# timespan = cms.untracked.int32(10),
# nonsense = cms.untracked.int32(10)
# ),

# cat_J = cms.untracked.PSet(
# a = cms.untracked.bool(True),
# b = cms.untracked.PSet( c = cms.untracked.int32(10) )
# ),

# this one should be fine
INFO = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),


u1_infos = cms.untracked.PSet(
threshold = cms.untracked.string('INFO'),
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),
u1_warnings = cms.untracked.PSet(
threshold = cms.untracked.string('WARNING'),
noTimeStamps = cms.untracked.bool(True)
),
u1_debugs = cms.untracked.PSet(
threshold = cms.untracked.string('DEBUG'),
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),
u1_default = cms.untracked.PSet(
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),
u1_errors = cms.untracked.PSet(
threshold = cms.untracked.string('ERROR'),
noTimeStamps = cms.untracked.bool(True)
),
debugModules = cms.untracked.vstring('*'),
)

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

process.source = cms.Source("EmptySource")

process.sendSomeMessages = cms.EDAnalyzer("UnitTestClient_A")

process.p = cms.Path(process.sendSomeMessages)
83 changes: 83 additions & 0 deletions FWCore/MessageService/test/PsetValidationSamples/categories_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Test of a feature of PSet validation:
# The vstring categories and messageIDs lists

import FWCore.ParameterSet.Config as cms

process = cms.Process("TEST")

import FWCore.Framework.test.cmsExceptionsFatal_cff
process.options = FWCore.Framework.test.cmsExceptionsFatal_cff.options

process.load("FWCore.MessageService.test.Services_cff")

process.MessageLogger = cms.Service("MessageLogger",

destinations = cms.untracked.vstring( 'u1_warnings', 'u1_errors',
'u1_infos', 'u1_debugs', 'u1_default', 'u1_x'),
statistics = cms.untracked.vstring( 'u1_warnings', 'u1_default', 'u1_y'),
fwkJobReports = cms.untracked.vstring( 'u1_f' ),

#enable one of the following -- the first should pass, the rest fail
categories = cms.untracked.vstring('preEventProcessing','FwkJob',
'cat_A','cat_B'),
# categories = cms.vstring('preEventProcessing','FwkJob','u1_x'),
# categories = cms.vstring('preEventProcessing','FwkJob','u1_y'),
# categories = cms.vstring('preEventProcessing','FwkJob','u1_f'),
# categories = cms.untracked.int32(2),
# categories = cms.untracked.vstring('preEventProcessing','FwkJob',
# 'cat_A','cat_B','cat_A'),
# categories = cms.untracked.vstring('preEventProcessing','FwkJob',
# 'cat_A','cat_B','limit'),

# If the passing one above enabled, enabling this should now fail:
cat_A = cms.untracked.int32(2),

u1_infos = cms.untracked.PSet(
threshold = cms.untracked.string('INFO'),
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),
u1_warnings = cms.untracked.PSet(
threshold = cms.untracked.string('WARNING'),
noTimeStamps = cms.untracked.bool(True)
),
u1_debugs = cms.untracked.PSet(
threshold = cms.untracked.string('DEBUG'),
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),
u1_default = cms.untracked.PSet(
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),
u1_errors = cms.untracked.PSet(
threshold = cms.untracked.string('ERROR'),
noTimeStamps = cms.untracked.bool(True)
),
debugModules = cms.untracked.vstring('*'),
)

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

process.source = cms.Source("EmptySource")

process.sendSomeMessages = cms.EDAnalyzer("UnitTestClient_A")

process.p = cms.Path(process.sendSomeMessages)
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Test of a feature of PSet validation:
# The vstring debugModules and suppressDebug

import FWCore.ParameterSet.Config as cms

process = cms.Process("TEST")

import FWCore.Framework.test.cmsExceptionsFatal_cff
process.options = FWCore.Framework.test.cmsExceptionsFatal_cff.options

process.load("FWCore.MessageService.test.Services_cff")

process.MessageLogger = cms.Service("MessageLogger",

destinations = cms.untracked.vstring( 'u1_warnings', 'u1_errors',
'u1_infos', 'u1_debugs', 'u1_default', 'u1_x'),
statistics = cms.untracked.vstring( 'u1_warnings', 'u1_default', 'u1_y'),
fwkJobReports = cms.untracked.vstring( 'u1_f' ),
categories = cms.untracked.vstring('preEventProcessing','FwkJob',
'cat_A','cat_B'),

#enable one of the following -- the first THREE should pass, the rest fail

debugModules = cms.untracked.vstring('*'),
# debugModules = cms.untracked.vstring('A', 'B'),
# debugModules = cms.untracked.vstring('*'),suppressDebug = cms.untracked.vstring('A'),

# debugModules = cms.untracked.vstring('*'),suppressDebug = cms.untracked.vstring('*'),
# suppressDebug = cms.untracked.vstring('A'),
# debugModules = cms.untracked.vstring('A','B'),suppressDebug = cms.untracked.vstring('A'),
# debugModules = cms.vstring('A'),
# debugModules = cms.untracked.int32(2),

u1_infos = cms.untracked.PSet(
threshold = cms.untracked.string('INFO'),
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),
u1_warnings = cms.untracked.PSet(
threshold = cms.untracked.string('WARNING'),
noTimeStamps = cms.untracked.bool(True)
),
u1_debugs = cms.untracked.PSet(
threshold = cms.untracked.string('DEBUG'),
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),
u1_default = cms.untracked.PSet(
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),
u1_errors = cms.untracked.PSet(
threshold = cms.untracked.string('ERROR'),
noTimeStamps = cms.untracked.bool(True)
),
)

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

process.source = cms.Source("EmptySource")

process.sendSomeMessages = cms.EDAnalyzer("UnitTestClient_A")

process.p = cms.Path(process.sendSomeMessages)
101 changes: 101 additions & 0 deletions FWCore/MessageService/test/PsetValidationSamples/dest_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Test of a feature of PSet validation:
# A destination PSet

import FWCore.ParameterSet.Config as cms

process = cms.Process("TEST")

import FWCore.Framework.test.cmsExceptionsFatal_cff
process.options = FWCore.Framework.test.cmsExceptionsFatal_cff.options

process.load("FWCore.MessageService.test.Services_cff")

process.MessageLogger = cms.Service("MessageLogger",

destinations = cms.untracked.vstring( 'u1_warnings', 'u1_errors',
'u1_infos', 'u1_debugs', 'u1_default', 'u1_x'),
statistics = cms.untracked.vstring( 'u1_warnings', 'u1_default', 'u1_y' ),
fwkJobReports = cms.untracked.vstring( 'u1_f' ),
categories = cms.untracked.vstring('preEventProcessing','FwkJob',
'cat_A','cat_B'),

# enabling any of these except the first 5 should fail:

u1_x = cms.untracked.PSet(
threshold = cms.untracked.string('INFO'),
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
# placeholder = cms.untracked.int32(2),
# limit = cms.untracked.int32(2),
# noTimeStamps = cms.untracked.int32(2),
# cat_C = cms.untracked.PSet(
# limit = cms.untracked.int32(0)
# ),
# filename = cms.untracked.string("cerr"),
# extension = cms.untracked.string("cout"),
# this one should be fine
INFO = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),

# enabling this should lead to error
# u1_y = cms.untracked.PSet(
# noTimeStamps = cms.untracked.bool(True)
# ),


u1_infos = cms.untracked.PSet(
threshold = cms.untracked.string('INFO'),
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),
u1_warnings = cms.untracked.PSet(
threshold = cms.untracked.string('WARNING'),
noTimeStamps = cms.untracked.bool(True)
),
u1_debugs = cms.untracked.PSet(
threshold = cms.untracked.string('DEBUG'),
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),
u1_default = cms.untracked.PSet(
noTimeStamps = cms.untracked.bool(True),
FwkJob = cms.untracked.PSet(
limit = cms.untracked.int32(0)
),
preEventProcessing = cms.untracked.PSet(
limit = cms.untracked.int32(0)
)
),
u1_errors = cms.untracked.PSet(
threshold = cms.untracked.string('ERROR'),
noTimeStamps = cms.untracked.bool(True)
),
debugModules = cms.untracked.vstring('*'),
)

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

process.source = cms.Source("EmptySource")

process.sendSomeMessages = cms.EDAnalyzer("UnitTestClient_A")

process.p = cms.Path(process.sendSomeMessages)
Loading

0 comments on commit 546e000

Please sign in to comment.