test results db:

* fixed importing submitter and machine
* fixed link to test suite results in test suite diff mail
+ added update test suite db script

git-svn-id: trunk@16155 -
This commit is contained in:
vincents 2008-08-20 07:54:44 +00:00
parent d90075d403
commit fd819a0048
5 changed files with 114 additions and 2 deletions

1
.gitattributes vendored
View File

@ -3759,6 +3759,7 @@ test/testresult-db/testsuite.lpi svneol=native#text/plain
test/testresult-db/testsuite.pp svneol=native#text/plain
test/testresult-db/testu.pp svneol=native#text/plain
test/testresult-db/tresults.pp svneol=native#text/plain
test/testresult-db/updatetestsuitedb.sh svneol=native#text/plain
test/testresult-db/utests.pp svneol=native#text/plain
test/testunits.pas svneol=native#text/plain
tools/apiwizz/apiwizard.lfm svneol=native#text/plain

View File

@ -297,6 +297,19 @@ var
Verbose(V_Debug,format('Environment: retrieved %s=%s', [Name, Result]));
end;
function TryGetEnvValue(const Name, Default: string): string;
var
Node: TDomNode;
begin
Result:=Default;
Node := EnvNode.FindNode(Name);
if not assigned(Node) then
Verbose(V_DEBUG,'No environment element for '+Name)
else
Result := Node.TextContent;
Verbose(V_Debug,format('Environment: retrieved %s=%s', [Name, Result]));
end;
function GetDate: TDateTime;
var
Node: TDomNode;
@ -340,6 +353,9 @@ begin
TestDate := GetDate;
Submitter:=TryGetEnvValue('Submitter', Submitter);
Machine:=TryGetEnvValue('Machine', Machine);
If (Round(TestDate)=0) then
Testdate:=Now;
TestRunID:=GetRunID(TestOSID,TestCPUID,TestFPCVersionID,TestLazVersionID, TestWidgetSetID, TestDate);

View File

@ -27,4 +27,4 @@ FROM TESTRUN LEFT JOIN (TESTCPU) ON (TU_CPU_FK=TC_ID) LEFT JOIN (TESTOS) ON (TU_
WHERE (DATE_SUB(CURDATE(), INTERVAL 2 DAY)<=DATE(TU_DATE)) AND TR_OK<>"+" AND TR_SKIP<>"+"
GROUP BY TU_ID
ORDER BY LAZVERSION, FPCVERSION, OS, CPU, WIDGETSET, TESTER, MACHINE, COMMENT, DATE;' | tee mysql-output | $PROCTESTSUITEDIFF >> tests_mail
#/usr/sbin/sendmail -f ${MAILFROM} ${MAILTO} < tests_mail >/dev/null 2>&1
/usr/sbin/sendmail -f ${MAILFROM} ${MAILTO} < tests_mail >/dev/null 2>&1

View File

@ -6,7 +6,7 @@ uses
const
runhour = 8; { cut-off hour that distinguishes yesterday and today }
urlprefix = 'http://fpcfos64.freepascal.org/laztestsuite/chi-bin/testsuite.cgi?';
urlprefix = 'http://fpcfos64.freepascal.org/laztestsuite/cgi-bin/testsuite.cgi?';
function getdate(line: string): string;
begin

View File

@ -0,0 +1,95 @@
#!/bin/bash
# Don't stop on errors
#set -e
#set -x
TESTSUITEDIR=$HOME/testsuite
INCOMINGDIR=$TESTSUITEDIR/incoming
FAILEDDIR=$TESTSUITEDIR/failed
WORKDIR=$TESTSUITEDIR/work
TESTSOURCEDIR=$HOME/src/lazarus
TESTSUITEBINDIR=$TESTSUITEDIR/bin
DATENAME=`date +%Y-%m-%d-%0k-%M-%S`
LOGFILE=$HOME/logs/updatetestsuitedb.$DATENAME.log
DBCFG=$TESTSUITEBINDIR/dbdigest.cfg.dbdata
# processfile <file>
processfile() {
echo
echo "`date`: Start processing file $1"
echo
basefn=`basename $1`
rm -rf $WORKDIR
mkdir -p $WORKDIR
cd $WORKDIR
cp -pr $1 $WORKDIR
# better avoid usernames and passwords in the script (available in SVN among others)
# echo "DatabaseName=TESTSUITE" >> dbdigest.cfg
# echo "UserName=yyy" >> dbdigest.cfg
# echo "PassWord=xxx" >> dbdigest.cfg
if [ -f $DBCFG ]; then
cat $DBCFG >> dbdigest.cfg
if [ -f dbdigest.cfg ]; then
# remove unit paths from testsuite parameters
sed -e 's/-Fu[^ ]*//' < dbdigest.cfg > dbdigest.cfg.new
mv dbdigest.cfg.new dbdigest.cfg
# doesn't work if hostname contains number
# date=`echo $1 | sed 's/[^0-9]*\([0-9]*\)[^0-9]*/\1/'`
# next won't work if hostname contains 12 consecutive numbers, better (jonas)
date=`echo $1 | sed 's/.*\([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\).*/\1/'`
# echo "Date=$date" >> dbdigest.cfg
echo "TestSrcDir=$TESTSOURCEDIR" >> dbdigest.cfg
echo "logfile=$1" >> dbdigest.cfg
$TESTSUITEBINDIR/importtestresults
err=$?
else
echo "ERROR: No dbdigest.cfg found!"
err=1
fi
else
echo "ERROR: No $DBCFG found!"
err=1
fi
if [ $err -eq 0 ]; then
rm -f $1
else
echo "ERROR: dbdigest failed, moving file $basefn to $FAILEDDIR"
mv $1 $FAILEDDIR/$basefn
fi
echo "Done"
}
#
# First check if there are new files to process
#
FILES=`ls $INCOMINGDIR/results-*.xml 2> /dev/null`
if [ "$FILES" = "" ]; then
exit 0
fi
PATH=".:/bin:/usr/bin"
(
date
# Update sources
cd $TESTSOURCEDIR
svn up
for f in $FILES; do
processfile $f
done
echo "`date`: Finished."
) > $LOGFILE 2>&1 </dev/null
gzip $LOGFILE