|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +function die { echo Failure $1: status $2 ; exit $2 ; } |
| 4 | +function runSuccess { |
| 5 | + echo "cmsRun $@" |
| 6 | + cmsRun $@ || die "cmsRun $*" $? |
| 7 | + echo |
| 8 | +} |
| 9 | +function runFailure { |
| 10 | + echo "cmsRun $@ (expected to fail)" |
| 11 | + cmsRun $@ && die "cmsRun $*" 1 |
| 12 | + echo |
| 13 | +} |
| 14 | + |
| 15 | +VERSION_ARR=(${CMSSW_VERSION//_/ }) |
| 16 | +VERSION1="${VERSION_ARR[0]}_${VERSION_ARR[1]}_${VERSION_ARR[2]}_0" |
| 17 | +VERSION2="${VERSION_ARR[0]}_${VERSION_ARR[1]}_${VERSION_ARR[2]}_1" |
| 18 | +VERSION3="${VERSION_ARR[0]}_${VERSION_ARR[1]}_$((${VERSION_ARR[2]}+1))_0" |
| 19 | + |
| 20 | +# Check that changing the patch version does not lead to new lumi or run |
| 21 | +runSuccess ${SCRAM_TEST_PATH}/testReducedProcessHistoryCreate_cfg.py --version ${VERSION1} --firstEvent 1 --output version1.dat |
| 22 | +runSuccess ${SCRAM_TEST_PATH}/testReducedProcessHistoryCreate_cfg.py --version ${VERSION2} --firstEvent 101 --output version2.dat |
| 23 | + |
| 24 | +CatStreamerFiles merged.dat version1.dat version2.dat |
| 25 | + |
| 26 | +runSuccess ${SCRAM_TEST_PATH}/testReducedProcessHistory_cfg.py --input merged.dat --output merged.root |
| 27 | + |
| 28 | +edmProvDump merged.root | grep -q "PROD.*'${VERSION1}'" || die "Did not find ${VERSION1} from merged.root provenance" $? |
| 29 | +edmProvDump merged.root | grep -q "PROD.*'${VERSION2}'" || die "Did not find ${VERSION2} from merged.root provenance" $? |
| 30 | + |
| 31 | + |
| 32 | +# Check that changing the minor version leads to new lumi |
| 33 | +runSuccess ${SCRAM_TEST_PATH}/testReducedProcessHistoryCreate_cfg.py --version ${VERSION3} --firstEvent 201 --output version3_lumi.dat |
| 34 | + |
| 35 | +CatStreamerFiles merged3_lumi.dat version1.dat version3_lumi.dat |
| 36 | + |
| 37 | +runFailure ${SCRAM_TEST_PATH}/testReducedProcessHistory_cfg.py --input merged3_lumi.dat --output merged3_lumi.root |
| 38 | + |
| 39 | +runSuccess ${SCRAM_TEST_PATH}/testReducedProcessHistory_cfg.py --input merged3_lumi.dat --output merged3_lumi.root --expectNewLumi |
| 40 | + |
| 41 | +edmProvDump merged3_lumi.root | grep -q "PROD.*'${VERSION3}'" || die "Did not find ${VERSION3} from merged3_lumi.root provenance" $? |
| 42 | + |
| 43 | + |
| 44 | +# Check that changing the minor version leads to new run |
| 45 | +runSuccess ${SCRAM_TEST_PATH}/testReducedProcessHistoryCreate_cfg.py --version ${VERSION3} --firstEvent 201 --lumi 2 --output version3_run.dat |
| 46 | + |
| 47 | +CatStreamerFiles merged3_run.dat version1.dat version3_run.dat |
| 48 | + |
| 49 | +runFailure ${SCRAM_TEST_PATH}/testReducedProcessHistory_cfg.py --input merged3_run.dat --output merged3_run.root |
| 50 | + |
| 51 | +runSuccess ${SCRAM_TEST_PATH}/testReducedProcessHistory_cfg.py --input merged3_run.dat --output merged3_run.root --expectNewRun |
| 52 | + |
| 53 | +edmProvDump merged3_run.root | grep -q "PROD.*'${VERSION3}'" || die "Did not find ${VERSION3} from merged3_run.root provenance" $? |
| 54 | + |
| 55 | +exit 0 |
0 commit comments