Update for 1.2.31
[survex.git] / tests / aven.tst
blob54511002151da824d7660515ea5b3d7b1ea3356a
1 #!/bin/sh
3 # Survex test suite - aven tests
4 # Copyright (C) 1999-2003,2005,2011,2012 Olly Betts
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
20 testdir=`echo $0 | sed 's!/[^/]*$!!' || echo '.'`
22 # allow us to run tests standalone more easily
23 : ${srcdir="$testdir"}
25 test -x "$testdir"/../src/cavern || testdir=.
27 : ${AVEN="$testdir"/../src/aven}
29 vg_error=123
30 vg_log=vg.log
31 if [ -n "$VALGRIND" ] ; then
32   rm -f "$vg_log"
33   AVEN="$VALGRIND --log-file=$vg_log --error-exitcode=$vg_error $AVEN"
36 # Regression test - aven in 1.2.6 segfaulted.
37 if test -n "$VERBOSE"; then
38   DISPLAY= SURVEXLANG=nosuch $AVEN
39   exitcode=$?
40 else
41   DISPLAY= SURVEXLANG=nosuch $AVEN > /dev/null 2>&1
42   exitcode=$?
44 if [ -n "$VALGRIND" ] ; then
45   if [ $exitcode = "$vg_error" ] ; then
46     cat "$vg_log"
47     rm "$vg_log"
48     exit 1
49   fi
50   rm "$vg_log"
52 [ "$exitcode" = 1 ] || exit 1
54 # Regression test - aven in 1.2.6 segfaulted.
55 if test -n "$VERBOSE"; then
56   DISPLAY= SURVEXLANG= LANG=nosuch $AVEN
57   exitcode=$?
58 else
59   DISPLAY= SURVEXLANG= LANG=nosuch $AVEN > /dev/null 2>&1
60   exitcode=$?
62 if [ -n "$VALGRIND" ] ; then
63   if [ $exitcode = "$vg_error" ] ; then
64     cat "$vg_log"
65     rm "$vg_log"
66     exit 1
67   fi
68   rm "$vg_log"
70 [ "$exitcode" = 255 ] || exit 1
72 test -n "$VERBOSE" && echo "Test passed"
73 exit 0