File indexing completed on 2024-04-06 12:31:53
0001
0002
0003
0004 function die { echo $1: status $2 ; exit $2; }
0005
0006 function testJSON {
0007
0008
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 d = json.loads(line)
0015 for k in d.keys():
0016 if k in ['producer', 'type', 'type_prefix', 'timestamp', 'host']:
0017 raise RuntimeError("Found restricted keyword %s"%k)
0018 EOF
0019 RET=$?
0020 if [ "x$RET" != "x0" ]; then
0021 echo "Invalid JSON in $1:"
0022 cat test.json
0023 exit $RET
0024 fi
0025 }
0026
0027 LOCAL_TEST_DIR=${CMSSW_BASE}/src/Utilities/StorageFactory/test
0028 LOCAL_TMP_DIR=${CMSSW_BASE}/tmp/${SCRAM_ARCH}
0029
0030 pushd ${LOCAL_TMP_DIR}
0031
0032
0033 cmsRun ${LOCAL_TEST_DIR}/make_test_files_cfg.py &> make_test_files.log || die "cmsRun make_test_files_cfg.py" $?
0034 rm make_test_files.log
0035 cmsRun ${LOCAL_TEST_DIR}/make_2nd_file_cfg.py &> make_2nd_file.log || die "cmsRun make_2nd_file_cfg.py" $?
0036 rm make_2nd_file.log
0037
0038 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" $?
0039 grep -q '"file_lfn":"file:stat_sender_first.root"' test_single_file_statistics_sender.log || die "no StatisticsSenderService output for single file" 1
0040 grep -q "\"cmssw_version\":\"$CMSSW_VERSION\"" test_single_file_statistics_sender.log || die "no StatisticsSenderService output for CMSSW version" 1
0041 testJSON test_single_file_statistics_sender.log
0042 rm test_single_file_statistics_sender.log
0043
0044 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" $?
0045 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
0046 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
0047 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
0048 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
0049 testJSON test_multiple_files_file_statistics_sender.log
0050 rm test_multiple_files_file_statistics_sender.log
0051
0052 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" $?
0053 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
0054 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
0055 testJSON test_multi_file_statistics_sender.log
0056 rm test_multi_file_statistics_sender.log
0057
0058 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" $?
0059 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
0060 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
0061 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
0062 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
0063 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
0064 testJSON test_secondary_file_statistics_sender.log
0065 rm test_secondary_file_statistics_sender.log
0066
0067 popd