Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:17

0001 #!/bin/sh -e
0002 
0003 function die { echo $1: status $2 ; exit $2; }
0004 function checkDiff {
0005     FSIZE=$(stat -c%s "$1")
0006     echo "The output diff is $FSIZE:"
0007     cat $1;
0008     if [ $FSIZE -gt 0 ]
0009     then
0010       exit -1;
0011     fi
0012 }
0013 
0014 TEST_DIR=$CMSSW_BASE/src/Geometry/MTDNumberingBuilder/test
0015 
0016 F1=${TEST_DIR}/mtd_cfg.py
0017 F2=${TEST_DIR}/dd4hep_mtd_cfg.py
0018 
0019 REF_FILE="Geometry/TestReference/data/mtdNumberingRef.log.gz"
0020 REF=""
0021 for d in $(echo $CMSSW_SEARCH_PATH | tr ':' '\n') ; do
0022   if [ -e "${d}/${REF_FILE}" ] ; then
0023     REF="${d}/${REF_FILE}"
0024       break
0025   fi
0026 done
0027 [ -z $REF ] && exit 1
0028 
0029 FILE1=mtdNumberingDDD.log
0030 FILE2=mtdNumberingDD4hep.log
0031 LOG=mtdnblog
0032 DIF=mtdnbdif
0033 
0034 echo " testing Geometry/MTDNumberingBuilder"
0035 
0036 echo "===== Test \"cmsRun mtd_cfg.py\" ===="
0037 rm -f $LOG $DIF $FILE1
0038 
0039 cmsRun $F1 >& $LOG || die "Failure using cmsRun $F1" $?
0040 gzip -f $FILE1 || die "$FILE1 compression fail" $?
0041 (zdiff $FILE1.gz $REF >& $DIF || [ -s $DIF ] && checkDiff $DIF || echo "OK") || die "Failure in comparison for $FILE1" $?
0042 
0043 rm -f $LOG $DIF $FILE2
0044 echo "===== Test \"cmsRun dd4hep_mtd_cfg.py\" ===="
0045 
0046 cmsRun $F2 >& $LOG || die "Failure using cmsRun $F2" $?
0047 gzip -f $FILE2 || die "$FILE2 compression fail" $?
0048 (zdiff $FILE2.gz $REF >& $DIF || [ -s $DIF ] && checkDiff $DIF || echo "OK") || die "Failure in comparison for $FILE2" $?
0049