Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:11

0001 #!/bin/bash
0002 
0003 function die { echo Failure $1: status $2 ; exit $2 ; }
0004 
0005 test=testRandomService
0006 
0007 pushd ${LOCAL_TMP_DIR}
0008 
0009 
0010   echo " "
0011   echo "RandomNumberGeneratorService 1"
0012   echo "=============================================="
0013   cmsRun ${LOCAL_TEST_DIR}/${test}1_cfg.py > testRandomService1Dump.txt || die "cmsRun ${LOCAL_TEST_DIR}/${test}1_cfg.py" $?
0014   diff ${LOCAL_TEST_DIR}/unit_test_outputs/testRandomService1Dump.txt  testRandomService1Dump.txt || die "comparing testRandomService1Dump.txt" $?
0015   mv testRandomService_0_t1.txt testRandomService1_0_t1.txt
0016   mv testRandomService_0_t2.txt testRandomService1_0_t2.txt
0017   mv testRandomService_0_t3.txt testRandomService1_0_t3.txt
0018   mv testRandomService_0_t4.txt testRandomService1_0_t4.txt
0019   mv testRandomService_0_t6.txt testRandomService1_0_t6.txt
0020 
0021   diff ${LOCAL_TEST_DIR}/unit_test_outputs/testRandomService1_0_t1.txt testRandomService1_0_t1.txt || die "comparing testRandomService1_0_t1.txt" $?
0022   diff ${LOCAL_TEST_DIR}/unit_test_outputs/testRandomService1_0_t2.txt testRandomService1_0_t2.txt || die "comparing testRandomService1_0_t2.txt" $?
0023   diff ${LOCAL_TEST_DIR}/unit_test_outputs/testRandomService1_0_t3.txt testRandomService1_0_t3.txt || die "comparing testRandomService1_0_t3.txt" $?
0024   diff ${LOCAL_TEST_DIR}/unit_test_outputs/testRandomService1_0_t4.txt testRandomService1_0_t4.txt || die "comparing testRandomService1_0_t4.txt" $?
0025   diff ${LOCAL_TEST_DIR}/unit_test_outputs/testRandomService1_0_t6.txt testRandomService1_0_t6.txt || die "comparing testRandomService1_0_t6.txt" $?
0026 
0027   echo " "
0028   echo "RandomNumberGeneratorService 2"
0029   echo "=============================================="
0030   cmsRun ${LOCAL_TEST_DIR}/${test}2_cfg.py || die "cmsRun ${LOCAL_TEST_DIR}/${test}2_cfg.py" $?
0031 
0032   echo " "
0033   echo "RandomNumberGeneratorService 3"
0034   echo "=============================================="
0035   cmsRun ${LOCAL_TEST_DIR}/${test}3_cfg.py || die "cmsRun ${LOCAL_TEST_DIR}/${test}3_cfg.py" $?
0036 
0037   echo " "
0038   echo "RandomNumberGeneratorService merge"
0039   echo "=============================================="
0040   cmsRun ${LOCAL_TEST_DIR}/${test}Merge1_cfg.py || die "cmsRun ${LOCAL_TEST_DIR}/${test}Merge1_cfg.py" $?
0041 
0042   echo " "
0043   echo "RandomNumberGeneratorService test 1, replay from event"
0044   echo "=============================================="
0045   cmsRun ${LOCAL_TEST_DIR}/${test}Test1_cfg.py || die "cmsRun ${LOCAL_TEST_DIR}/${test}Test1_cfg.py" $?
0046 
0047   echo " "
0048   echo "RandomNumberGeneratorService test 2, replay from text file"
0049   echo "=============================================="
0050   cmsRun ${LOCAL_TEST_DIR}/${test}Test2_cfg.py || die "cmsRun ${LOCAL_TEST_DIR}/${test}Test2_cfg.py" $?
0051 
0052   echo " "
0053   echo "RandomNumberGeneratorService multistream"
0054   echo "=============================================="
0055 
0056   rm -rf testRandomServiceL1E1.txt
0057   rm -rf testRandomServiceL1E2.txt
0058   rm -rf testRandomServiceL1E3.txt
0059   rm -rf testRandomServiceL2E4.txt
0060   rm -rf testRandomServiceL2E5.txt
0061 
0062   rm -rf stream0LastEvent.txt
0063   rm -rf stream1LastEvent.txt
0064   rm -rf stream2LastEvent.txt
0065 
0066   cmsRun ${LOCAL_TEST_DIR}/testMultiStream_cfg.py > testMultiStreamDump.txt || die "cmsRun testMultiStream_cfg.py" $?
0067   diff -I "TrackTSelector" ${LOCAL_TEST_DIR}/unit_test_outputs/testMultiStreamDump.txt  testMultiStreamDump.txt || die "comparing testMultiStreamDump.txt" $?
0068 
0069   echo " "
0070   echo "RandomNumberGeneratorService multistream test replay from event"
0071   echo "=============================================="
0072 
0073   rm -rf replaytestRandomServiceL1E1.txt
0074   rm -rf replaytestRandomServiceL1E2.txt
0075   rm -rf replaytestRandomServiceL1E3.txt
0076   rm -rf replaytestRandomServiceL2E4.txt
0077   rm -rf replaytestRandomServiceL2E5.txt
0078 
0079   rm -rf replaystream0LastEvent.txt
0080   rm -rf replaystream1LastEvent.txt
0081   rm -rf replaystream2LastEvent.txt
0082 
0083   cmsRun ${LOCAL_TEST_DIR}/testMultiStreamReplay1_cfg.py || die "cmsRun testMultiStreamReplay1_cfg.py" $?
0084 
0085   # sort so this does not depend on module execution order
0086   sort testRandomServiceL1E3.txt > testRandomServiceL1E3.sorted
0087   sort testRandomServiceL2E4.txt > testRandomServiceL2E4.sorted
0088   sort testRandomServiceL2E5.txt > testRandomServiceL2E5.sorted
0089 
0090   sort replaytestRandomServiceL1E3.txt > replaytestRandomServiceL1E3.sorted
0091   sort replaytestRandomServiceL2E4.txt > replaytestRandomServiceL2E4.sorted
0092   sort replaytestRandomServiceL2E5.txt > replaytestRandomServiceL2E5.sorted
0093 
0094   diff testRandomServiceL1E3.sorted replaytestRandomServiceL1E3.sorted || die "comparing testRandomServiceL1E3.sorted and replaytestRandomServiceL1E3.sorted" $?
0095   diff testRandomServiceL2E4.sorted replaytestRandomServiceL2E4.sorted || die "comparing testRandomServiceL2E4.sorted and replaytestRandomServiceL2E4.sorted" $?
0096   diff testRandomServiceL2E5.sorted replaytestRandomServiceL2E5.sorted || die "comparing testRandomServiceL2E5.sorted and replaytestRandomServiceL2E5.sorted" $?
0097 
0098   echo " "
0099   echo "RandomNumberGeneratorService multistream test replay from text file"
0100   echo "=============================================="
0101 
0102 
0103   # We use this if block because it is possible for the multithreading not
0104   # to give a stream any events so we look for the last stream with events
0105   # and replay the random numbers for that stream.
0106   if [ -f StashStateStream.data_2 ]
0107   then
0108     echo running cmsRun with StashStateStream.data_2
0109     mv stream2LastEvent.txt lastEvent.txt
0110   elif [ -f StashStateStream.data_1 ]
0111   then
0112     echo running cmsRun with StashStateStream.data_1
0113     mv StashStateStream.data_1 StashStateStream.data_2
0114     mv stream1LastEvent.txt lastEvent.txt
0115   elif [ -f StashStateStream.data_0 ]
0116   then
0117     echo running cmsRun with StashStateStream.data_0
0118     mv StashStateStream.data_0 StashStateStream.data_2
0119     mv stream0LastEvent.txt lastEvent.txt
0120   else
0121     echo Error: Text file containing states not found
0122     exit 1
0123   fi
0124 
0125   rm -rf replaystream0LastEvent.txt
0126   rm -rf replaystream1LastEvent.txt
0127   rm -rf replaystream2LastEvent.txt
0128 
0129   cmsRun ${LOCAL_TEST_DIR}/testMultiStreamReplay2_cfg.py || die "cmsRun testMultiStreamReplay2_cfg.py" $?
0130 
0131   # sort so this does not depend on module execution order
0132   sort lastEvent.txt > lastEvent.sorted
0133   sort replaystream0LastEvent.txt > replayLastEvent.sorted
0134 
0135   diff lastEvent.sorted replayLastEvent.sorted || die "comparing files containing random numbers of last event in a stream" $?
0136 
0137 popd
0138 
0139 exit 0