-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests.sh
executable file
·151 lines (119 loc) · 4.1 KB
/
run-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/bash
#
# Global setup
#
export FCCTESTS_SCRIPTPATH=$(realpath "$0")
export FCCTESTS_DIR=$(dirname "${FCCTESTS_SCRIPTPATH}")
export FCCTESTS_TMPDIR=/tmp/fcc-tests
LOGDIR_STEM="${FCCTESTS_TMPDIR}/log"
SUMMARYFILE="${FCCTESTS_TMPDIR}/fcc-test-summary.txt"
MAILFILE="${FCCTESTS_TMPDIR}/fcc-test-mail.txt"
MAILLISTFILE=${FCCTESTS_DIR}/emails.lst
RUNDATE=$(date)
NFAILURES=0
: > ${SUMMARYFILE} # Clearing summary file
rm -rf ${FCCTESTS_TMPDIR}
mkdir -p "${FCCTESTS_TMPDIR}"
declare -A STACKS=(
["stable"]="/cvmfs/sw.hsf.org/key4hep/setup.sh"
["nightlies"]="/cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh"
)
#
# Run tests
#
#
# Podio/EDM4hep tests
#
declare -A EDM4HEPINFILES=(
# ["spring-2021"]="/eos/experiment/fcc/ee/generation/DelphesEvents/spring2021/IDEA/p8_ee_ZH_ecm240/events_101027117.root"
# ["winter-2023"]="/eos/experiment/fcc/ee/generation/DelphesEvents/winter2023/IDEA/p8_ee_ZZ_ecm240/events_092194859.root"
)
declare -a EDM4HEPTESTS=(
# podio/podio-dump
# podio/podio-dump-detail
# edm4hep/edm4hep2json
)
for TEST in "${EDM4HEPTESTS[@]}"; do
for STACK in "${!STACKS[@]}"; do
export FCCTESTS_STACK=${STACKS[$STACK]}
for INFILE in "${!EDM4HEPINFILES[@]}"; do
export FCCTESTS_INFILE=${EDM4HEPINFILES[$INFILE]}
LOGDIR="${LOGDIR_STEM}/${TEST}/${STACK}/${INFILE}"
mkdir -p "${LOGDIR}"
echo $(date) > "${LOGDIR}/out.log"
if ! bash "${FCCTESTS_DIR}/${TEST}.sh" >> "${LOGDIR}/out.log" 2> "${LOGDIR}/err.log"; then
NFAILURES=$((NFAILURES+1))
echo -e "\n[FAILURE] ${TEST}" | tee -a ${SUMMARYFILE} 1>&2
echo " Stack: ${STACK}" | tee -a ${SUMMARYFILE} 1>&2
echo " Campaign: ${INFILE}" | tee -a ${SUMMARYFILE} 1>&2
else
echo -e "\n[SUCCESS] ${TEST}" | tee -a ${SUMMARYFILE} 1>&2
echo " Stack: ${STACK}" | tee -a ${SUMMARYFILE} 1>&2
echo " Campaign: ${INFILE}" | tee -a ${SUMMARYFILE} 1>&2
fi
echo $(date) >> "${LOGDIR}/out.log"
done
done
echo "---" | tee -a ${SUMMARYFILE} 1>&2
done
echo
#
# FCCAnalyses tests
#
declare -a FCCANATESTS=(
fccanalyses/fccanalysis-build
fccanalyses/fccanalysis-build-pre-edm4hep1
fccanalyses/fccanalysis-build-cmake
fccanalyses/fccanalysis-build-acts-on
fccanalyses/fccanalysis-build-full-analysis
fccanalyses/fccanalysis-build-full-analysis-user-args
fccanalyses/fccanalysis-build-full-analysis-old-anascripts
fccanalyses/fccanalysis-build-full-analysis-pre-edm4hep1
fccanalyses/fccanalysis-build-full-analysis-pre-edm4hep1-old-anascripts
fccanalyses/fccanalysis-stack-help
fccanalyses/fccanalysis-stack-run
fccanalyses/fccanalysis-stack-full-analysis
fccanalyses/fccanalysis-build-calo-ntupleizer
fccanalyses/fccanalysis-stack-calo-ntupleizer
)
for TEST in "${FCCANATESTS[@]}"; do
for STACK in "${!STACKS[@]}"; do
export FCCTESTS_STACK=${STACKS[$STACK]}
LOGDIR="${LOGDIR_STEM}/${TEST}/${STACK}"
mkdir -p "${LOGDIR}"
echo $(date) > "${LOGDIR}/out.log"
if ! bash "${FCCTESTS_DIR}/${TEST}.sh" >> "${LOGDIR}/out.log" 2> "${LOGDIR}/err.log"; then
NFAILURES=$((NFAILURES+1))
echo -e "\n[FAILURE] ${TEST}" | tee -a ${SUMMARYFILE} 1>&2
echo " Stack: ${STACK}" | tee -a ${SUMMARYFILE} 1>&2
else
echo -e "\n[SUCCESS] ${TEST}" | tee -a ${SUMMARYFILE} 1>&2
echo " Stack: ${STACK}" | tee -a ${SUMMARYFILE} 1>&2
fi
echo $(date) >> "${LOGDIR}/out.log"
done
echo "---" | tee -a ${SUMMARYFILE} 1>&2
done
#
# Send email(s)
#
if [ "${NFAILURES}" -eq "0" ]; then
echo "Subject: FCC Tests: All tests succeeded" > ${MAILFILE}
else
echo "Subject: FCC Tests: ${NFAILURES} failures" > ${MAILFILE}
fi
{
echo -e "Hi,\n"
echo -e "The tests run at ${RUNDATE}, and there were ${NFAILURES} failures.\n"
} >> ${MAILFILE}
cat ${SUMMARYFILE} >> ${MAILFILE}
if [ ! -f "${MAILLISTFILE}" ]; then
echo "Can't find email list file: ${MAILLISTFILE}" | tee -a ${SUMMARYFILE} 1>&2
exit 1
fi
readarray -t EMAILS < "${MAILLISTFILE}"
if [ "${#EMAILS[@]}" -lt 1 ]; then
echo "Email list file is probably empty!" | tee -a ${SUMMARYFILE} 1>&2
exit 1
fi
/usr/sbin/sendmail -t "${EMAILS[@]}" < ${MAILFILE}