]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/scripts/do_tests.sh
first snapshot of the night-profiling
[helm.git] / helm / matita / scripts / do_tests.sh
diff --git a/helm/matita/scripts/do_tests.sh b/helm/matita/scripts/do_tests.sh
new file mode 100755 (executable)
index 0000000..b95ca57
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+OK="\e[32mOK\e[0m"
+FAIL="\e[31mFAIL\e[0m"
+
+if [ "$1" = "-no-color" ]; then
+  shift
+  OK="OK"
+  FAIL="FAIL"
+fi
+
+COMPILER=$1
+shift
+LOGFILE=$1
+shift
+TODO="$@"
+
+if [ -z "$COMPILER" -o -z "$LOGFILE" -o -z "$TODO" ]; then
+  echo
+  echo "usage: "
+  echo "  do_tests.sh [-no-color] ./compiler logfile tests.ma ..."
+  echo
+  echo "The value of the DO_TESTS_EXTRA evironment variable"
+  echo "will be appended to each line."
+  exit 1
+fi
+
+TMP=.__temp.txt
+
+for T in $TODO; do
+  echo -en "$COMPILER\t$T\t"
+  /usr/bin/time -o $TMP -f "%E\t%U\t%S" $COMPILER $T >> $LOGFILE 2>&1
+  if [ $? = 0 ]; then
+    echo -e "$OK\t`cat $TMP`\t$DO_TESTS_EXTRA"
+  else
+    echo -e "$FAIL\t`cat $TMP`\t$DO_TESTS_EXTRA"
+  fi
+done
+
+rm $TMP