]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/scripts/do_tests.sh
first snapshot of the night-profiling
[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
12 COMPILER=$1
13 shift
14 LOGFILE=$1
15 shift
16 TODO="$@"
17
18 if [ -z "$COMPILER" -o -z "$LOGFILE" -o -z "$TODO" ]; then
19   echo
20   echo "usage: "
21   echo "  do_tests.sh [-no-color] ./compiler logfile tests.ma ..."
22   echo
23   echo "The value of the DO_TESTS_EXTRA evironment variable"
24   echo "will be appended to each line."
25   exit 1
26 fi
27
28 TMP=.__temp.txt
29
30 for T in $TODO; do
31   echo -en "$COMPILER\t$T\t"
32   /usr/bin/time -o $TMP -f "%E\t%U\t%S" $COMPILER $T >> $LOGFILE 2>&1
33   if [ $? = 0 ]; then
34     echo -e "$OK\t`cat $TMP`\t$DO_TESTS_EXTRA"
35   else
36     echo -e "$FAIL\t`cat $TMP`\t$DO_TESTS_EXTRA"
37   fi
38 done
39
40 rm $TMP