Skip to content

Commit

Permalink
Merge pull request #35675 from mmusich/possible_fix_for_BSReadUnitTest
Browse files Browse the repository at this point in the history
decouple writing legacy and HLT payloads on same sqlite file in `CondTools/BeamSpot` tests
  • Loading branch information
cmsbuild authored Oct 14, 2021
2 parents a8ce9fc + ef88e2a commit 7d0e4f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CondTools/BeamSpot/test/BeamSpotOnlineRecordsReader_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
tag_name = options.inputTag

from CondCore.CondDB.CondDB_cfi import *
CondDBBeamSpotOnlineLegacy = CondDB.clone(connect = cms.string("sqlite_file:test.db")) # customize with input db file
CondDBBeamSpotOnlineLegacy = CondDB.clone(connect = cms.string("sqlite_file:test_%s.db" % tag_name)) # customize with input db file
process.PoolDBESSource = cms.ESSource("PoolDBESSource",
CondDBBeamSpotOnlineLegacy,
DumpStat=cms.untracked.bool(True),
Expand Down
2 changes: 1 addition & 1 deletion CondTools/BeamSpot/test/BeamSpotOnlineRecordsWriter_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#################################
# Produce a SQLITE FILE
#################################
CondDBBeamSpotObjects = CondDB.clone(connect = cms.string('sqlite_file:test.db')) # choose an output name
CondDBBeamSpotObjects = CondDB.clone(connect = cms.string('sqlite_file:test_%s.db' % tag_name)) # choose an output name
process.PoolDBOutputService = cms.Service("PoolDBOutputService",
CondDBBeamSpotObjects,
timetype = cms.untracked.string('lumiid'), #('lumiid'), #('runnumber')
Expand Down
18 changes: 11 additions & 7 deletions CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,30 @@ function die { echo $1: status $2 ; exit $2; }

echo "TESTING BeamSpotOnline From DB Read / Write codes ..."

## clean the input db file
if test -f "test.db"; then
rm -fr test.db
## clean the input db files
if test -f "test_BSHLT_tag.db"; then
rm -fr test_BSHLT_tag.db
fi

if test -f "test_BSLegacy_tag.db"; then
rm -fr test_BSLegacy_tag.db
fi

## copy the input file
cp -pr $CMSSW_BASE/src/CondTools/BeamSpot/data/BeamFitResults_Run306171.txt .

# test write
echo "TESTING Writing BeamSpotOnlineLegacyObjectsRcd DB object ...\n\n"
printf "TESTING Writing BeamSpotOnlineLegacyObjectsRcd DB object ...\n\n"
cmsRun ${LOCAL_TEST_DIR}/BeamSpotOnlineRecordsWriter_cfg.py unitTest=True inputRecord=BeamSpotOnlineLegacyObjectsRcd || die "Failure writing payload for BeamSpotOnlineLegacyObjectsRcd" $?

echo "TESTING Writing BeamSpotOnlineHLTObjectsRcd DB object ...\n\n"
printf "TESTING Writing BeamSpotOnlineHLTObjectsRcd DB object ...\n\n"
cmsRun ${LOCAL_TEST_DIR}/BeamSpotOnlineRecordsWriter_cfg.py unitTest=True inputRecord=BeamSpotOnlineHLTObjectsRcd || die "Failure writing payload for BeamSpotOnlineHLTObjectsRcd" $?
# test read

echo "TESTING Reading BeamSpotOnlineLegacyObjectsRcd DB object ...\n\n"
printf "TESTING Reading BeamSpotOnlineLegacyObjectsRcd DB object ...\n\n"
cmsRun ${LOCAL_TEST_DIR}/BeamSpotOnlineRecordsReader_cfg.py unitTest=True inputRecord=BeamSpotOnlineLegacyObjectsRcd || die "Failure reading payload for BeamSpotOnlineLegacyObjectsRcd" $?

echo "TESTING Reading BeamSpotOnlineHLTObjectsRcd DB object ...\n\n"
printf "TESTING Reading BeamSpotOnlineHLTObjectsRcd DB object ...\n\n"
cmsRun ${LOCAL_TEST_DIR}/BeamSpotOnlineRecordsReader_cfg.py unitTest=True inputRecord=BeamSpotOnlineHLTObjectsRcd || die "Failure reading payload for BeamSpotOnlineHLTObjectsRcd" $?

echo "TESTING reading BeamSpotObjectRcd DB object ...\n\n"
Expand Down

0 comments on commit 7d0e4f1

Please sign in to comment.