Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-22 06:24:59

0001 
0002 #!/bin/bash
0003 SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
0004 
0005 function diebu {  echo Failure $1: status $2 ; echo "" ; echo "----- Error -----"; echo ""; cat out_2_bu.log;  rm -rf $3/{ramdisk,data,dqmdisk,*.py}; exit $2 ; }
0006 function diefu {  echo Failure $1: status $2 ; echo "" ; echo "----- Error -----"; echo ""; cat out_2_fu.log;  rm -rf $3/{ramdisk,data,dqmdisk,*.py}; exit $2 ; }
0007 function diedqm { echo Failure $1: status $2 ; echo "" ; echo "----- Error -----"; echo ""; cat out_2_dqm.log; rm -rf $3/{ramdisk,data,dqmdisk,*.py}; exit $2 ; }
0008 
0009 FUSCRIPT="unittest_FU.py"
0010 if [ ! -z $1 ]; then
0011   if [ "$1" == "local" ]; then
0012     FUSCRIPT="startFU.py"
0013     echo "local run: using ${FUSCRIPT}"
0014   fi
0015 fi
0016 
0017 if [ -z  $LOCAL_TEST_DIR ]; then
0018 LOCAL_TEST_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
0019 fi
0020 echo "LOCAL_TEST_DIR = $LOCAL_TEST_DIR"
0021 
0022 if [ -z  $LOCAL_TMP_DIR ]; then
0023 LOCAL_TMP_DIR="/tmp"
0024 fi
0025 
0026 cd $LOCAL_TEST_DIR
0027 
0028 RC=0
0029 P=$$
0030 PREFIX=results_${USER}${P}
0031 OUTDIR=${LOCAL_TMP_DIR}/${PREFIX}
0032 
0033 echo "OUT_TMP_DIR = $OUTDIR"
0034 
0035 mkdir ${OUTDIR}
0036 cp ${SCRIPTDIR}/startBU.py ${OUTDIR}
0037 cp ${SCRIPTDIR}/startFU.py ${OUTDIR}
0038 cp ${SCRIPTDIR}/unittest_FU.py ${OUTDIR}
0039 cp ${SCRIPTDIR}/test_dqmstream.py ${OUTDIR}
0040 cd ${OUTDIR}
0041 
0042 rm -rf $OUTDIR/{ramdisk,data,dqmdisk,*.log}
0043 
0044 runnumber="100101"
0045 echo "Running test with FRD file header (no index JSONs)"
0046 CMDLINE_STARTBU="cmsRun startBU.py runNumber=${runnumber} fffBaseDir=${OUTDIR} maxLS=2 fedMeanSize=128 eventsPerFile=20 eventsPerLS=35 frdFileVersion=1"
0047 #CMDLINE_STARTFU="cmsRun startFU.py runNumber=${runnumber} fffBaseDir=${OUTDIR}"
0048 CMDLINE_STARTFU="cmsRun ${FUSCRIPT} runNumber=${runnumber} fffBaseDir=${OUTDIR}"
0049 ${CMDLINE_STARTBU}  > out_2_bu.log 2>&1 || diebu "${CMDLINE_STARTBU}" $? $OUTDIR
0050 ${CMDLINE_STARTFU}  > out_2_fu.log 2>&1 || diefu "${CMDLINE_STARTFU}" $? $OUTDIR
0051 
0052 #prepare DQM files
0053 mkdir dqmdisk/run${runnumber} -p
0054 cat data/run${runnumber}/run${runnumber}_ls0000_streamDQM_pid*.ini > dqmdisk/run${runnumber}/run${runnumber}_ls0001_streamDQM_test.dat
0055 cat data/run${runnumber}/run${runnumber}_ls0001_streamDQM_pid*.dat >> dqmdisk/run${runnumber}/run${runnumber}_ls0001_streamDQM_test.dat
0056 find dqmdisk
0057 echo '{"data": [12950, 1620, 0, "run'${runnumber}'_ls0001_streamDQM_test.dat", 40823782, 1999348078, 135, 13150, 0, "Failsafe"]}' > dqmdisk/run${runnumber}/run${runnumber}_ls0001_streamDQM_test.jsn
0058 
0059 CMDLINE_STARTDQM="cmsRun test_dqmstream.py runInputDir=./dqmdisk runNumber=100101"
0060 ${CMDLINE_STARTDQM} > out_2_dqm.log 2>&1 || diedqm "${CMDLINE_STARTDQM}" $? $OUTDIR
0061 
0062 #no failures, clean up everything including logs if there are no errors
0063 echo "Completed sucessfully"
0064 #rm -rf $OUTDIR/{ramdisk,data,*.py,*.log}
0065 rm -rf $OUTDIR
0066 
0067 exit ${RC}