| 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 |
TOOLDIR="${DERBYDIR}/${BRANCH_DIR}/tools/testing/reporting/scripts" |
| 19 |
. ${TOOLDIR}/env |
| 20 |
|
| 21 |
VAR=$1 |
| 22 |
# Only accepts _last20 |
| 23 |
|
| 24 |
GNUPLOT=/usr/local/bin/gnuplot |
| 25 |
|
| 26 |
# Get the list of testsuite we are running: |
| 27 |
TESTLISTFILE="${DERBYDIR}/testing/testlist" |
| 28 |
SUITES=`gawk '{ print $1 }' ${TESTLISTFILE} | grep -v "^#"` |
| 29 |
|
| 30 |
# Get the set of platforms |
| 31 |
cd ${DERBYDIR}/testing/Full/plot |
| 32 |
PLATFORMS=`ls ${DERBYDIR}/testing/testlog` |
| 33 |
NPLFS=`echo ${PLATFORMS} | wc -w` |
| 34 |
echo ${PLATFORMS} |
| 35 |
|
| 36 |
GNUPLOTCMD="_GPLCMD_$$" |
| 37 |
|
| 38 |
TITLE=`echo ${DERBYDIR} | gawk -F / '{ print $NF }'` |
| 39 |
echo "<html>" > plot${VAR}.html |
| 40 |
echo "<head>" >> plot${VAR}.html |
| 41 |
echo "<meta content=\"text/html; charset=ISO-8859-1\" http-equiv=\"content-type\">" \ |
| 42 |
>> plot${VAR}.html |
| 43 |
echo "<title>${TITLE} - Duration plot</title>" >> plot${VAR}.html |
| 44 |
echo "</head>" >> plot${VAR}.html |
| 45 |
echo "<body>" >> plot${VAR}.html |
| 46 |
CREDTTM=`date` |
| 47 |
echo "<b>${TITLE} duration vs. baseline - All platforms per testsuite.</b> <i>(${CREDTTM})</i><br>" >> plot${VAR}.html |
| 48 |
for SUITE in ${SUITES} |
| 49 |
do |
| 50 |
echo ${SUITE} |
| 51 |
# Create the plot command: |
| 52 |
PLOTCMD="NOT INITIALIZED" |
| 53 |
let " PLFN = 1 " |
| 54 |
let " FIRST = 1 " # true |
| 55 |
for PLATFORM in ${PLATFORMS} |
| 56 |
do |
| 57 |
echo "${PLATFORM}" |
| 58 |
if [ -s ${PLATFORM}/${SUITE}${VAR}.data ] |
| 59 |
then |
| 60 |
if [ ${FIRST} == 1 ] |
| 61 |
then |
| 62 |
PLOTCMD="plot \"${PLATFORM}/${SUITE}${VAR}.data\" using 1:3 title \"${PLATFORM}\"" |
| 63 |
FIRST=0 |
| 64 |
else |
| 65 |
PLOTCMD="${PLOTCMD}, \"${PLATFORM}/${SUITE}${VAR}.data\" using 1:3 title \"${PLATFORM}\"" |
| 66 |
fi |
| 67 |
# echo "${PLFN} ${NPLFS}" |
| 68 |
fi |
| 69 |
let " PLFN = ${PLFN} + 1 " |
| 70 |
done |
| 71 |
echo ${PLOTCMD} |
| 72 |
# sleep 5 |
| 73 |
# Create the gnuplot settings |
| 74 |
|
| 75 |
echo "${GNUPLOT} <<EOF" > ${GNUPLOTCMD} |
| 76 |
echo "set ylabel \"${SUITE} run duration in % of baseline.\"" >> ${GNUPLOTCMD} |
| 77 |
|
| 78 |
echo "set xdata time" >> ${GNUPLOTCMD} |
| 79 |
echo "set timefmt \"%Y-%m-%d\"" >> ${GNUPLOTCMD} |
| 80 |
echo "set xrange [*:*]" >> ${GNUPLOTCMD} |
| 81 |
echo "set yrange [0:*]" >> ${GNUPLOTCMD} |
| 82 |
echo "set format x \"-%m-%d\"" >> ${GNUPLOTCMD} |
| 83 |
echo "set data style linespoints" >> ${GNUPLOTCMD} |
| 84 |
echo "set xtics rotate" >> ${GNUPLOTCMD} |
| 85 |
echo "set grid xtics" >> ${GNUPLOTCMD} |
| 86 |
echo "set key top left" >> ${GNUPLOTCMD} |
| 87 |
echo "set xtics 604800" >> ${GNUPLOTCMD} |
| 88 |
|
| 89 |
echo "set term png color" >> ${GNUPLOTCMD} |
| 90 |
echo "set out \"plot_all.png\"" >> ${GNUPLOTCMD} |
| 91 |
|
| 92 |
echo "${PLOTCMD}" >> ${GNUPLOTCMD} |
| 93 |
echo "EOF" >> ${GNUPLOTCMD} |
| 94 |
|
| 95 |
cat ${GNUPLOTCMD} |
| 96 |
. ./${GNUPLOTCMD} |
| 97 |
mv plot_all.png ${SUITE}_all${VAR}.png |
| 98 |
chmod go+r ${SUITE}_all${VAR}.png |
| 99 |
|
| 100 |
echo -n "<img src=\"" >> plot${VAR}.html |
| 101 |
echo "${SUITE}_all${VAR}.png\">" >> plot${VAR}.html |
| 102 |
# sleep 20 |
| 103 |
done # SUITES |
| 104 |
|
| 105 |
# Show baseline info for each platform: |
| 106 |
echo "<TABLE>" >> plot${VAR}.html |
| 107 |
|
| 108 |
echo "<TR>" >> plot${VAR}.html |
| 109 |
echo "<TD><i>Platform</i></TD> <TD><i>Baseline<br>Revision</i></TD> <TD><i>Baseline<br>Date time</i></TD>" >> plot${VAR}.html |
| 110 |
echo "</TR>" >> plot${VAR}.html |
| 111 |
|
| 112 |
for PLATFORM in ${PLATFORMS} |
| 113 |
do |
| 114 |
echo "<TR>" >> plot${VAR}.html |
| 115 |
BASELINE=`head -1 ${DERBYDIR}/testing/testlog/${PLATFORM}/baseline.csv | gawk '{ print $2 }'` |
| 116 |
TS=`cat ${UPDATELOGDIR}/${BASELINE}/UpdateTime` |
| 117 |
PLATF=`echo "${PLATFORM}" | sed -e 's/CYGWIN_/CYGWIN /' | gawk -F_ '{ print $1" "$2 }' | sed -e 's/CYGWIN /CYGWIN_/'` |
| 118 |
echo "<TD>${PLATF}:</TD> <TD><B>${BASELINE}</B></TD> <TD>${TS}</TD>" >> plot${VAR}.html |
| 119 |
echo "</TR>" >> plot${VAR}.html |
| 120 |
done # PLATFORMS |
| 121 |
|
| 122 |
echo "</TABLE>" >> plot${VAR}.html |
| 123 |
|
| 124 |
|
| 125 |
echo "</body>" >> plot${VAR}.html |
| 126 |
echo "</html>" >> plot${VAR}.html |
| 127 |
chmod go+r plot${VAR}.html |
| 128 |
rm ${GNUPLOTCMD} |