2014-06-29 14:51:09 +00:00
|
|
|
#!/usr/bin/env bash
|
2013-09-01 01:31:39 +00:00
|
|
|
if [ $# -ne 2 -a $# -ne 1 ]; then
|
|
|
|
echo "Usage: test.sh [lean-executable-path] [yes/no]?"
|
|
|
|
exit 1
|
|
|
|
fi
|
2013-12-07 22:59:21 +00:00
|
|
|
ulimit -s 8192
|
2013-09-01 01:31:39 +00:00
|
|
|
LEAN=$1
|
|
|
|
if [ $# -ne 2 ]; then
|
|
|
|
INTERACTIVE=no
|
|
|
|
else
|
|
|
|
INTERACTIVE=$2
|
|
|
|
fi
|
|
|
|
NUM_ERRORS=0
|
|
|
|
for f in `ls *.lean`; do
|
2013-09-01 01:46:18 +00:00
|
|
|
echo "-- testing $f"
|
2014-01-09 23:31:58 +00:00
|
|
|
$LEAN -t config.lean $f &> $f.produced.out
|
2013-09-01 01:31:39 +00:00
|
|
|
if test -f $f.expected.out; then
|
2013-12-27 02:41:01 +00:00
|
|
|
if diff -I "executing external script" $f.produced.out $f.expected.out; then
|
2013-09-01 01:46:18 +00:00
|
|
|
echo "-- checked"
|
2013-09-01 01:31:39 +00:00
|
|
|
else
|
|
|
|
echo "ERROR: file $f.produced.out does not match $f.expected.out"
|
|
|
|
NUM_ERRORS=$(($NUM_ERRORS+1))
|
|
|
|
if [ $INTERACTIVE == "yes" ]; then
|
|
|
|
meld $f.produced.out $f.expected.out
|
2013-12-27 02:41:01 +00:00
|
|
|
if diff -I "executing external script" $f.produced.out $f.expected.out; then
|
2013-09-01 01:31:39 +00:00
|
|
|
echo "-- mismath was fixed"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "ERROR: file $f.expected.out does not exist"
|
|
|
|
NUM_ERRORS=$(($NUM_ERRORS+1))
|
|
|
|
if [ $INTERACTIVE == "yes" ]; then
|
|
|
|
read -p "copy $f.produced.out (y/n)? "
|
|
|
|
if [ $REPLY == "y" ]; then
|
|
|
|
cp $f.produced.out $f.expected.out
|
|
|
|
echo "-- copied $f.produced.out --> $f.expected.out"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ $NUM_ERRORS -gt 0 ]; then
|
|
|
|
echo "-- Number of errors: $NUM_ERRORS"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "-- Passed"
|
|
|
|
exit 0
|
|
|
|
fi
|