|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +# Core files off, because they are huge on a Mac |
| 4 | +ulimit -c 0 |
| 5 | + |
| 6 | +# NB Note that we ensure all locally-produced files |
| 7 | +# have Unix line endings only by using 'tr', in |
| 8 | +# order to compare properly to our canonical versions. |
| 9 | + |
| 10 | +passed=no |
| 11 | +if ! make $1.exe; then |
| 12 | + echo $1 >> failed.out |
| 13 | + echo "------------" >> failed.out |
| 14 | + echo Cannot compile $1 >> failed.out |
| 15 | + echo "------------" >> failed.out |
| 16 | +else |
| 17 | + ./$1.exe 2>&1 | tr -d '\15' | grep -v 'STOP' > test.out |
| 18 | + if test -f $1.xml |
| 19 | + then |
| 20 | + tr -d '\15' < test.xml | grep -v UUID > test.xml.tmp; mv test.xml.tmp test.xml |
| 21 | + if test -f test.xml |
| 22 | + then |
| 23 | + if diff test.xml $1.xml > /dev/null; then |
| 24 | + passed=yes |
| 25 | + else |
| 26 | + echo $1 >> failed.out |
| 27 | + echo "------------" >> failed.out |
| 28 | + diff -u test.xml $1.xml >> failed.out |
| 29 | + echo "------------" >> failed.out |
| 30 | + fi |
| 31 | + else |
| 32 | + echo $1 >> failed.out |
| 33 | + echo " -----------" |
| 34 | + echo "test.xml not produced" |
| 35 | + echo " -----------" |
| 36 | + fi |
| 37 | + elif test -f $1.out |
| 38 | + then |
| 39 | + # Note that for most of the test.sh files we only check |
| 40 | + # that the DIFFerences are in one direction. Here, we need |
| 41 | + # to check both directions as the "test_input" file reports |
| 42 | + # errors in a non-standard way (by adding lines). |
| 43 | + # FIXME: Better to correct test_input? |
| 44 | + if diff -B -b test.out $1.out | grep "^[><]" > /dev/null; then |
| 45 | + echo $1 >> failed.out |
| 46 | + echo "------------" >> failed.out |
| 47 | + diff -u test.out $1.out >> failed.out |
| 48 | + echo "------------" >> failed.out |
| 49 | + else |
| 50 | + passed=yes |
| 51 | + fi |
| 52 | + else |
| 53 | + echo $1 >> failed.out |
| 54 | + echo "------------" >> failed.out |
| 55 | + echo No test output found for $1 |
| 56 | + echo "------------" >> failed.out |
| 57 | + fi |
| 58 | +fi |
| 59 | + |
| 60 | +if [ $passed = yes ]; then |
| 61 | + echo 'PASSED: ' $1 |
| 62 | + echo 'PASSED: ' $1 >> tests.out |
| 63 | + echo '1' >> passed.score |
| 64 | +else |
| 65 | + echo 'FAILED: ' $1 |
| 66 | + echo 'FAILED: ' $1 >> tests.out |
| 67 | + echo '1' >> failed.score |
| 68 | +fi |
0 commit comments