Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-18 02:30:21

0001 #!/bin/bash
0002 
0003 # Pass in name and status
0004 function die { echo $1: status $2 ;  exit $2; }
0005 
0006 function testJSON {
0007     # The JSON document is on one line, using an arbitrary key here to
0008     # extract all of the documents into a separte file
0009     grep cmssw_version $1 > test.json
0010     python3 <<EOF
0011 import json
0012 with open('test.json') as f:
0013     for line in f:
0014         json.loads(line)
0015 EOF
0016     RET=$?
0017     if [ "x$RET" != "x0" ]; then
0018         echo "Invalid JSON in $1:"
0019         cat test.json
0020         exit $RET
0021     fi
0022 }
0023 
0024 LOCAL_TEST_DIR=${CMSSW_BASE}/src/Utilities/StorageFactory/test
0025 LOCAL_TMP_DIR=${CMSSW_BASE}/tmp/${SCRAM_ARCH}
0026 
0027 pushd ${LOCAL_TMP_DIR}
0028 
0029 #setup files used in tests
0030 cmsRun ${LOCAL_TEST_DIR}/make_test_files_cfg.py &> make_test_files.log || die "cmsRun make_test_files_cfg.py" $?
0031 rm make_test_files.log
0032 cmsRun ${LOCAL_TEST_DIR}/make_2nd_file_cfg.py &> make_2nd_file.log || die "cmsRun make_2nd_file_cfg.py" $?
0033 rm make_2nd_file.log
0034 
0035 cmsRun ${LOCAL_TEST_DIR}/test_single_file_statistics_sender_cfg.py &> test_single_file_statistics_sender.log || die "cmsRun test_single_file_statistics_sender_cfg.py" $?
0036 grep -q '"file_lfn":"file:stat_sender_first.root"' test_single_file_statistics_sender.log || die "no StatisticsSenderService output for single file" 1
0037 grep -q "\"cmssw_version\":\"$CMSSW_VERSION\"" test_single_file_statistics_sender.log || die "no StatisticsSenderService output for CMSSW version" 1
0038 testJSON test_single_file_statistics_sender.log
0039 rm test_single_file_statistics_sender.log
0040 
0041 cmsRun ${LOCAL_TEST_DIR}/test_multiple_files_file_statistics_sender_cfg.py &> test_multiple_files_file_statistics_sender.log || die "cmsRun test_multiple_files_file_statistics_sender_cfg.py" $?
0042 grep -q '"file_lfn":"file:stat_sender_b.root"' test_multiple_files_file_statistics_sender.log || die "no StatisticsSenderService output for file b in multiple files" 1
0043 grep -q '"file_lfn":"file:stat_sender_c.root"' test_multiple_files_file_statistics_sender.log || die "no StatisticsSenderService output for file c in multiple files" 1
0044 grep -q '"file_lfn":"file:stat_sender_d.root"' test_multiple_files_file_statistics_sender.log || die "no StatisticsSenderService output for file d in multiple files" 1
0045 grep -q '"file_lfn":"file:stat_sender_e.root"' test_multiple_files_file_statistics_sender.log || die "no StatisticsSenderService output for file e in multiple files" 1
0046 testJSON test_multiple_files_file_statistics_sender.log
0047 rm test_multiple_files_file_statistics_sender.log
0048 
0049 cmsRun ${LOCAL_TEST_DIR}/test_multi_file_statistics_sender_cfg.py &> test_multi_file_statistics_sender.log || die "cmsRun test_multi_file_statistics_sender_cfg.py" $?
0050 grep -q '"file_lfn":"file:stat_sender_first.root"' test_multi_file_statistics_sender.log || die "no StatisticsSenderService output for file first in multi file" 1
0051 grep -q '"file_lfn":"file:stat_sender_second.root"' test_multi_file_statistics_sender.log || die "no StatisticsSenderService output for file second in multi file" 1
0052 testJSON test_multi_file_statistics_sender.log
0053 rm test_multi_file_statistics_sender.log
0054 
0055 cmsRun ${LOCAL_TEST_DIR}/test_secondary_file_statistics_sender_cfg.py &> test_secondary_file_statistics_sender.log || die "cmsRun test_secondary_file_statistics_sender_cfg.py" $?
0056 grep -q '"file_lfn":"file:stat_sender_first.root"' test_secondary_file_statistics_sender.log || die "no StatisticsSenderService output for file 'first' in secondary files"  1
0057 grep -q '"file_lfn":"file:stat_sender_b.root"' test_secondary_file_statistics_sender.log || die "no StatisticsSenderService output for file 'b' in secondary files"  1
0058 grep -q '"file_lfn":"file:stat_sender_c.root"' test_secondary_file_statistics_sender.log || die "no StatisticsSenderService output for file 'c' in secondary files"  1
0059 grep -q '"file_lfn":"file:stat_sender_d.root"' test_secondary_file_statistics_sender.log || die "no StatisticsSenderService output for file 'd' in secondary files"  1
0060 grep -q '"file_lfn":"file:stat_sender_e.root"' test_secondary_file_statistics_sender.log || die "no StatisticsSenderService output for file 'e' in secondary files"  1
0061 testJSON test_secondary_file_statistics_sender.log
0062 rm test_secondary_file_statistics_sender.log
0063 
0064 popd