COMPILER=$1
shift
+CLEANER=$1
+shift
LOGFILE=$1
shift
TODO="$@"
-if [ -z "$COMPILER" -o -z "$LOGFILE" -o -z "$TODO" ]; then
+if [ -z "$COMPILER" -o -z "$CLEANER" -o -z "$LOGFILE" -o -z "$TODO" ]; then
echo
echo "usage: "
- echo " do_tests.sh [-no-color] [-twice] ./compiler logfile tests.ma ..."
+ echo " do_tests.sh [-no-color] [-twice] ./compiler ./cleaner logfile tests.ma ..."
echo
echo "options: "
echo " -no-color Do not use vt100 colors"
TMP=.__temp.txt
for T in $TODO; do
- echo -en "$COMPILER\t$T\t"
+ printf "$COMPILER\t%-30s " $T
if [ "$TWICE" = "1" ]; then
+ $CLEANER $T 1>/dev/null 2>/dev/null
$COMPILER $T 1>/dev/null 2>/dev/null
fi
- /usr/bin/time --quiet -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"
+ $CLEANER $T 1>/dev/null 2>/dev/null
+ /usr/bin/time --quiet -o $TMP -f "%E %U %S" $COMPILER $T >> $LOGFILE 2>&1
+ RC=$?;
+ if [ $RC = 0 ]; then
+ printf "$OK\t`cat $TMP`\t$DO_TESTS_EXTRA\n"
+ rm $TMP
else
- echo -e "$FAIL\t`cat $TMP`\t$DO_TESTS_EXTRA"
+ printf "$FAIL\t`cat $TMP`\t$DO_TESTS_EXTRA\n";
+ rm $TMP
+ exit $RC
fi
done
-
-rm $TMP