File indexing completed on 2024-11-07 06:12:40
0001
0002
0003 SCRIPTS_DIR=${CMSSW_BASE}/src/CondTools/RunInfo/python
0004
0005 function die {
0006 log_file="$3"
0007 if [ -f "$log_file" ]; then
0008 echo "Log output:"
0009 cat "$log_file"
0010 fi
0011 echo "Failure $1: status $2"
0012 exit $2
0013 }
0014
0015 assert_equal() {
0016 expected="$1"
0017 actual="$2"
0018 message="$3"
0019 log_file="$4"
0020
0021 if [ "$expected" != "$actual" ]; then
0022 die "$message: Expected $expected, but got $actual" 1 "$log_file"
0023 fi
0024 }
0025
0026 function assert_found_fills {
0027 log_file="$1"
0028 script_name="$2"
0029 shift 2
0030 for fill_nr in "$@"; do
0031 if ! grep -q "Found fill $fill_nr" "$log_file"; then
0032 die "$script_name didn't find fill $fill_nr" 1 "$log_file"
0033 fi
0034 done
0035 }
0036
0037 rm -f lhcinfo_pop_unit_test.db
0038
0039 echo "testing LHCInfoPerFillPopConAnalyzer in endFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\""
0040 cmsRun ${SCRIPTS_DIR}/LHCInfoPerFillPopConAnalyzer_cfg.py mode=endFill \
0041 destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \
0042 startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \
0043 tag=fill_end_test > fill_end_test.log || die "cmsRun LHCInfoPerFillPopConAnalyzer_cfg.py mode=endFill" $? "fill_end_test.log"
0044 assert_equal 7 `cat fill_end_test.log | grep -E '^Since ' | \
0045 wc -l` "LHCInfoPerFillPopConAnalyzer in EndFill mode written wrong number of payloads" "fill_end_test.log"
0046 assert_found_fills fill_end_test.log "LHCInfoPerFillPopConAnalyzer in EndFill mode" 8307 8309
0047
0048 echo "testing LHCInfoPerLSPopConAnalyzer in endFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\""
0049 cmsRun ${SCRIPTS_DIR}/LHCInfoPerLSPopConAnalyzer_cfg.py mode=endFill \
0050 destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \
0051 startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \
0052 tag=ls_end_test > ls_end_test.log || die "cmsRun LHCInfoPerLSPopConAnalyzer_cfg.py mode=endFill" $? "ls_end_test.log"
0053 assert_equal 169 `cat ls_end_test.log | grep -E '^Since ' | \
0054 wc -l` "LHCInfoPerLSPopConAnalyzer in endFill mode written wrong number of payloads" "ls_end_test.log"
0055 assert_found_fills ls_end_test.log "LHCInfoPerLSPopConAnalyzer in endFill mode" 8307 8309
0056
0057 echo "testing LHCInfoPerLSPopConAnalyzer in endFill mode for startTime=\"2022-07-11 22:00:00.000\" endTime=\"2022-07-12 18:10:10.000\""
0058 cmsRun ${SCRIPTS_DIR}/LHCInfoPerLSPopConAnalyzer_cfg.py mode=endFill \
0059 destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \
0060 startTime="2022-07-11 22:00:00.000" endTime="2022-07-12 18:10:10.000" \
0061 tag=ls_end_test2 > ls_end_test2.log || die "cmsRun LHCInfoPerLSPopConAnalyzer_cfg.py mode=endFill" $? "ls_end_test2.log"
0062 assert_equal 70 `cat ls_end_test2.log | grep -E '^Since ' | \
0063 wc -l` "LHCInfoPerLSPopConAnalyzer in endFill mode written wrong number of payloads" "ls_end_test2.log"
0064 assert_found_fills ls_end_test2.log "LHCInfoPerLSPopConAnalyzer in endFill mode" 7967
0065
0066 echo "1663505258250241" > last_lumi.txt
0067
0068 echo "testing LHCInfoPerFillPopConAnalyzer in duringFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\""
0069 cmsRun ${SCRIPTS_DIR}/LHCInfoPerFillPopConAnalyzer_cfg.py mode=duringFill \
0070 destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \
0071 startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \
0072 lastLumiFile=last_lumi.txt \
0073 tag=fill_during_test > fill_during_test.log || die "cmsRun LHCInfoPerFillPopConAnalyzer_cfg.py" $? "fill_during_test.log"
0074 assert_equal 1 `cat fill_during_test.log | grep -E 'uploaded with since' | \
0075 wc -l` "LHCInfoPerFillPopConAnalyzer in DuringFill written wrong number of payloads" "fill_during_test.log"
0076
0077 echo "testing LHCInfoPerLSPopConAnalyzer in duringFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\""
0078 cmsRun ${SCRIPTS_DIR}/LHCInfoPerLSPopConAnalyzer_cfg.py mode=duringFill \
0079 destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \
0080 lastLumiFile=last_lumi.txt \
0081 startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \
0082 tag=ls_during_test > ls_during_test.log || die "cmsRun LHCInfoPerLSPopConAnalyzer_cfg.py mode=duringFill" $? "ls_during_test.log"
0083 assert_equal 1 `cat ls_during_test.log | grep -E 'uploaded with since' | \
0084 wc -l` "LHCInfoPerLSPopConAnalyzer in duringFill mode written wrong number of payloads" "ls_during_test.log"