Debian Codegraph @

tools/testing/reporting/scripts/mkJIRArefs.current

raw
1 #!/bin/bash
2
3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements. See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to you under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18 SANDBOX=$1
19 WHICH_REVISION=$2
20 # DEBUG echo "+++ $0"
21 # SHOULD BE DEFINED OUTSIDE. DERBYDIR=${HOME}/Apache/${SANDBOX}
22 if [ "${DERBYDIR}" == "" ] || [ "${WHICH_REVISION}" == "" ]
23 then
24 echo "Usage: $0 <DERBYDIR> revision"
25 echo " Example: $0 Derby ..."
26 echo " $0 DerbyJvm1.4 ..."
27 echo " $0 TinderBox_Derby ..."
28 exit
29 fi
30
31 if [ ! -e ${DERBYDIR} ]
32 then
33 echo "${DERBYDIR} does not exist."
34 exit
35 fi
36
37 cd ${DERBYDIR}
38 if [ ! -e env.sh ]
39 then
40 echo "${DERBYDIR} does not appear to be a Derby sandbox (No env.sh found)"
41 exit
42 fi
43 . ./env.sh
44
45 TOOLDIR="${DERBYDIR}/${BRANCH_DIR}/tools/testing/reporting/scripts"
46 . ${TOOLDIR}/env
47
48 JIRA_DESCRIPTIONS="${DERBYDIR}/${BRANCH_DIR}/tools/testing/reporting/Failures/JIRA_description.txt"
49
50 # Get the list of testsuite we are running:
51 TESTLISTFILE="${DERBYDIR}/testing/showtestlist"
52 SUITES=`gawk '{ print $1 }' ${TESTLISTFILE} | grep -v "^#"`
53 ## SUITES="derbyall"
54
55 if [ ! -e ${TESTLOGDIR} ]
56 then
57 echo "${TESTLOGDIR} does not exist"
58 exit
59 fi
60 # Get the set of platforms
61 cd ${TESTLOGDIR}
62 PLATFORMS=`ls`
63
64 # cd ${DERBYDIR}/Failures
65 cd ${DERBYDIR}/FailReports
66
67 # mkdir -p ${SANDBOX}
68 # chmod go+rx ${SANDBOX}
69
70 if [ "${WHICH_REVISION}" == "current" ]
71 then # DOES NOT WORK for DBTGQA tests: FIXME or just drop mkJIRArefs.current.... Not used for DBTGQA tests.
72 REVISION=`grep "/classes] " ${DERBYDIR}/BuildLog/currentSysInfo.txt | gawk -F] '{ print $2 }'` # Problem here
73 REVISION=`echo "${REVISION}" | gawk -F\( '{ print $2 }' | gawk -F\) '{ print $1 }'`
74 elif [ "${WHICH_REVISION}" == "previous" ]
75 then
76 REVISIONSFILE="${DERBYDIR}/testing/revisionlist"
77 PREVREV=`grep -v "^#" ${REVISIONSFILE} | head -2 | tail -1 | gawk '{ print $1 }'`
78 REVISION=`grep "/classes] " ${DERBYDIR}/BuildLog/${PREVREV}/sysinfo.txt | gawk -F] '{ print $2 }'` # Problem here
79 REVISION=`echo "${REVISION}" | gawk -F\( '{ print $2 }' | gawk -F\) '{ print $1 }'`
80 fi
81 echo "${WHICH_REVISION} ${REVISION}"
82 # Next is added since we now get e.g. 394991:394993M
83 REVISION=`echo "${REVISION}" | gawk -F: '{ print $1 }'`
84 REVISION=`echo ${REVISION} | sed -e 's/M//'`
85 echo "${WHICH_REVISION} ${REVISION}"
86
87 # SUMMARY="${SANDBOX}/${REVISION}.html"
88 SUMMARY="${REVISION}.html"
89 echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" > ${SUMMARY}
90 echo "<html>" >> ${SUMMARY}
91 echo "<head>" >> ${SUMMARY}
92 echo "<title>${WHICH_REVISION} ${DERBYVERSION} Apache Derby Open Source Database</title>" >> ${SUMMARY}
93 echo "</head>" >> ${SUMMARY}
94 echo "<body>" >> ${SUMMARY}
95 echo "<font size=\"+2\"><b><i>${SANDBOX}</i> ${REVISION}</b></font>" >> ${SUMMARY}
96
97 echo "${SANDBOX}"
98 echo "<TABLE border="1">" >> ${SUMMARY}
99
100 echo "<TR>" >> ${SUMMARY}
101 for PLATFORM in ${PLATFORMS}
102 do
103 if [ -e ${DERBYDIR}/testing/testlog/${PLATFORM}/externallyVisible ] && [ ! -e ${DERBYDIR}/testing/testlog/${PLATFORM}/excludeFromMailReport ]
104 then
105 echo "<TD>" >> ${SUMMARY}
106 TEMP=`echo ${PLATFORM} | sed -e 's/_/<br>/g'`
107 # echo "${PLATFORM}" >> ${SUMMARY}
108 echo "${TEMP}" >> ${SUMMARY}
109 echo "</TD>" >> ${SUMMARY}
110 fi
111 done
112 echo "</TR>" >> ${SUMMARY}
113
114 echo "<TR>" >> ${SUMMARY}
115
116 PUREREVISION=`echo ${REVISION} | sed -e 's/M//'`
117
118 for PLATFORM in ${PLATFORMS}
119 do
120 HADERRORS=""
121 if [ -e ${DERBYDIR}/testing/testlog/${PLATFORM}/externallyVisible ] && [ ! -e ${DERBYDIR}/testing/testlog/${PLATFORM}/excludeFromMailReport ]
122 then
123 echo "<TD style=\"vertical-align: top;\">" >> ${SUMMARY}
124 # echo "${PLATFORM}" >> ${SUMMARY}
125 # echo "</TD>" >> ${SUMMARY}
126 for SUITE in ${SUITES}
127 do
128 if [ -e ${DERBYDIR}/testing/testlog/${PLATFORM}/${WHICH_REVISION}.csv ]
129 then
130 # echo " ${SUITE}"
131 # echo "${DERBYDIR}/testing/testlog/${PLATFORM}/${PUREREVISION}-${SUITE}_fail.txt"
132 if [ -e ${DERBYDIR}/testing/testlog/${PLATFORM}/${PUREREVISION}-${SUITE}_fail.txt ]
133 then
134 FAILFILE="${DERBYDIR}/testing/testlog/${PLATFORM}/${PUREREVISION}-${SUITE}_fail.txt"
135 # dos2unix ${FAILFILE} FAILFILE$$
136 gawk '{ sub("\r$", ""); print }' ${FAILFILE} > FAILFILE$$
137 FAILFILE="FAILFILE$$"
138 # echo "FAILFILE: ${FAILFILE}"
139 JUNIT=`echo ${SUITE} | grep 'org.apache.derbyTesting.'`
140 if [ "${JUNIT}" == "" ]
141 then
142 LINES=`grep : ${FAILFILE}`
143 else
144 # LINES=`grep "^.*) " ${FAILFILE} | sed -e 's/^[1-9]).//' | sed -e 's/org.apache.derbyTesting/../' | sed -e 's/).*: /) /'`
145 LINES=`grep "^.*) " ${FAILFILE} | sed -e 's/^[1-9]).//' | sed -e 's/org.apache.derbyTesting/../' | sed -e 's/).*: /) /' | gawk '{ print $1 }'`
146 fi
147 # Better go via file to really have LINES be a set of lines which may contain blanks.
148 # The way it stands now each "word" is treated as a LINE.
149 rm ${FAILFILE}
150 # echo "LINES: ${LINES}"
151 JIRALIST=""
152 for LINE in ${LINES}
153 do
154 # echo "LINE: ${LINE}"
155 if [ "${JUNIT}" == "" ]
156 then
157 FAILEDTEST=`echo ${LINE} | gawk -F: '{ print $2 }'`
158 else
159 FAILEDTEST=`echo ${LINE} | gawk '{ print $1 }'`
160 fi
161 # echo "FAILEDTEST: ${FAILEDTEST}"
162 JIRA=`grep -v "^#" ${JIRA_DESCRIPTIONS} | grep "${FAILEDTEST}" | gawk '{ print $1 }'`
163 # echo "JIRA: ${JIRA}"
164 if [ "${JIRA}" == "" ]
165 then
166 JIRA="'${FAILEDTEST}':<BR>&nbsp;&nbsp;<i><b>New JIRA?</b></i><BR>"
167 else
168 JIRAS=${JIRA}
169 INNERJIRAS="'${FAILEDTEST}':"
170 ORDELIM=""
171 for JIRA in ${JIRAS}
172 do
173 if [ "${JIRA}" == "NEW?" ]
174 then
175 JIRA="&nbsp;&nbsp;${ORDELIM}<i><b>New JIRA?</b></i>"
176 else
177 JIRA="&nbsp;&nbsp;${ORDELIM}<A HREF=\"https://issues.apache.org/jira/browse/DERBY-${JIRA}\">DERBY-${JIRA}</A>"
178 fi
179 INNERJIRAS="${INNERJIRAS}<BR>${JIRA}"
180 ORDELIM="or "
181 done
182 JIRA="${INNERJIRAS}<BR>"
183 fi
184 # echo " ${REVISION} ${JIRA} ${SANDBOX} ${PLATFORM}"
185 JIRALIST="${JIRALIST}<BR>${JIRA}"
186 done # LINES
187 echo "<b>${SUITE}</b>: ${JIRALIST}<BR><BR>" >> ${SUMMARY}
188 HADERRORS="${HADERRORS}E"
189 else
190 # echo "${DERBYDIR}/testing/testlog/${PLATFORM}/${REVISION}-${SUITE}_fail.txt does not exist"
191 # echo " ${REVISION} NA ${SANDBOX} ${PLATFORM} (Not available)"
192 # echo "<b><i>${SUITE}</i></b>" >> ${SUMMARY}
193 HADERRORS="${HADERRORS}"
194 if [ "${SUITE}" == "derbyall" ] && [ -e ${DERBYDIR}/testing/testlog/${PLATFORM}/${PUREREVISION}.csv ]
195 then
196 DERBYALLRUN=`grep derbyall ${DERBYDIR}/testing/testlog/${PLATFORM}/${PUREREVISION}.csv`
197 if [ "${DERBYALLRUN}" != "" ]
198 then
199 DAERR=`echo ${DERBYALLRUN} | gawk '{ print $2 }'`
200 ERRS="No errors!"
201 if [ "${DAERR}" == "" ]
202 then
203 ERRS="Unknown!"
204 HADERRORS="${HADERRORS}U"
205 fi
206 echo "<b>${SUITE}</b>: <br><b><i>${ERRS}</i></b><br><br>" >> ${SUMMARY}
207 fi
208 fi
209 fi # [ -e ${DERBYDIR}/testing/testlog/${PLATFORM}/${PUREREVISION}-${SUITE}_fail.txt ]
210 fi # [ -e ${DERBYDIR}/testing/testlog/${PLATFORM}/${WHICH_REVISION}.csv ]
211 done # SUITES
212 echo ${HADERRORS}
213 if [ ! -e ${DERBYDIR}/testing/testlog/${PLATFORM}/${PUREREVISION}-system ]
214 then
215 echo "<b>${REVISION}: <i>NA</i></b>" >> ${SUMMARY}
216 elif [ ! -e ${DERBYDIR}/testing/testlog/${PLATFORM}/${PUREREVISION}.csv ]
217 then
218 echo "<b>TOTAL: <i>NA</i></b>" >> ${SUMMARY}
219 elif [ "${HADERRORS}" == "" ]
220 then
221 echo "<br><br><b>TOTAL:</b>: <br><b><i>No errors!</i></b>" >> ${SUMMARY}
222 fi
223 echo "</TD>" >> ${SUMMARY}
224 fi # [ -e ${DERBYDIR}/testing/testlog/${PLATFORM}/externallyVisible ] && [ no -e ${PLATFORM}/excludeFromMailReport ]
225 done # PLATFORMS
226 echo "</TR>" >> ${SUMMARY}
227 echo "</TABLE>" >> ${SUMMARY}
228 date >> ${SUMMARY}
229 echo "</body>" >> ${SUMMARY}
230 chmod go+r ${SUMMARY}
231
232 # Make SUMARY publicly available:
233 SRC="${SUMMARY}"
234 DST="${PUBLISHDIR}"
235 echo "**** OBS! ${SCPUT} ${SRC} ${PUBLISHUSER}@${PUBLISHSITE}:${DST}/${SANDBOX}/FailReports/"
236 ### ${SCPUT} ${SRC} ${PUBLISHUSER}@${PUBLISHSITE}:${DST}/${SANDBOX}/FailReports/
237 # DEBUG echo "--- $0"