2014-06-29 14:51:09 +00:00
|
|
|
#!/usr/bin/env bash
|
2013-12-06 00:56:20 +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-12-06 00:56:20 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
ulimit -s unlimited
|
|
|
|
LEAN=$1
|
2014-08-24 01:08:09 +00:00
|
|
|
export LEAN_PATH=../../../library:.
|
2013-12-06 00:56:20 +00:00
|
|
|
if [ $# -ne 3 ]; then
|
|
|
|
INTERACTIVE=no
|
|
|
|
else
|
|
|
|
INTERACTIVE=$3
|
|
|
|
fi
|
|
|
|
f=$2
|
|
|
|
echo "-- testing $f"
|
2015-03-29 03:29:52 +00:00
|
|
|
"$LEAN" -D pp.unicode=true --server < "$f" > "$f.produced.out"
|
|
|
|
if test -f "$f.expected.out"; then
|
|
|
|
if diff --ignore-all-space "$f.produced.out" "$f.expected.out"; then
|
2013-12-06 00:56:20 +00:00
|
|
|
echo "-- checked"
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo "ERROR: file $f.produced.out does not match $f.expected.out"
|
|
|
|
if [ $INTERACTIVE == "yes" ]; then
|
2015-03-29 03:29:52 +00:00
|
|
|
meld "$f.produced.out" "$f.expected.out"
|
|
|
|
if diff --ignore-all-space "$f.produced.out" "$f.expected.out"; then
|
2013-12-06 00:56:20 +00:00
|
|
|
echo "-- mismath was fixed"
|
|
|
|
fi
|
|
|
|
else
|
2015-03-29 03:29:52 +00:00
|
|
|
diff --ignore-all-space "$f.produced.out" "$f.expected.out"
|
2013-12-06 00:56:20 +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
|
2015-03-29 03:29:52 +00:00
|
|
|
cp -- "$f.produced.out" "$f.expected.out"
|
2013-12-06 00:56:20 +00:00
|
|
|
echo "-- copied $f.produced.out --> $f.expected.out"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
exit 1
|
|
|
|
fi
|