]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/scripts/crontab.sh
more detailed but less verbose and annoying report
[helm.git] / helm / matita / scripts / crontab.sh
1 MARK=`date +%Y%m%d`
2 LASTMARK=`date -d yesterday +%Y%m%d`
3 TMPDIRNAME=.__${MARK}_crontab
4 CVSROOT=":ext:$USER@marcello.cs.unibo.it:/home/faculty/PROJECTS/cvs/helm"
5
6 OLD=$PWD
7 rm -rf $TMPDIRNAME 
8 mkdir $TMPDIRNAME
9 cd $TMPDIRNAME
10 #cvs -d $CVSROOT co helm/matita/scripts 1>/dev/null 2>/dev/null
11 #helm/matita/scripts/profile_cvs.sh 2> LOG
12
13 CUR_TIME=`echo "select mark, SUM(TIME_TO_SEC(time)) from bench where mark = \"$MARK\" group by mark;" | mysql -u helm -h mowgli.cs.unibo.it matita | tail -n 1 | cut -f 2`
14 OLD_TIME=`echo "select mark, SUM(TIME_TO_SEC(time)) from bench where mark = \"$LASTMARK\" group by mark;" | mysql -u helm -h mowgli.cs.unibo.it matita | tail -n 1 | cut -f 2`
15 ((DELTA=$CUR_TIME - $OLD_TIME))
16 if [ $DELTA -lt 0 ]; then
17   ((DELTA=$DELTA * -1))
18 fi
19 ((PERC=100 * $DELTA))
20 ((PERC=$PERC / $OLD_TIME))
21
22 if [ $PERC -ge 5 ]; then
23   cat <<EOT
24   REPORT FOR `date`
25   http://mowgli.cs.unibo.it/tassi/bench.php
26
27   PREFORMANCE LOSS DETECTED
28   is $CUR_TIME sec 
29   was $OLD_TIME sec
30
31 EOT
32 fi
33
34 CUR_FAIL=`echo "select count(distinct test) from bench where mark = \"$MARK\" and result = 'fail';" | mysql -u helm -h mowgli.cs.unibo.it matita | tail -n 1`
35 OLD_FAIL=`echo "select count(distinct test) from bench where mark = \"$LASTMARK\" and result = 'fail';" | mysql -u helm -h mowgli.cs.unibo.it matita | tail -n 1`
36
37 if [ $CUR_FAIL -gt $OLD_FAIL ]; then
38   cat <<EOT
39   REPORT FOR `date`
40   http://mowgli.cs.unibo.it/tassi/bench.php
41
42   MORE BROKEN TESTS DETECTED
43   now broken:
44   `echo "select distinct test from bench where mark = \"$MARK\" and result = 'fail';" | mysql -u helm -h mowgli.cs.unibo.it matita`
45   were broken:
46   `echo "select distinct test from bench where mark = \"$OLDMARK\" and result = 'fail';" | mysql -u helm -h mowgli.cs.unibo.it matita`
47   
48 EOT
49
50 fi
51
52 cd $OLD
53 rm -rf $TMPDIRNAME
54