1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
#!/bin/bash
#
# Regina - A Normal Surface Theory Calculator
# Python Test Suite Runner
#
# Copyright (c) 2007-2009, Ben Burton
# For further details contact Ben Burton (bab@debian.org).
#
# Usage: testall
#
# Runs the entire Python test suite. This script searches for files
# named *.test in or beneath the current directory, runs them through
# regina-python, and compares the results byte-by-byte with the
# corresponding *.out files. Any mismatches are considered to be test
# failures.
#
# This script MUST be run from the python/testsuite directory in the
# build tree. It runs regina-python directly out of the build tree.
# It does not require regina to be installed on the system (and indeed
# it ignores any installation that it might find).
#
# Because tests might need to access other files within the source tree
# (which might not be the same as the build tree), the corresponding
# python/testsuite directory within the source tree will be passed as an
# argument to each test script.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA.
set -e
executable=../regina-python
testdir="@top_srcdir@/python/testsuite"
tmpout=test.tmp
echo "---------------------------------------"
echo "Test suite for Regina's python bindings"
echo "---------------------------------------"
echo
if ! test -d ../../admin -a -f Makefile -a -f "$executable"; then
echo "ERROR: You do not appear to be within the python/testsuite directory"
echo " in the build tree. This script must be run from directly"
echo " within the build tree (where you ran the configure script)."
echo " Please change into the python/testsuite directory in the"
echo " build tree and try again."
exit 1
fi
# Clobber environment variables that the user might already have set.
export REGINA_VERBOSITY=
export REGINA_PYLIBDIR=
export REGINA_HOME=
broken=
found=
for i in `find "$testdir" -name "*.test"`; do
found=1
testname=`basename "$i"`
echo -n "Running $testname ... "
output="${i/.test/.out}"
if ! ( "$executable" -n "$i" "$testdir" > "$tmpout" 2>&1 ); then
echo "COULD NOT RUN"
broken=1
else
if ! ( diff "$tmpout" "$output" > /dev/null ); then
echo "TEST FAILED"
broken=1
else
echo "ok"
fi
fi
rm -f "$tmpout"
done
if ! test -n "$found"; then
echo "ERROR: No tests were found!"
echo
echo " Please check your installation, and please ensure that"
echo " you are running this script from within the python/testsuite"
echo " directory of the build tree."
echo
echo " Note that the build tree might not be the same as the source"
echo " tree. The build tree is where you ran the configure script."
exit 1
fi
if test -n "$broken"; then
echo
echo "One or more tests failed."
echo "Please see the list above for details."
exit 1
fi
echo
echo "All tests passed!"
exit 0
|