Skip to content

Commit

Permalink
add a unitTest configuration parameter to DQMStreamerReader and use i…
Browse files Browse the repository at this point in the history
…t for DQM/Integration unit tests
  • Loading branch information
mmusich committed Jun 24, 2024
1 parent 207b628 commit 7ca18b1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,6 @@ def checkInputFolder(streamer_folder):
skipFirstLumis = cms.untracked.bool(options.skipFirstLumis),
deleteDatFiles = cms.untracked.bool(False),
endOfRunKills = cms.untracked.bool(False),
inputFileTransitionsEachEvent = cms.untracked.bool(False)
inputFileTransitionsEachEvent = cms.untracked.bool(False),
unitTest = cms.untracked.bool(True) # stop processing if the input data cannot be deserialized
)
12 changes: 11 additions & 1 deletion DQMServices/StreamerIO/plugins/DQMStreamerReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ namespace dqmservices {
flagSkipFirstLumis_(pset.getUntrackedParameter<bool>("skipFirstLumis")),
flagEndOfRunKills_(pset.getUntrackedParameter<bool>("endOfRunKills")),
flagDeleteDatFiles_(pset.getUntrackedParameter<bool>("deleteDatFiles")),
hltSel_(pset.getUntrackedParameter<std::vector<std::string>>("SelectEvents")) {
hltSel_(pset.getUntrackedParameter<std::vector<std::string>>("SelectEvents")),
unitTest_(pset.getUntrackedParameter<bool>("unitTest", false)) {
setAcceptAllEvt();
reset_();
}
Expand Down Expand Up @@ -167,6 +168,12 @@ namespace dqmservices {
openFileImp_(currentLumi);
return true;
} catch (const cms::Exception& e) {
if (unitTest_) {
throw edm::Exception(edm::errors::FileReadError, "DQMStreamerReader::openNextFileInp")
<< std::string("Can't deserialize registry data (in open file): ") + e.what()
<< "\n error: data file corrupted";
}

fiterator_.logFileAction(std::string("Can't deserialize registry data (in open file): ") + e.what(), p);
fiterator_.logLumiState(currentLumi, "error: data file corrupted");

Expand Down Expand Up @@ -463,6 +470,9 @@ namespace dqmservices {
"Kill the processing as soon as the end-of-run file appears, even if "
"there are/will be unprocessed lumisections.");

desc.addUntracked<bool>("unitTest", false)
->setComment("Kill the processing if the input data cannot be deserialized");

// desc.addUntracked<unsigned int>("skipEvents", 0U)
// ->setComment("Skip the first 'skipEvents' events that otherwise would "
// "have been processed.");
Expand Down
1 change: 1 addition & 0 deletions DQMServices/StreamerIO/plugins/DQMStreamerReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ namespace dqmservices {
bool const flagEndOfRunKills_;
bool const flagDeleteDatFiles_;
std::vector<std::string> const hltSel_;
bool const unitTest_;

bool acceptAllEvt_ = false;
bool setAcceptAllEvt();
Expand Down

0 comments on commit 7ca18b1

Please sign in to comment.