2014-06-29 14:51:09 +00:00
|
|
|
#!/usr/bin/env bash
|
2013-11-18 23:02:12 +00:00
|
|
|
if [ $# -ne 3 -a $# -ne 2 ]; then
|
2014-06-29 14:51:09 +00:00
|
|
|
echo "Usage: test_single.sh [lean-executable-path] [file] [yes/no]?"
|
2013-11-18 23:02:12 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2013-12-07 22:59:21 +00:00
|
|
|
ulimit -s 8192
|
2013-11-18 23:02:12 +00:00
|
|
|
LEAN=$1
|
2014-08-24 01:08:09 +00:00
|
|
|
export LEAN_PATH=../../library:.
|
2015-03-17 00:10:30 +00:00
|
|
|
export HLEAN_PATH=../../hott:.
|
2013-11-18 23:02:12 +00:00
|
|
|
if [ $# -ne 3 ]; then
|
|
|
|
INTERACTIVE=no
|
|
|
|
else
|
|
|
|
INTERACTIVE=$3
|
|
|
|
fi
|
|
|
|
f=$2
|
2015-03-17 00:10:30 +00:00
|
|
|
|
|
|
|
if [ ${f: -6} == ".hlean" ]; then
|
|
|
|
CONFIG="config.hlean"
|
|
|
|
else
|
|
|
|
CONFIG="config.lean"
|
|
|
|
fi
|
|
|
|
|
2013-11-18 23:02:12 +00:00
|
|
|
echo "-- testing $f"
|
2015-03-17 00:10:30 +00:00
|
|
|
$LEAN $CONFIG $f &> $f.produced.out.1
|
2015-02-02 05:25:52 +00:00
|
|
|
sed "/warning: imported file uses 'sorry'/d" $f.produced.out.1 > $f.produced.out
|
|
|
|
rm -f $f.produced.out.1
|
2013-11-18 23:02:12 +00:00
|
|
|
if test -f $f.expected.out; then
|
2014-09-20 22:41:12 +00:00
|
|
|
if diff --ignore-all-space -I "executing external script" $f.produced.out $f.expected.out; then
|
2013-11-18 23:02:12 +00:00
|
|
|
echo "-- checked"
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo "ERROR: file $f.produced.out does not match $f.expected.out"
|
|
|
|
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-11-18 23:02:12 +00:00
|
|
|
echo "-- mismath was fixed"
|
|
|
|
fi
|
2013-11-18 23:39:55 +00:00
|
|
|
else
|
2014-09-20 22:41:12 +00:00
|
|
|
diff --ignore-all-space -I "executing external script" $f.produced.out $f.expected.out
|
2013-11-18 23:02:12 +00:00
|
|
|
fi
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "ERROR: file $f.expected.out does not exist"
|
|
|
|
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
|
|
|
|
exit 1
|
|
|
|
fi
|