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 NUM_ERRORS=0
for f in `ls *.md`; do for f in `ls *.md`; do
echo "-- testing $f" 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 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 if "$LEAN" "$f.lean" > "$f.produced.out"; then
echo "-- worked" echo "-- worked"
else else
echo "ERROR executing $f.lean, produced output is at $f.produced.out" 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 in_code_block=1
i=$((i + 1)) i=$((i + 1))
lastbegin=$linenum lastbegin=$linenum
rm -f $f.$i.lean rm -f -- "$f.$i.lean"
elif [[ $line =~ ^#\+END_SRC ]]; then elif [[ $line =~ ^#\+END_SRC ]]; then
if [[ $in_code_block -eq 1 ]]; 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" echo "code fragment #$i worked"
else else
echo "ERROR executing $f.$i.lean, for in_code_block block starting at $lastbegin, produced output:" 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 exit 1
fi fi
fi fi
in_code_block=0 in_code_block=0
elif [[ $in_code_block -eq 1 ]]; then elif [[ $in_code_block -eq 1 ]]; then
echo -E "$line" >> $f.$i.lean echo -E "$line" >> "$f.$i.lean"
fi fi
done < $f done < "$f"
rm -f $f.*.produced.out rm -f "$f.*.produced.out"
rm -f $f.*.lean rm -f "$f.*.lean"
exit 0 exit 0

View file

@ -9,8 +9,8 @@ LEAN=$1
NUM_ERRORS=0 NUM_ERRORS=0
for f in `ls *.md`; do for f in `ls *.md`; do
echo "-- testing $f" 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 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 if "$LEAN" "$f.lua" > "$f.produced.out"; then
echo "-- worked" echo "-- worked"
else else
echo "ERROR executing $f.lua, produced output is at $f.produced.out" echo "ERROR executing $f.lua, produced output is at $f.produced.out"

View file

@ -8,12 +8,12 @@ ulimit -s unlimited
LEAN=$1 LEAN=$1
f=$2 f=$2
echo "-- testing $f" 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 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 if "$LEAN" "$f.lua" > "$f.produced.out"; then
echo "-- worked" echo "-- worked"
exit 0 exit 0
else else
echo "ERROR executing $f.lua, produced output:" echo "ERROR executing $f.lua, produced output:"
cat $f.produced.out cat "$f.produced.out"
exit 1 exit 1
fi fi

View file

@ -7,10 +7,10 @@ GENHTML=~/bin/genhtml
rm -rf build rm -rf build
mkdir -p build/testcov mkdir -p build/testcov
cd 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 make
ctest ctest
$LCOV -c -b ../../src -d . -o cov.info --no-external --gcov-tool $GCOV_TOOL "$LCOV" -c -b ../../src -d . -o cov.info --no-external --gcov-tool "$GCOV_TOOL"
$LCOV --remove cov.info "tests/*" -o cov.info "$LCOV" --remove cov.info "tests/*" -o cov.info
$GENHTML cov.info --output-directory lcov "$GENHTML" cov.info --output-directory lcov
cd ../../ cd ../../

View file

@ -77,7 +77,7 @@ FOREACH(T ${LEANT0TESTS})
GET_FILENAME_COMPONENT(T_NAME ${T} NAME) GET_FILENAME_COMPONENT(T_NAME ${T} NAME)
add_test(NAME "leant0test_${T_NAME}" add_test(NAME "leant0test_${T_NAME}"
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lean/trust0" 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) ENDFOREACH(T)
# LEAN RUN HoTT TESTS # LEAN RUN HoTT TESTS

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -13,20 +13,20 @@ else
fi fi
f=$2 f=$2
echo "-- testing $f" echo "-- testing $f"
$LEAN -D pp.unicode=true --server < $f > $f.produced.out "$LEAN" -D pp.unicode=true --server < "$f" > "$f.produced.out"
if test -f $f.expected.out; then if test -f "$f.expected.out"; then
if diff --ignore-all-space $f.produced.out $f.expected.out; then if diff --ignore-all-space "$f.produced.out" "$f.expected.out"; then
echo "-- checked" echo "-- checked"
exit 0 exit 0
else else
echo "ERROR: file $f.produced.out does not match $f.expected.out" echo "ERROR: file $f.produced.out does not match $f.expected.out"
if [ $INTERACTIVE == "yes" ]; then if [ $INTERACTIVE == "yes" ]; then
meld $f.produced.out $f.expected.out meld "$f.produced.out" "$f.expected.out"
if diff --ignore-all-space $f.produced.out $f.expected.out; then if diff --ignore-all-space "$f.produced.out" "$f.expected.out"; then
echo "-- mismath was fixed" echo "-- mismath was fixed"
fi fi
else else
diff --ignore-all-space $f.produced.out $f.expected.out diff --ignore-all-space "$f.produced.out" "$f.expected.out"
fi fi
exit 1 exit 1
fi fi
@ -35,7 +35,7 @@ else
if [ $INTERACTIVE == "yes" ]; then if [ $INTERACTIVE == "yes" ]; then
read -p "copy $f.produced.out (y/n)? " read -p "copy $f.produced.out (y/n)? "
if [ $REPLY == "y" ]; then 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" echo "-- copied $f.produced.out --> $f.expected.out"
fi fi
fi fi

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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