Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-24 02:59:14

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