X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=blobdiff_plain;f=matita%2Fscripts%2Fcrontab.sh;fp=matita%2Fscripts%2Fcrontab.sh;h=06cb81654aaa69600992ee60a636ee291be370be;hp=0000000000000000000000000000000000000000;hb=f61af501fb4608cc4fb062a0864c774e677f0d76;hpb=58ae1809c352e71e7b5530dc41e2bfc834e1aef1 diff --git a/matita/scripts/crontab.sh b/matita/scripts/crontab.sh new file mode 100644 index 000000000..06cb81654 --- /dev/null +++ b/matita/scripts/crontab.sh @@ -0,0 +1,117 @@ +#!/bin/bash +#set -x + +#configuration +TODAY=`date +%Y%m%d` +YESTERDAY=`date -d yesterday +%Y%m%d` +TMPDIRNAME=$HOME/__${TODAY}_crontab +TMPDIRNAMEOLD=$HOME/__${YESTERDAY}_crontab +SVNROOT="svn+ssh://mowgli.cs.unibo.it/local/svn/helm/trunk/" +SHELLTIME2CENTSPHP=scripts/shell_time2cents.php +SHELLADDERPHP=scripts/shell_adder.php +COMMONPHP=scripts/public_html/common.php +MYSQL="mysql -u helm -h mowgli.cs.unibo.it matita" +SQLQMARK="select distinct mark from bench where mark like '%s%%' order by mark;" +SQLQTIME="select SUM(timeuser) from bench where mark = '%s' group by mark;" +SQLQFAILCOUNT="select count(distinct test) from bench where mark = '%s' and result = 'fail';" +SQLQFAIL="select distinct test from bench where mark = '%s' and result = 'fail';" +URL="http://mowgli.cs.unibo.it/~sacerdot/bench.php" + +#initialization +OLD=$PWD +mkdir -p $TMPDIRNAME +rm -rf $TMPDIRNAMEOLD +cd $TMPDIRNAME +rm -rf helm +svn co ${SVNROOT}helm/software/matita/scripts/ > LOG.svn 2>&1 + +#run tests +scripts/profile_svn.sh 2> LOG + +MARK=`printf "$SQLQMARK" "$TODAY" | $MYSQL | tail -n 1` +LASTMARK=`printf "$SQLQMARK" "$YESTERDAY" | $MYSQL | tail -n 1` + +if [ -z "$MARK" ]; then + echo "No benchmark records for $TODAY" + exit 1 +fi + +if [ -z "$LASTMARK" ]; then + echo "No benchmark records for $YESTERDAY" + exit 1 +fi + +#check for slowdown +CUR_TIME=`printf "$SQLQTIME" "$MARK" | $MYSQL | tail -n 1` +OLD_TIME=`printf "$SQLQTIME" "$LASTMARK" | $MYSQL | tail -n 1` + +if [ -z "$CUR_TIME" -o -z "$OLD_TIME" ]; then + cat < $TMP1 + printf "$SQLQFAIL" "$LASTMARK" | $MYSQL > $TMP2 + combine $TMP1 not $TMP2 > $TMP3 + + cat <