File indexing completed on 2024-07-28 22:48:27
0001
0002
0003 LOCAL_TEST_DIR=${SCRAM_TEST_PATH}
0004
0005 function die { echo Failure $1: status $2 ; exit $2 ; }
0006
0007 logfile=testFrameworkExceptionHandling$1.log
0008 cmsRun ${LOCAL_TEST_DIR}/testFrameworkExceptionHandling_cfg.py testNumber=$1 &> $logfile && die "cmsRun testFrameworkExceptionHandling_cfg.py testNumber=$1" 1
0009
0010 echo "There are two instances of ExceptionThrowingProducer with different module labels in this test."
0011 echo "Usually one of them is configured to throw an intentional exception (an exception message should"
0012 echo "always show up in the log file). The shell script and both modules run tests on how the Framework"
0013 echo "handles the exception. The modules separately report in the log and here whether those tests PASSED"
0014 echo "or FAILED."
0015 echo ""
0016
0017 grep "ExceptionThrowingProducer FAILED" $logfile && die " - FAILED because found the following string in the log file: ExceptionThrowingProducer FAILED " 1
0018 grep "ExceptionThrowingProducer PASSED" $logfile || die " - FAILED because cannot find the following string in the log file: ExceptionThrowingProducer PASSED " $?
0019
0020
0021
0022
0023
0024 grep -q "Begin Fatal Exception" $logfile || die " - Cannot find the following string in the exception message: Begin Fatal Exception " $?
0025
0026 grep -q "An exception of category 'IntentionalTestException' occurred while" $logfile || die " - Cannot find the following string in the exception message: An exception of category 'IntentionalTestException' occurred while " $?
0027
0028 grep -q "Calling method for module ExceptionThrowingProducer/'throwException'" $logfile || die " - Cannot find the following string in the exception message: Calling method for module ExceptionThrowingProducer/'throwException' " $?
0029
0030 grep -q "Exception Message:" $logfile || die " - Cannot find the following string in the exception message: Exception Message: " $?
0031
0032 grep -q "End Fatal Exception" $logfile || die " - Cannot find the following string in the exception message: End Fatal Exception " $?
0033
0034 if [ $1 -eq 1 ]
0035 then
0036 grep -q "Processing Event run: 3 lumi: 1 event: 5" $logfile || die " - Cannot find the following string in the exception message: Processing Event run: 3 lumi: 1 event: 5 " $?
0037 grep -q "Running path 'path1'" $logfile || die " - Cannot find the following string in the exception message: Running path 'path1' " $?
0038 grep -q "ExceptionThrowingProducer::produce, module configured to throw on: run: 3 lumi: 1 event: 5" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::produce, module configured to throw on: run: 3 lumi: 1 event: 5 " $?
0039 fi
0040
0041 if [ $1 -eq 2 ]
0042 then
0043 grep -q "Processing global begin Run run: 4" $logfile || die " - Cannot find the following string in the exception message: Processing global begin Run run: 4 " $?
0044 grep -q "ExceptionThrowingProducer::globalBeginRun, module configured to throw on: run: 4 lumi: 0 event: 0" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::globalBeginRun, module configured to throw on: run: 4 lumi: 0 event: 0 " $?
0045 fi
0046
0047 if [ $1 -eq 3 ]
0048 then
0049 grep -q "Processing global begin LuminosityBlock run: 4 luminosityBlock: 1" $logfile || die " - Cannot find the following string in the exception message: Processing global begin LuminosityBlock run: 4 luminosityBlock: 1 " $?
0050 grep -q "ExceptionThrowingProducer::globalBeginLuminosityBlock, module configured to throw on: run: 4 lumi: 1 event: 0" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::globalBeginLuminosityBlock, module configured to throw on: run: 4 lumi: 1 event: 0 " $?
0051 fi
0052
0053 if [ $1 -eq 4 ]
0054 then
0055 grep -q "Processing global end Run run: 3" $logfile || die " - Cannot find the following string in the exception message: Processing global end Run run: 3 " $?
0056 grep -q "ExceptionThrowingProducer::globalEndRun, module configured to throw on: run: 3 lumi: 0 event: 0" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::globalEndRun, module configured to throw on: run: 3 lumi: 0 event: 0 " $?
0057 fi
0058
0059 if [ $1 -eq 5 ]
0060 then
0061 grep -q "Processing global end LuminosityBlock run: 3 luminosityBlock: 1" $logfile || die " - Cannot find the following string in the exception message: Processing global end LuminosityBlock run: 3 luminosityBlock: 1 " $?
0062 grep -q "ExceptionThrowingProducer::globalEndLuminosityBlock, module configured to throw on: run: 3 lumi: 1 event: 0" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::globalEndLuminosityBlock, module configured to throw on: run: 3 lumi: 1 event: 0 " $?
0063 fi
0064
0065 if [ $1 -eq 6 ]
0066 then
0067 grep -q "Processing stream begin Run run: 4" $logfile || die " - Cannot find the following string in the exception message: Processing stream begin Run run: 4 " $?
0068 grep -q "ExceptionThrowingProducer::streamBeginRun, module configured to throw on: run: 4 lumi: 0 event: 0" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::streamBeginRun, module configured to throw on: run: 4 lumi: 0 event: 0 " $?
0069 fi
0070
0071 if [ $1 -eq 7 ]
0072 then
0073 grep -q "Processing stream begin LuminosityBlock run: 4 luminosityBlock: 1" $logfile || die " - Cannot find the following string in the exception message: Processing stream begin LuminosityBlock run: 4 luminosityBlock: 1 " $?
0074 grep -q "ExceptionThrowingProducer::streamBeginLuminosityBlock, module configured to throw on: run: 4 lumi: 1 event: 0" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::streamBeginLuminosityBlock, module configured to throw on: run: 4 lumi: 1 event: 0 " $?
0075 fi
0076
0077 if [ $1 -eq 8 ]
0078 then
0079 grep -q "Processing stream end Run run: 3" $logfile || die " - Cannot find the following string in the exception message: Processing stream end Run run: 3 " $?
0080 grep -q "ExceptionThrowingProducer::streamEndRun, module configured to throw on: run: 3 lumi: 0 event: 0" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::streamEndRun, module configured to throw on: run: 3 lumi: 0 event: 0 " $?
0081 fi
0082
0083 if [ $1 -eq 9 ]
0084 then
0085 grep -q "Processing stream end LuminosityBlock run: 3 luminosityBlock: 1" $logfile || die " - Cannot find the following string in the exception message: Processing stream end LuminosityBlock run: 3 luminosityBlock: 1 " $?
0086 grep -q "ExceptionThrowingProducer::streamEndLuminosityBlock, module configured to throw on: run: 3 lumi: 1 event: 0" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::streamEndLuminosityBlock, module configured to throw on: run: 3 lumi: 1 event: 0 " $?
0087 fi
0088
0089 if [ $1 -eq 10 ]
0090 then
0091 grep -q "Processing begin Job" $logfile || die " - Cannot find the following string in the exception message: Processing begin Job " $?
0092 grep -q "ExceptionThrowingProducer::beginJob, module configured to throw during beginJob" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::beginJob, module configured to throw during beginJob " $?
0093 fi
0094
0095 if [ $1 -eq 11 ]
0096 then
0097 grep -q "Processing begin Stream stream: 2" $logfile || die " - Cannot find the following string in the exception message: Processing begin Stream stream: 2 " $?
0098 grep -q "ExceptionThrowingProducer::beginStream, module configured to throw during beginStream for stream: 2" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::beginStream, module configured to throw during beginStream for stream: 2 " $?
0099 fi
0100
0101 if [ $1 -eq 12 ]
0102 then
0103 grep -q "Processing begin ProcessBlock" $logfile || die " - Cannot find the following string in the exception message: Processing begin ProcessBlock " $?
0104 grep -q "ExceptionThrowingProducer::beginProcessBlock, module configured to throw during beginProcessBlock" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::beginProcessBlock, module configured to throw during beginProcessBlock " $?
0105 fi
0106
0107 if [ $1 -eq 13 ]
0108 then
0109 grep -q "Processing end ProcessBlock" $logfile || die " - Cannot find the following string in the exception message: Processing end ProcessBlock " $?
0110 grep -q "ExceptionThrowingProducer::endProcessBlock, module configured to throw during endProcessBlock" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::endProcessBlock, module configured to throw during endProcessBlock " $?
0111 fi
0112
0113 if [ $1 -eq 14 ]
0114 then
0115 grep -q "Processing end Stream stream: 2" $logfile || die " - Cannot find the following string in the exception message: Processing end Stream stream: 2 " $?
0116 grep -q "ExceptionThrowingProducer::endStream, module configured to throw during endStream for stream: 2" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::endStream, module configured to throw during endStream for stream: 2 " $?
0117 fi
0118
0119 if [ $1 -eq 15 ]
0120 then
0121 grep -q "Processing endJob" $logfile || die " - Cannot find the following string in the exception message: Processing endJob " $?
0122 grep -q "ExceptionThrowingProducer::endJob, module configured to throw during endJob" $logfile || die " - Cannot find the following string in the exception message: ExceptionThrowingProducer::endJob, module configured to throw during endJob " $?
0123 fi
0124
0125 exit 0