#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to you under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
TOOLDIR="${DERBYDIR}/${BRANCH_DIR}/tools/testing/reporting/scripts"
. ${TOOLDIR}/env
SHOWDETAILS=""
PRESENTATION="Limited"
if [ "$1" = "details" ]
then
# Show details
SHOWDETAILS="ShowDetails"
PRESENTATION="Full"
fi
# We have one catalog per platform
if [ ! -e ${TESTLOGDIR} ]
then
echo "${TESTLOGDIR} does not exist"
exit
fi
# Get the list of testsuite we are running:
TESTLISTFILE="${DERBYDIR}/testing/showtestlist"
SUITES=`gawk '{ print $1 }' ${TESTLISTFILE} | grep -v "^#"`
# Get the set of platforms
cd ${TESTLOGDIR}
PLATFORMS=`ls`
TESTID=`echo ${DERBYDIR} | gawk -F/ '{ print $NF }'`
# Derby | TinderBox_Derby | XDerbyX | myDerbySandbox | jvm1.5 ....
TINDER=`echo "${TESTID}" | grep TinderBox` # Contains TinderBox
LARGEDATA=`echo "${TESTID}" | grep LargeData` # Contains LargeData
# Get the list of revisions
REVISIONSFILE="${DERBYDIR}/testing/revisionlist"
# head -60 to reduce to approx. last 3 months of daily tests (otherwise last 60 - ..TinderBox)
# head -16 to reduce to approx. last 2 weeks of daily tests (otherwise last 16 - ..TinderBox)
NREVS=16
if [ "${TINDER}" != "" ]
then
NREVS=32
fi
# Update summary info for top level sandbox page:
CUR_REV=`gawk '{ print $1 }' ${REVISIONSFILE} | grep -v "^#" | head -1`
${TOOLDIR}/mkSandBoxSummary ${CUR_REV} "$1"
#
REVISIONS=`gawk '{ print $1 }' ${REVISIONSFILE} | grep -v "^#" | head -${NREVS}`
# LASTUPDATEREV=`gawk '{ print $1 }' ${REVISIONSFILE} | grep -v "^#" | head -1 `
PREVUPDATEREV=`gawk '{ print $1 }' ${REVISIONSFILE} | grep -v "^#" | head -2 | tail -1`
# If we use LASTUPDATEREV ~ head -1 svn log may not report the last update.... See below.
# DTI="${DERBYDIR}/testing/testSummary.html"
DTI="${DERBYDIR}/testing/${PRESENTATION}/index.html"
DTIPUB="${PUBLISHDIR}/${PRESENTATION}/index.html"
PUBLICREGRESSIONTESTMSG="
We provide daily regression test results based on the Apache Derby test suites. The regression tests are executed on several platforms.
"
INTERNALREGRESSIONTESTMSG="We currently run the Derby test suites on a number of platforms available at ${WHOWEAREINTERN}.
"
if [ "${TINDER}" != "" ]
then
PUBLICREGRESSIONTESTMSG="\"Tinderbox\" testing is performed when updates to the Derby source code repository is detected. This is done on one single test platform.
"
INTERNALREGRESSIONTESTMSG="${PUBLICREGRESSIONTESTMSG}"
fi
echo "" > ${DTI}
echo " " >> ${DTI}
chmod go+r ${DTI}
if [ "$1" = "details" ]
then
echo "Derby @ ${WHOWEARE} Regression Test Results [${TESTID}]" >> ${DTI}
else
echo "Apache Derby Open Source Database, Regression Test Results [${TESTID}]" >> ${DTI}
fi
echo "" >> ${DTI}
echo "" >> ${DTI}
if [ "$1" != "details" ]
then
# echo "
Apache Derby is an open source, 100% Java SQL Database." >> ${DTI}
echo "" >> ${DTI}
echo " " >> ${DTI}
echo " " >> ${DTI}
echo " " >> ${DTI}
echo " Apache Derby" >> ${DTI}
echo " is an open source, 100% Java SQL Database." >> ${DTI}
echo " | " >> ${DTI}
echo "
" >> ${DTI}
echo " " >> ${DTI}
echo "
" >> ${DTI}
echo "
" >> ${DTI}
fi
if [ "$1" = "details" ]
then
echo "Derby @ ${WHOWEARE} Regression Test Results [${TESTID}]" >> ${DTI}
echo "  " >> ${DTI}
echo " [All ${WHOWEARE} Derby Tests]" >> ${DTI}
echo "
" >> ${DTI}
echo "" >> ${DTI}
### UNCOMMENT IF YOU HAVE A LOGO. echo "
" >> ${DTI}
echo "${WHOWEARELONG}" >> ${DTI}
echo "" >> ${DTI}
echo "${INTERNALREGRESSIONTESTMSG}" >> ${DTI}
else
echo "Derby Regression Test Results [${TESTID}]" >> ${DTI}
echo "  " >> ${DTI}
echo " [All ${WHOWEARE} Derby Tests]" >> ${DTI}
echo "
" >> ${DTI}
echo "${WHOWEARELONG}" >> ${DTI}
echo "${PUBLICREGRESSIONTESTMSG}" >> ${DTI}
fi
echo "" >> ${DTI}
echo "Results of the latest testrun started. This will show NA for test suites not yet completed.
" >> ${DTI}
echo "Results of the previous testrun.
" >> ${DTI}
THISPWD=`pwd`
cd ${derby_source}
echo "Latest Derby revision: " >> ${DTI}
svn log -r${PREVUPDATEREV}:HEAD | grep "lines$" | grep "|" | tail -1 | sed -e 's/^r//' | gawk -F\| '{ print $1"["$3"]" }' >> ${DTI}
echo " per " >> ${DTI}
cd ${THISPWD}
date +%Y-%m-%d" "%H:%M:%S" "%Z >> ${DTI}
echo "
" >> ${DTI}
echo "Tested Revisions
" >> ${DTI}
TDB="TD style=\"vertical-align: bottom;\""
TDT="TD style=\"vertical-align: top;\""
DURHD="<$TDB>"
if [ "${TINDER}" != "" ] || [ "${LARGEDATA}" != "" ]
then # Show duration %
SHOWDURSUITE="Derbyall"
if [ "${LARGEDATA}" != "" ]
then
SHOWDURSUITE="LargeData"
fi
DURHD="<$TDB> ${SHOWDURSUITE}
duration
vs baseline "
fi
FOOTPRINTBASEREV=`head -1 ${DERBYDIR}/testing/builds/baseline.size | gawk -F\# '{ print $2 }'`
# TS=`cat ${UPDATELOGDIR}/${FOOTPRINTBASEREV}/UpdateTime`
TS=`head -2 ${DERBYDIR}/testing/builds/baseline.size | tail -1| gawk -F\# '{ print $2 }'`
BGCOLOR="bgcolor=\"${COLOR0}\""
echo "" >> ${DTI}
echo "" >> ${DTI}
echo "<$TDB> Revision " >> ${DTI}
echo "<$TDB> Date, Time " >> ${DTI}
echo "<$TDB> Changes " >> ${DTI}
echo "<$TDB> Size of derby.jar
[Baseline: ${FOOTPRINTBASEREV}
${TS}]" >> ${DTI}
echo "<$TDB> Derbyall
failures " >> ${DTI}
echo "${DURHD}" >> ${DTI}
echo "<$TDB> Notes " >> ${DTI}
echo "
" >> ${DTI}
SANDBOX=`basename ${DERBYDIR}`
no=1
for REVISION in ${REVISIONS}
do
echo "" >> ${DTI}
TS=`cat ${UPDATELOGDIR}/${REVISION}/UpdateTime`
DT=`echo ${TS} | gawk '{ print $1 }'`
TT=`echo ${TS} | gawk '{ print $2 }'`
TZ=`echo ${TS} | gawk '{ print $3 }'`
TS="${DT} ${TT} ${TZ}"
CHGLINK=" "
if [ -e ${DERBYDIR}/testing/UpdateInfo/${REVISION}.txt ]
then
## if [ "$1" != "details" ] # FIXME
## then
## CHGLINK=" Chgs "
## else
CHGLINK=" Chgs "
## fi
fi
FOOTPRINT=" "
if [ -e ${DERBYDIR}/testing/builds/${REVISION}.size ]
then
SIZE=`grep derby.jar ${DERBYDIR}/testing/builds/${REVISION}.size | gawk '{ print $2" "$3 }'`
# FOOTPRINT=" ${SIZE}"
FOOTPRINT=" ${SIZE}"
fi
DERBALLFAILS=""
DERBALLPRCNT=""
# TINDERBOX=`echo ${DERBYDIR} | grep TinderBox_`
# if [ "${TINDER}" != "" ]
# then
DERBALLFAILS="["
for PLATFORM in ${PLATFORMS} # TinderBox uses ONE platform..
do
# echo -n "${PLATFORM} "; pwd
if [ -e ${PLATFORM}/externallyVisible ] || [ "${SHOWDETAILS}" = "ShowDetails" ]
then
if [ -e ${PLATFORM}/${REVISION}.csv ]
then
# 2: Number, 3: OK, 4: Failed, 5: Skipped, 6: time
RES=`grep "^derbyall " ${PLATFORM}/${REVISION}.csv`
# DEBUG RES=`grep "^demo " ${PLATFORM}/${REVISION}.csv`
if [ "${LARGEDATA}" != "" ]
then
RES=`grep "^largeData " ${PLATFORM}/${REVISION}.csv`
fi
FAILED=`echo ${RES} | gawk '{ print $4 }'`
if [ "${FAILED}" == "" ]
then
FAILED="?"
fi
DERBALLFAILS="${DERBALLFAILS} ${FAILED} "
if [ "${TINDER}" != "" ] || [ "${LARGEDATA}" != "" ]
then
TIME=`grep "^derbyall " ${PLATFORM}/${REVISION}.csv | gawk '{ print $6 }'`
if [ "${LARGEDATA}" != "" ]
then
TIME=`grep "^largeData " ${PLATFORM}/${REVISION}.csv | gawk '{ print $6 }'`
fi
SECONDS=`${TOOLDIR}/toSeconds ${TIME}`
BASESECONDS=`grep "^derbyall " ${PLATFORM}/baseline.csv | gawk '{ print $3 }'`
if [ "${LARGEDATA}" != "" ]
then
BASESECONDS=`grep "^largeData " ${PLATFORM}/baseline.csv | gawk '{ print $3 }'`
fi
PERCENT=`${TOOLDIR}/calcPercent ${SECONDS} ${BASESECONDS}`
DERBALLPRCNT=" ${PERCENT}% "
fi
else
DERBALLFAILS="${DERBALLFAILS} - "
fi
fi # visible, showdetails
done # PLATFORMS
DERBALLFAILS="${DERBALLFAILS}]"
# fi # TINDERBOX
######
# Above if ...
# fi could be replaced by
# DERBALLFAILS=`${TOOLDIR}/platformsFailCount ${REVISION} "${SHOWDETAILS}" ${SUITE}`
# DERBALLPRCNT=`${TOOLDIR}/platformsDurPrcnt ${REVISION} "${SHOWDETAILS}" ${SUITE}`
######
BLDERRLINK=""
if [ -e ${DERBYDIR}/testing/UpdateInfo/${REVISION}-buildDetails.txt ]
then
BLDERRLINK=" Build Errors!
"
fi
FAILURELINK=""
if [ -e ${DERBYDIR}/FailReports/${REVISION}.html ]
then
FAILURELINK=" ${DERBALLFAILS} "
elif [ -e ${DERBYDIR}/FailReports/${REVISION}M.html ]
then # When we have Mods. e.g. JDK 1.6 testing with local mods to compatibility script....
FAILURELINK=" ${DERBALLFAILS} "
fi
NOTE=""
if [ -e ${DERBYDIR}/testing/Notes/${REVISION}.txt ]
then
TXT=`cat ${DERBYDIR}/testing/Notes/${REVISION}.txt`
NOTE="${TXT}"
fi
echo "<$TDT>"${REVISION}"" >> ${DTI}
echo "<$TDT>${TS}" >> ${DTI}
echo "<$TDT>${CHGLINK}" >> ${DTI}
echo "<$TDT>${FOOTPRINT}" >> ${DTI}
echo "<$TDT>${BLDERRLINK}${FAILURELINK}" >> ${DTI}
echo "<$TDT>${DERBALLPRCNT}" >> ${DTI}
echo "<$TDT>${NOTE}" >> ${DTI}
no=`expr $no + 1`
echo "
" >> ${DTI}
done # REVISIONS
echo "
" >> ${DTI}
##########################################
# BEGIN SKIP if ...._Release or ...._RC tests or ...._Snapshot tests
IS_RELEASE=`echo ${DERBYDIR} | grep "_Release/"`
IS_SNAPSHOT=`echo ${DERBYDIR} | grep "_Snapshot/"`
IS_RC=`echo ${DERBYDIR} | grep "_RC/"`
if [ "${IS_RELEASE}" == "" ] && [ "${IS_RC}" == "" ] && [ "${IS_SNAPSHOT}" == "" ]
then
echo "See full history here!
" >> ${DTI}
if [ "${SHOWDETAILS}" = "ShowDetails" ]
then
echo "
" >> ${DTI}
echo "Experimental duration plots: " >> ${DTI}
echo "all builds, " >> ${DTI}
echo "last N builds." >> ${DTI}
fi
fi
# END SKIP if ....Release or ....Snapshot tests
##########################################
echo "
" >> ${DTI}
echo "" >> ${DTI}
echo "" >> ${DTI}
date +%Y-%m-%d" "%H:%M:%S" "%Z >> ${DTI}
echo "" >> ${DTI}
echo "
" >> ${DTI}
echo "" >> ${DTI}
echo "" >> ${DTI}
if [ "${SHOWDETAILS}" != "ShowDetails" ]
then
SRC="${DTI}"
DST="${DTIPUB}"
echo "**** OBS! ${SCPUT} ${SRC} ${PUBLISHUSER}@${PUBLISHSITE}:${DST}"
### ${SCPUT} ${SRC} ${PUBLISHUSER}@${PUBLISHSITE}:${DST}
fi