Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-03-14 23:36:18

0001 #!/bin/bash
0002 set -x
0003 LOCAL_TEST_DIR=${SCRAM_TEST_PATH}
0004 
0005 function die { echo Failure $1: status $2 ; exit $2 ; }
0006 
0007 # The tests executed by this bash script are all related and
0008 # it seemed clearest to include them all in the same file.
0009 # These tests are divided into distinct groups. Each time
0010 # the script runs, it will execute only one group of tests.
0011 # The script requires that its first command line argument
0012 # specifies the group to be run. The "if" conditional statements
0013 # below implement this. The BuildFile directs scram to run
0014 # this script once for each group when unit tests are run.
0015 # The BuildFile also specifies the dependencies between the
0016 # groups. In some cases, one group cannot run until another
0017 # group of tests has finished. The purpose of this is to
0018 # allow maximum concurrency while running the tests so the
0019 # tests can run faster.
0020 
0021 if [ $1 -eq 1 ]
0022 then
0023   echo "testProcessBlock1"
0024   cmsRun ${LOCAL_TEST_DIR}/testProcessBlock1_cfg.py &> testProcessBlock1.log || die "cmsRun testProcessBlock1_cfg.py" $?
0025 
0026   # The MetaData ProcessBlock branch and the TTree should exist to hold the ProcessBlock
0027   # data. The Events branch should not exist because there were not any ProcessBlock branches
0028   # saved from an input file. Test that here:
0029   edmFileUtil -l -t MetaData -P file:testProcessBlock1.root > testProcessBlock1ContentsM.txt
0030   grep "Branch.* ProcessBlockHelper " testProcessBlock1ContentsM.txt || die "Check for existence of ProcessBlockHelper branch" $?
0031   grep "TTree.*ProcessBlocksPROD1" testProcessBlock1ContentsM.txt || die "Check for existence of ProcessBlocksPROD1 TTree" $?
0032   edmFileUtil -t Events -P file:testProcessBlock1.root > testProcessBlock1ContentsE.txt
0033   grep "Branch.* EventToProcessBlockIndexes " testProcessBlock1ContentsE.txt && die "Check for non-existence of eventToProcessBlockIndexes branch" 1
0034 fi
0035 
0036 if [ $1 -eq 2 ]
0037 then
0038   echo "testProcessBlock2"
0039   cmsRun ${LOCAL_TEST_DIR}/testProcessBlock2_cfg.py &> testProcessBlock2.log || die "cmsRun testProcessBlock2_cfg.py" $?
0040 fi
0041 
0042 if [ $1 -eq 3 ]
0043 then
0044   echo "testProcessBlock3"
0045   cmsRun ${LOCAL_TEST_DIR}/testProcessBlock3_cfg.py &> testProcessBlock3.log || die "cmsRun testProcessBlock3_cfg.py" $?
0046 fi
0047 
0048 if [ $1 -eq 4 ]
0049 then
0050   echo "testProcessBlock4"
0051   cmsRun ${LOCAL_TEST_DIR}/testProcessBlock4_cfg.py &> testProcessBlock4.log || die "cmsRun testProcessBlock4_cfg.py" $?
0052 fi
0053 
0054 if [ $1 -eq 5 ]
0055 then
0056   echo "testProcessBlockMerge"
0057   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockMerge_cfg.py &> testProcessBlockMerge.log || die "cmsRun testProcessBlockMerge_cfg.py" $?
0058 
0059   # The ProcessBlock Branches and TTrees should exist in this case. Test that here:
0060   edmFileUtil -l -t MetaData -P file:testProcessBlockMerge.root > testProcessBlockMContentsM.txt
0061   grep "Branch.* ProcessBlockHelper " testProcessBlockMContentsM.txt || die "Check for existence of ProcessBlockHelper branch" $?
0062   grep "TTree.*ProcessBlocksPROD1" testProcessBlockMContentsM.txt || die "Check for existence of ProcessBlocksPROD1 TTree" $?
0063   grep "TTree.*ProcessBlocksMERGE" testProcessBlockMContentsM.txt || die "Check for existence of ProcessBlocksMERGE TTree" $?
0064   edmFileUtil -t Events -P file:testProcessBlockMerge.root > testProcessBlockMContentsE.txt
0065   grep "Branch.* EventToProcessBlockIndexes " testProcessBlockMContentsE.txt || die "Check for existence of eventToProcessBlockIndexes branch" $?
0066 fi
0067 
0068 if [ $1 -eq 6 ]
0069 then
0070   echo "testProcessBlockTEST"
0071   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockTEST_cfg.py &> testProcessBlockTEST.log || die "cmsRun testProcessBlockTEST_cfg.py" $?
0072 
0073   echo "testProcessBlockRead"
0074   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockRead_cfg.py &> testProcessBlockRead.log || die "cmsRun testProcessBlockRead_cfg.py" $?
0075   grep "InputProcessBlockIntAnalyzer::accessInputProcessBlock" testProcessBlockRead.log || die "Check that InputProcessBlockIntAnalyzer::accessInputProcessBlock was called" $?
0076   grep "InputProcessBlockIntFilter::accessInputProcessBlock" testProcessBlockRead.log || die "Check that InputProcessBlockIntFilter::accessInputProcessBlock was called" $?
0077   grep "InputProcessBlockIntProducer::accessInputProcessBlock" testProcessBlockRead.log || die "Check that InputProcessBlockIntProducer::accessInputProcessBlock was called" $?
0078 fi
0079 
0080 if [ $1 -eq 7 ]
0081 then
0082   echo "testProcessBlock2Dropped"
0083   cmsRun ${LOCAL_TEST_DIR}/testProcessBlock2Dropped_cfg.py &> testProcessBlock2Dropped.log || die "cmsRun testProcessBlock2Dropped_cfg.py" $?
0084 
0085   # The ProcessBlock Branches and TTrees should not exist in this case because
0086   # all the ProcessBlock products are dropped. Test that here:
0087   edmFileUtil -l -t MetaData -P file:testProcessBlock2Dropped.root > testProcessBlock2DroppedContentsM.txt
0088   grep "Branch.* ProcessBlockHelper " testProcessBlock2DroppedContentsM.txt && die "Check for non-existence of ProcessBlockHelper branch" 1
0089   grep "TTree.*ProcessBlocksPROD1" testProcessBlock2DroppedContentsM.txt && die "Check for non-existence of ProcessBlocksPROD1 TTree" 1
0090   edmFileUtil -t Events -P file:testProcessBlock2Dropped.root > testProcessBlock2DroppedContentsE.txt
0091   grep "Branch.* EventToProcessBlockIndexes " testProcessBlock2DroppedContentsE.txt && die "Check for non-existence of eventToProcessBlockIndexes branch" 1
0092 fi
0093 
0094 if [ $1 -eq 8 ]
0095 then
0096   # This one intentionally fails because the product content of the
0097   # files does not match (strict merging requirements for ProcessBlocks)
0098   echo "testProcessBlockFailMerge"
0099   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockFailMerge_cfg.py &> testProcessBlockFailMerge.log && die "cmsRun testProcessBlockFailMerge_cfg.py" 1
0100 fi
0101 
0102 if [ $1 -eq 9 ]
0103 then
0104   echo "testProcessBlockMerge2"
0105   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockMerge2_cfg.py &> testProcessBlockMerge2.log || die "cmsRun testProcessBlockMerge2_cfg.py" $?
0106 fi
0107 
0108 if [ $1 -eq 10 ]
0109 then
0110   echo "testProcessBlockMergeOfMergedFiles"
0111   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockMergeOfMergedFiles_cfg.py &> testProcessBlockMergeOfMergedFiles.log || die "cmsRun testProcessBlockMergeOfMergedFiles_cfg.py" $?
0112 fi
0113 
0114 if [ $1 -eq 11 ]
0115 then
0116   echo "testProcessBlockNOMergeOfMergedFiles"
0117   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockNOMergeOfMergedFiles_cfg.py &> testProcessBlockNOMergeOfMergedFiles.log || die "cmsRun testProcessBlockNOMergeOfMergedFiles_cfg.py" $?
0118 fi
0119 
0120 if [ $1 -eq 12 ]
0121 then
0122   echo "testProcessBlockRead2"
0123   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockRead2_cfg.py &> testProcessBlockRead2.log || die "cmsRun testProcessBlockRead2_cfg.py" $?
0124 fi
0125 
0126 if [ $1 -eq 17 ]
0127 then
0128   echo "testProcessBlockLooper"
0129   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockLooper_cfg.py &> testProcessBlockLooper.log || die "cmsRun testProcessBlockLooper_cfg.py" $?
0130 fi
0131 
0132 if [ $1 -eq 18 ]
0133 then
0134   echo "testProcessBlock5"
0135   cmsRun ${LOCAL_TEST_DIR}/testProcessBlock5_cfg.py &> testProcessBlock5.log || die "cmsRun testProcessBlock5_cfg.py" $?
0136 
0137   echo "testProcessBlockMerge3"
0138   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockMerge3_cfg.py &> testProcessBlockMerge3.log || die "cmsRun testProcessBlockMerge3_cfg.py" $?
0139 
0140   echo "testProcessBlockMergeOfMergedFiles2"
0141   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockMergeOfMergedFiles2_cfg.py &> testProcessBlockMergeOfMergedFiles2.log || die "cmsRun testProcessBlockMergeOfMergedFiles2_cfg.py" $?
0142 fi
0143 
0144 if [ $1 -eq 19 ]
0145 then
0146   echo "testProcessBlockDropOnInput"
0147   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockDropOnInput_cfg.py &> testProcessBlockDropOnInput.log || die "cmsRun testProcessBlockDropOnInput_cfg.py" $?
0148 fi
0149 
0150 if [ $1 -eq 20 ]
0151 then
0152   echo "testProcessBlockThreeFileInput"
0153   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockThreeFileInput_cfg.py &> testProcessBlockThreeFileInput.log || die "cmsRun testProcessBlockThreeFileInput_cfg.py" $?
0154 
0155   echo "testProcessBlockReadThreeFileInput"
0156   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockReadThreeFileInput_cfg.py &> testProcessBlockReadThreeFileInput.log || die "cmsRun testProcessBlockReadThreeFileInput_cfg.py" $?
0157 fi
0158 
0159 if [ $1 -eq 21 ]
0160 then
0161   echo "testLooperEventNavigation2"
0162   cmsRun ${LOCAL_TEST_DIR}/testLooperEventNavigation2_cfg.py < ${LOCAL_TEST_DIR}/testLooperEventNavigation2.txt &> testLooperEventNavigation2.log || die "cmsRun testLooperEventNavigation2_cfg.py" $?
0163 fi
0164 
0165 if [ $1 -eq 22 ]
0166 then
0167   echo "testLooperEventNavigation3"
0168   cmsRun ${LOCAL_TEST_DIR}/testLooperEventNavigation3_cfg.py < ${LOCAL_TEST_DIR}/testLooperEventNavigation3.txt &> testLooperEventNavigation3.log || die "cmsRun testLooperEventNavigation3_cfg.py" $?
0169 fi
0170 
0171 if [ $1 -eq 23 ]
0172 then
0173   echo "testProcessBlockDropOnOutput"
0174   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockDropOnOutput_cfg.py &> testProcessBlockDropOnOutput.log || die "cmsRun testProcessBlockDropOnOutput_cfg.py" $?
0175 
0176   echo "testProcessBlockReadDropOnOutput"
0177   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockReadDropOnOutput_cfg.py &> testProcessBlockReadDropOnOutput.log || die "cmsRun testProcessBlockReadDropOnOutput_cfg.py" $?
0178 fi
0179 
0180 if [ $1 -eq 24 ]
0181 then
0182   echo "testProcessBlockDropOnOutput2"
0183   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockDropOnOutput2_cfg.py &> testProcessBlockDropOnOutput2.log || die "cmsRun testProcessBlockDropOnOutput2_cfg.py" $?
0184 
0185   echo "testProcessBlockReadDropOnOutput2"
0186   cmsRun ${LOCAL_TEST_DIR}/testProcessBlockReadDropOnOutput2_cfg.py &> testProcessBlockReadDropOnOutput2.log || die "cmsRun testProcessBlockReadDropOnOutput2_cfg.py" $?
0187 fi
0188 
0189 # The next three tests would be relevant if we disabled the strict merging requirement
0190 # in ProductRegistry.cc for ProcessBlock products (a one line code change). As long
0191 # as we always enforce the strict merging requirement these tests will fail, but they
0192 # would be useful if we decide to allow that requirement to be disabled in the future.
0193 # I ran them manually with the ProductRegistry.cc modified  to disable the requirement
0194 # and in May 2021 these tests passed. In addition to uncommenting the tests here, they
0195 # would also need to be added in the BuildFile with the proper dependency (both 25
0196 # and 26 depend on 19 at the moment)
0197 
0198 #if [ $1 -eq 25 ]
0199 #then
0200 #  echo "testProcessBlockNonStrict"
0201 #  cmsRun ${LOCAL_TEST_DIR}/testProcessBlockNonStrict_cfg.py &> testProcessBlockNonStrict.log || die "cmsRun testProcessBlockNonStrict_cfg.py" $?
0202 #
0203 #  echo "testProcessBlockNonStrict2"
0204 #  cmsRun ${LOCAL_TEST_DIR}/testProcessBlockNonStrict2_cfg.py &> testProcessBlockNonStrict2.log || die "cmsRun testProcessBlockNonStrict2_cfg.py" $?
0205 #fi
0206 
0207 #if [ $1 -eq 26 ]
0208 #then
0209 #  echo "testProcessBlockNonStrict3"
0210 #  cmsRun ${LOCAL_TEST_DIR}/testProcessBlockNonStrict3_cfg.py &> testProcessBlockNonStrict3.log || die "cmsRun testProcessBlockNonStrict3_cfg.py" $?
0211 #fi
0212 
0213 if [ $1 -eq 100 ]
0214 then
0215   rm testProcessBlock1ContentsM.txt
0216   rm testProcessBlock1ContentsE.txt
0217   rm testProcessBlockMContentsM.txt
0218   rm testProcessBlockMContentsE.txt
0219   rm testProcessBlock2DroppedContentsM.txt
0220   rm testProcessBlock2DroppedContentsE.txt
0221 
0222   rm testProcessBlock1.log
0223   rm testProcessBlock2.log
0224   rm testProcessBlock3.log
0225   rm testProcessBlock4.log
0226   rm testProcessBlockMerge.log
0227   rm testProcessBlockTEST.log
0228   rm testProcessBlockRead.log
0229   rm testProcessBlock2Dropped.log
0230   rm testProcessBlockFailMerge.log
0231   rm testProcessBlockMerge2.log
0232   rm testProcessBlockMergeOfMergedFiles.log
0233   rm testProcessBlockNOMergeOfMergedFiles.log
0234   rm testProcessBlockRead2.log
0235   rm testProcessBlockLooper.log
0236   rm testProcessBlock5.log
0237   rm testProcessBlockMerge3.log
0238   rm testProcessBlockMergeOfMergedFiles2.log
0239   rm testProcessBlockDropOnInput.log
0240   rm testProcessBlockThreeFileInput.log
0241   rm testProcessBlockReadThreeFileInput.log
0242   rm testLooperEventNavigation2.log
0243   rm testLooperEventNavigation3.log
0244   rm testProcessBlockDropOnOutput.log
0245   rm testProcessBlockReadDropOnOutput.log
0246   rm testProcessBlockDropOnOutput2.log
0247   rm testProcessBlockReadDropOnOutput2.log
0248 
0249   rm testProcessBlock1.root
0250   rm testProcessBlock2.root
0251   rm testProcessBlock3.root
0252   rm testProcessBlock4.root
0253   rm testProcessBlockMerge.root
0254   rm testProcessBlockTest.root
0255   rm testProcessBlockRead.root
0256   rm testProcessBlock2Dropped.root
0257   rm testProcessBlockFailMerge.root
0258   rm testProcessBlockMerge2.root
0259   rm testProcessBlockMergeOfMergedFiles.root
0260   rm testProcessBlockNOMergeOfMergedFiles.root
0261   rm testProcessBlockRead2.root
0262   rm testProcessBlockLooperTest.root
0263   rm testProcessBlock5.root
0264   rm testProcessBlockMerge3.root
0265   rm testProcessBlockMergeOfMergedFiles2.root
0266   rm testProcessBlockDropOnInput.root
0267   rm testProcessBlockThreeFileInput.root
0268   rm testProcessBlockReadThreeFileInput.root
0269   rm testProcessBlockDropOnOutput.root
0270   rm testProcessBlockDropOnOutput2.root
0271   rm testProcessBlockDropOnOutput2_2.root
0272   rm testProcessBlockReadDropOnOutput.root
0273   rm testProcessBlockReadDropOnOutput2.root
0274   rm testProcessBlockNOMergeOfMergedFiles001.root
0275   rm testProcessBlockLooperTest001.root
0276   rm testProcessBlockLooperTest002.root
0277 
0278   #rm testProcessBlockNonStrict.log
0279   #rm testProcessBlockNonStrict2.log
0280   #rm testProcessBlockNonStrict3.log
0281   #rm testProcessBlockNonStrict.root
0282   #rm testProcessBlockNonStrict2.root
0283   #rm testProcessBlockNonStrict3.root
0284 
0285 fi
0286 
0287 exit 0