| 1 | #!/bin/sh |
|---|
| 2 | # |
|---|
| 3 | # Survex test suite - compare 2 versions of cavern on a dataset |
|---|
| 4 | # Copyright (C) 1999-2003 Olly Betts |
|---|
| 5 | # |
|---|
| 6 | # This program is free software; you can redistribute it and/or modify |
|---|
| 7 | # it under the terms of the GNU General Public License as published by |
|---|
| 8 | # the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | # (at your option) any later version. |
|---|
| 10 | # |
|---|
| 11 | # This program is distributed in the hope that it will be useful, |
|---|
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | # GNU General Public License for more details. |
|---|
| 15 | # |
|---|
| 16 | # You should have received a copy of the GNU General Public License |
|---|
| 17 | # along with this program; if not, write to the Free Software |
|---|
| 18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | |
|---|
| 20 | testdir=`echo $0 | sed 's!/[^/]*$!!' || echo '.'` |
|---|
| 21 | |
|---|
| 22 | # allow us to run tests standalone more easily |
|---|
| 23 | : ${srcdir="$testdir"} |
|---|
| 24 | |
|---|
| 25 | # force VERBOSE if we're run on a subset of tests |
|---|
| 26 | #test -n "$*" && VERBOSE=1 |
|---|
| 27 | |
|---|
| 28 | test -x "$testdir"/../src/cavern || testdir=. |
|---|
| 29 | |
|---|
| 30 | : ${CAVERN="$testdir"/../src/cavern} |
|---|
| 31 | : ${CAVERN_ORIG=cavern} |
|---|
| 32 | : ${DIFFPOS="$testdir"/../src/diffpos} |
|---|
| 33 | |
|---|
| 34 | : ${TESTS=${*-""}} |
|---|
| 35 | |
|---|
| 36 | for file in $TESTS ; do |
|---|
| 37 | if test -n "$file" ; then |
|---|
| 38 | echo "$file" |
|---|
| 39 | rm -f tmp.* tmp_orig.* |
|---|
| 40 | if test -n "$VERBOSE" ; then |
|---|
| 41 | $CAVERN_ORIG "$file" --output=tmp_orig | tee tmp_orig.out || exit 1 |
|---|
| 42 | $CAVERN "$file" --output=tmp | tee tmp.out || exit 1 |
|---|
| 43 | else |
|---|
| 44 | $CAVERN_ORIG "$file" --output=tmp_orig > tmp_orig.out || exit 1 |
|---|
| 45 | $CAVERN "$file" --output=tmp > tmp.out || exit 1 |
|---|
| 46 | fi |
|---|
| 47 | warn_orig=`sed '$!d;$s/^Done.*/0/;s/[^0-9]*\([0-9]*\).*/\1/' tmp_orig.out` |
|---|
| 48 | warn=`sed '$!d;$s/^Done.*/0/;s/[^0-9]*\([0-9]*\).*/\1/' tmp.out` |
|---|
| 49 | if test x"$warn_orig" != x"$warn" ; then |
|---|
| 50 | echo "$CAVERN_ORIG gave $warn_orig warning(s)" |
|---|
| 51 | echo "$CAVERN gave $warn warning(s)" |
|---|
| 52 | exit 1 |
|---|
| 53 | fi |
|---|
| 54 | if test -n "$VERBOSE" ; then |
|---|
| 55 | $DIFFPOS tmp.3d tmp_orig.3d || exit 1 |
|---|
| 56 | else |
|---|
| 57 | $DIFFPOS tmp.3d tmp_orig.3d > /dev/null || exit 1 |
|---|
| 58 | fi |
|---|
| 59 | fi |
|---|
| 60 | done |
|---|
| 61 | test -n "$VERBOSE" && echo "Test passed" |
|---|
| 62 | exit 0 |
|---|