fix(test*.sh): allow spaces in filename

fix #515
This commit is contained in:
Soonho Kong 2015-03-28 23:29:52 -04:00
parent 0d1da89cf1
commit 8243ed6339
20 changed files with 68 additions and 67 deletions

View file

@ -9,8 +9,8 @@ LEAN=$1
NUM_ERRORS=0
for f in `ls *.md`; do
echo "-- testing $f"
awk 'BEGIN{ in_block = 0 } !/```/{ if (in_block == 1) print $0; else print "" } /```/ && !/```lean/{ in_block = 0; print "" } /```lean/{ in_block = 1; print "" }' $f > $f.lean
if $LEAN $f.lean > $f.produced.out; then
awk 'BEGIN{ in_block = 0 } !/```/{ if (in_block == 1) print $0; else print "" } /```/ && !/```lean/{ in_block = 0; print "" } /```lean/{ in_block = 1; print "" }' "$f" > "$f.lean"
if "$LEAN" "$f.lean" > "$f.produced.out"; then
echo "-- worked"
else
echo "ERROR executing $f.lean, produced output is at $f.produced.out"

View file

@ -19,22 +19,22 @@ while read -r line; do
in_code_block=1
i=$((i + 1))
lastbegin=$linenum
rm -f $f.$i.lean
rm -f -- "$f.$i.lean"
elif [[ $line =~ ^#\+END_SRC ]]; then
if [[ $in_code_block -eq 1 ]]; then
if $LEAN -t 100000 $f.$i.lean > $f.$i.produced.out; then
if "$LEAN" -t 100000 "$f.$i.lean" > "$f.$i.produced.out"; then
echo "code fragment #$i worked"
else
echo "ERROR executing $f.$i.lean, for in_code_block block starting at $lastbegin, produced output:"
cat $f.$i.produced.out
cat "$f.$i.produced.out"
exit 1
fi
fi
in_code_block=0
elif [[ $in_code_block -eq 1 ]]; then
echo -E "$line" >> $f.$i.lean
echo -E "$line" >> "$f.$i.lean"
fi
done < $f
rm -f $f.*.produced.out
rm -f $f.*.lean
done < "$f"
rm -f "$f.*.produced.out"
rm -f "$f.*.lean"
exit 0

View file

@ -9,8 +9,8 @@ LEAN=$1
NUM_ERRORS=0
for f in `ls *.md`; do
echo "-- testing $f"
awk 'BEGIN{ in_block = 0 } !/```/{ if (in_block == 1) print $0; else print "" } /```/ && !/```lua/{ in_block = 0; print "" } /```lua/{ in_block = 1; print "" }' $f > $f.lua
if $LEAN $f.lua > $f.produced.out; then
awk 'BEGIN{ in_block = 0 } !/```/{ if (in_block == 1) print $0; else print "" } /```/ && !/```lua/{ in_block = 0; print "" } /```lua/{ in_block = 1; print "" }' "$f" > "$f.lua"
if "$LEAN" "$f.lua" > "$f.produced.out"; then
echo "-- worked"
else
echo "ERROR executing $f.lua, produced output is at $f.produced.out"

View file

@ -8,12 +8,12 @@ ulimit -s unlimited
LEAN=$1
f=$2
echo "-- testing $f"
awk 'BEGIN{ in_block = 0 } !/```/{ if (in_block == 1) print $0; else print "" } /```/ && !/```lua/{ in_block = 0; print "" } /```lua/{ in_block = 1; print "" }' $f > $f.lua
if $LEAN $f.lua > $f.produced.out; then
awk 'BEGIN{ in_block = 0 } !/```/{ if (in_block == 1) print $0; else print "" } /```/ && !/```lua/{ in_block = 0; print "" } /```lua/{ in_block = 1; print "" }' "$f" > "$f.lua"
if "$LEAN" "$f.lua" > "$f.produced.out"; then
echo "-- worked"
exit 0
else
echo "ERROR executing $f.lua, produced output:"
cat $f.produced.out
cat "$f.produced.out"
exit 1
fi

View file

@ -7,10 +7,10 @@ GENHTML=~/bin/genhtml
rm -rf build
mkdir -p build/testcov
cd build/testcov
cmake -DCMAKE_BUILD_TYPE=TESTCOV -DCMAKE_CXX_COMPILER=$CXX ../../src
cmake -DCMAKE_BUILD_TYPE=TESTCOV -DCMAKE_CXX_COMPILER="$CXX" ../../src
make
ctest
$LCOV -c -b ../../src -d . -o cov.info --no-external --gcov-tool $GCOV_TOOL
$LCOV --remove cov.info "tests/*" -o cov.info
$GENHTML cov.info --output-directory lcov
"$LCOV" -c -b ../../src -d . -o cov.info --no-external --gcov-tool "$GCOV_TOOL"
"$LCOV" --remove cov.info "tests/*" -o cov.info
"$GENHTML" cov.info --output-directory lcov
cd ../../

View file

@ -77,7 +77,7 @@ FOREACH(T ${LEANT0TESTS})
GET_FILENAME_COMPONENT(T_NAME ${T} NAME)
add_test(NAME "leant0test_${T_NAME}"
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lean/trust0"
COMMAND bash "./test_single.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean -t 0" ${T_NAME})
COMMAND bash "./test_single.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean" ${T_NAME} "-t 0")
ENDFOREACH(T)
# LEAN RUN HoTT TESTS

View file

@ -6,8 +6,8 @@ if [ -x "$DEST/lean.sh" ]; then
# Nothing to be done, file already exists
exit 0
else
cat > $DEST/lean.sh <<EOF
if ! $DEST/lean \$* ; then echo "FAILED: \$*"; exit 1; fi
cat > "$DEST/lean.sh" <<EOF
if ! "$DEST/lean" \$* ; then echo "FAILED: \$*"; exit 1; fi
EOF
chmod +x $DEST/lean.sh
chmod +x "$DEST/lean.sh"
fi

View file

@ -9,11 +9,11 @@ LEAN=$1
export LEAN_PATH=../../../library:.
for f in `ls ac_bug*.input`; do
echo "testing $f..."
$LEAN --server-trace $f > $f.produced.out
if grep "nat.mul.assoc" $f.produced.out; then
"$LEAN" --server-trace "$f" > "$f.produced.out"
if grep "nat.mul.assoc" "$f.produced.out"; then
echo "FAILED"
exit 1
fi
rm -f $f.produced.out
rm -f -- "$f.produced.out"
done
echo "done"

View file

@ -6,5 +6,5 @@ if [ $# -ne 1 ]; then
fi
LEAN=$1
export LEAN_PATH=../../../library:.
$LEAN -o eqn_macro1.olean eqn_macro1.lean
$LEAN eqn_macro2.lean
"$LEAN" -o eqn_macro1.olean eqn_macro1.lean
"$LEAN" eqn_macro2.lean

View file

@ -8,7 +8,7 @@ LEAN=$1
export LEAN_PATH=../../../library:.
f=$2
echo "-- testing $f"
if $LEAN $f; then
if "$LEAN" "$f"; then
echo "-- checked"
else
echo "failed $f"

View file

@ -8,7 +8,7 @@ LEAN=$1
export HLEAN_PATH=../../../hott:.
f=$2
echo "-- testing $f"
if $LEAN $f; then
if "$LEAN" "$f"; then
echo "-- checked"
else
echo "failed $f"

View file

@ -13,20 +13,20 @@ else
fi
f=$2
echo "-- testing $f"
$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
"$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
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
if diff --ignore-all-space $f.produced.out $f.expected.out; then
meld "$f.produced.out" "$f.expected.out"
if diff --ignore-all-space "$f.produced.out" "$f.expected.out"; then
echo "-- mismath was fixed"
fi
else
diff --ignore-all-space $f.produced.out $f.expected.out
diff --ignore-all-space "$f.produced.out" "$f.expected.out"
fi
exit 1
fi
@ -35,7 +35,7 @@ else
if [ $INTERACTIVE == "yes" ]; then
read -p "copy $f.produced.out (y/n)? "
if [ $REPLY == "y" ]; then
cp $f.produced.out $f.expected.out
cp -- "$f.produced.out" "$f.expected.out"
echo "-- copied $f.produced.out --> $f.expected.out"
fi
fi

View file

@ -8,7 +8,7 @@ LEAN=$1
export LEAN_PATH=../../../library:.
f=$2
echo "-- testing $f"
if $LEAN $f; then
if "$LEAN" "$f"; then
echo "-- checked"
else
echo "failed $f"

View file

@ -8,7 +8,7 @@ LEAN=$1
export LEAN_PATH=../../../library:.
f=$2
echo "-- testing $f"
if $LEAN $f; then
if "$LEAN" "$f"; then
echo "-- checked"
else
echo "failed $f"

View file

@ -15,18 +15,18 @@ fi
NUM_ERRORS=0
for f in *.lean; do
echo "-- testing $f"
$LEAN -t config.lean $f &> $f.produced.out.1
sed "/warning: imported file uses 'sorry'/d" $f.produced.out.1 > $f.produced.out
rm -f $f.produced.out.1
if test -f $f.expected.out; then
if diff -I "executing external script" $f.produced.out $f.expected.out; then
"$LEAN" -t config.lean "$f" &> "$f.produced.out.1"
sed "/warning: imported file uses 'sorry'/d" "$f.produced.out.1" > "$f.produced.out"
rm -f -- "$f.produced.out.1"
if test -f "$f.expected.out"; then
if diff -I "executing external script" "$f.produced.out" "$f.expected.out"; then
echo "-- checked"
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
if diff -I "executing external script" $f.produced.out $f.expected.out; then
meld "$f.produced.out" "$f.expected.out"
if diff -I "executing external script" "$f.produced.out" "$f.expected.out"; then
echo "-- mismath was fixed"
fi
fi
@ -37,7 +37,7 @@ for f in *.lean; do
if [ $INTERACTIVE == "yes" ]; then
read -p "copy $f.produced.out (y/n)? "
if [ $REPLY == "y" ]; then
cp $f.produced.out $f.expected.out
cp -- "$f.produced.out" "$f.expected.out"
echo "-- copied $f.produced.out --> $f.expected.out"
fi
fi

View file

@ -21,22 +21,22 @@ else
fi
echo "-- testing $f"
$LEAN $CONFIG $f &> $f.produced.out.1
sed "/warning: imported file uses 'sorry'/d" $f.produced.out.1 > $f.produced.out
rm -f $f.produced.out.1
if test -f $f.expected.out; then
if diff --ignore-all-space -I "executing external script" $f.produced.out $f.expected.out; then
"$LEAN" $CONFIG "$f" &> "$f.produced.out.1"
sed "/warning: imported file uses 'sorry'/d" "$f.produced.out.1" > "$f.produced.out"
rm -f "$f.produced.out.1"
if test -f "$f.expected.out"; then
if diff --ignore-all-space -I "executing external script" "$f.produced.out" "$f.expected.out"; then
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
if diff -I "executing external script" $f.produced.out $f.expected.out; then
meld "$f.produced.out" "$f.expected.out"
if diff -I "executing external script" "$f.produced.out" "$f.expected.out"; then
echo "-- mismath was fixed"
fi
else
diff --ignore-all-space -I "executing external script" $f.produced.out $f.expected.out
diff --ignore-all-space -I "executing external script" "$f.produced.out" "$f.expected.out"
fi
exit 1
fi
@ -45,7 +45,7 @@ else
if [ $INTERACTIVE == "yes" ]; then
read -p "copy $f.produced.out (y/n)? "
if [ $REPLY == "y" ]; then
cp $f.produced.out $f.expected.out
cp -- "$f.produced.out" "$f.expected.out"
echo "-- copied $f.produced.out --> $f.expected.out"
fi
fi

View file

@ -9,12 +9,12 @@ ulimit -s 8192
LEAN=$1
f=$2
echo "-- testing $f"
$LEAN $f showenv.l &> $f.pp.out
if grep "===BEGIN ENVIRONMENT===" $f.pp.out; then
awk 'BEGIN { SHOW = 0 } { if (SHOW == 1) print $0 } /===BEGIN ENVIRONMENT===/ { SHOW = 1 }' $f.pp.out > $f.pp
rm -f $f.pp.out
if $LEAN $f.pp; then
rm -f $f.pp
"$LEAN" "$f" showenv.l &> "$f.pp.out"
if grep "===BEGIN ENVIRONMENT===" "$f.pp.out"; then
awk 'BEGIN { SHOW = 0 } { if (SHOW == 1) print $0 } /===BEGIN ENVIRONMENT===/ { SHOW = 1 }' "$f.pp.out" > "$f.pp"
rm -f -- "$f.pp.out"
if "$LEAN" "$f.pp"; then
rm -f -- "$f.pp"
echo "-- checked"
else
echo "-- failed to parse output produced by Lean"

View file

@ -1,14 +1,15 @@
#!/usr/bin/env bash
if [ $# -ne 2 ]; then
echo "Usage: test_single.sh [lean-executable-path] [file]"
if [ $# -lt 2 ]; then
echo "Usage: test_single.sh [lean-executable-path] [file] [options]"
exit 1
fi
ulimit -s 8192
LEAN=$1
export LEAN_PATH=../../../library:.
f=$2
shift 2
echo "-- testing $f"
if $LEAN $f; then
if "$LEAN" "$f" $@; then
echo "-- checked"
else
echo "failed $f"

View file

@ -9,7 +9,7 @@ LEAN=$1
NUM_ERRORS=0
for f in *.lua; do
echo "-- testing $f"
if $LEAN extra.lua $f > $f.produced.out; then
if "$LEAN" "extra.lua" "$f" > "$f.produced.out"; then
echo "-- worked"
else
echo "ERROR executing $f, produced output is at $f.produced.out"

View file

@ -7,11 +7,11 @@ ulimit -s unlimited
LEAN=$1
f=$2
echo "-- testing $f"
if $LEAN extra.lua $f > $f.produced.out; then
if "$LEAN" extra.lua "$f" > "$f.produced.out"; then
echo "-- worked"
exit 0
else
echo "ERROR executing $f, produced output:"
cat $f.produced.out
cat "$f.produced.out"
exit 1
fi