]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/scripts/do_tests.sh
now maketests uses matitaclean (but not in the right way)
[helm.git] / helm / matita / scripts / do_tests.sh
1 #!/bin/bash
2
3 OK="\e[32mOK\e[0m"
4 FAIL="\e[31mFAIL\e[0m"
5
6 if [ "$1" = "-no-color" ]; then
7   shift
8   OK="OK"
9   FAIL="FAIL"
10 fi
11 if [ "$1" = "-twice" ]; then
12   shift
13   TWICE=1
14 fi
15
16 COMPILER=$1
17 shift
18 LOGFILE=$1
19 shift
20 TODO="$@"
21
22 if [ -z "$COMPILER" -o -z "$LOGFILE" -o -z "$TODO" ]; then
23   echo
24   echo "usage: "
25   echo "  do_tests.sh [-no-color] [-twice] ./compiler logfile tests.ma ..."
26   echo
27   echo "options:  "
28   echo "  -no-color Do not use vt100 colors"
29   echo "  -twice    Run each test twice but show only the second run times"
30   echo
31   echo "The value of the DO_TESTS_EXTRA evironment variable"
32   echo "will be appended to each line."
33   exit 1
34 fi
35
36 TMP=.__temp.txt
37
38 for T in $TODO; do
39   printf "$COMPILER\t%-30s   " $T
40   if [ "$TWICE" = "1" ]; then
41     $COMPILER $T 1>/dev/null 2>/dev/null
42   fi
43   ./matitaclean $T 1>/dev/null 2>/dev/null
44   /usr/bin/time --quiet -o $TMP -f "%E  %U  %S" $COMPILER $T >> $LOGFILE 2>&1
45   if [ $? = 0 ]; then
46     printf "$OK\t`cat $TMP`\t$DO_TESTS_EXTRA\n"
47   else
48     printf "$FAIL\t`cat $TMP`\t$DO_TESTS_EXTRA\n"
49   fi
50 done
51
52 rm $TMP