Clean up obsolete handling for optional programs
[survex.git] / tests / aven.tst
blob2e23ac9b3e3585fa03fdba1a4fce293b5bbede97
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 echo "SURVEXLANG=nosuch aven --help"
38 if test -n "$VERBOSE"; then
39   DISPLAY= SURVEXLANG=nosuch $AVEN --help
40   exitcode=$?
41 else
42   DISPLAY= SURVEXLANG=nosuch $AVEN --help > /dev/null 2>&1
43   exitcode=$?
45 if [ -n "$VALGRIND" ] ; then
46   if [ $exitcode = "$vg_error" ] ; then
47     cat "$vg_log"
48     rm "$vg_log"
49     exit 1
50   fi
51   rm "$vg_log"
53 [ "$exitcode" = 1 ] || exit 1
55 # Regression test - aven in 1.2.6 segfaulted.
56 echo "SURVEXLANG= LANG=nosuch aven --help"
57 if test -n "$VERBOSE"; then
58   DISPLAY= SURVEXLANG= LANG=nosuch $AVEN --help
59   exitcode=$?
60 else
61   DISPLAY= SURVEXLANG= LANG=nosuch $AVEN --help > /dev/null 2>&1
62   exitcode=$?
64 if [ -n "$VALGRIND" ] ; then
65   if [ $exitcode = "$vg_error" ] ; then
66     cat "$vg_log"
67     rm "$vg_log"
68     exit 1
69   fi
70   rm "$vg_log"
72 [ "$exitcode" = 0 ] || exit 1
74 test -n "$VERBOSE" && echo "Test passed"
75 exit 0