Sort out sphinx rules
[survex.git] / tests / aven.tst
blob3f826f7be0cd1fb640895358bc47bba5e45deb7f
1 #!/bin/sh
3 # Survex test suite - aven tests
4 # Copyright (C) 1999-2024 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"}
24 if [ -z "$SURVEXLIB" ] ; then
25   SURVEXLIB=`cd "$srcdir/../lib" && pwd`
26   export SURVEXLIB
29 test -x "$testdir"/../src/cavern || testdir=.
31 : ${AVEN="$testdir"/../src/aven}
33 # Suppress checking for leaks on exit if we're build with lsan - we don't
34 # generally waste effort to free all allocations as the OS will reclaim
35 # memory on exit.
36 LSAN_OPTIONS=leak_check_at_exit=0
37 export LSAN_OPTIONS
39 vg_error=123
40 vg_log=vg.log
41 if [ -n "$VALGRIND" ] ; then
42   rm -f "$vg_log"
43   AVEN="$VALGRIND --log-file=$vg_log --error-exitcode=$vg_error $AVEN"
46 # This next testcase seems to hang on macos and mingw in CI so skip it.
47 # FIXME: Ideally this should work, and it doesn't seem very different to the
48 # next testcase which works.
49 case `uname -s` in
50   Darwin) ;;
51   MINGW*) ;;
52   *)
53     # Regression test - aven in 1.2.6 segfaulted.
54     echo "SURVEXLANG=nosuch aven --help"
55     if test -n "$VERBOSE"; then
56       DISPLAY= SURVEXLANG=nosuch $AVEN --help
57       exitcode=$?
58     else
59       DISPLAY= SURVEXLANG=nosuch $AVEN --help > /dev/null 2>&1
60       exitcode=$?
61     fi
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"
69     fi
70     [ "$exitcode" = 1 ] || exit 1
71     ;;
72 esac
74 # Regression test - aven in 1.2.6 segfaulted.
75 echo "SURVEXLANG= LANG=nosuch aven --help"
76 if test -n "$VERBOSE"; then
77   DISPLAY= SURVEXLANG= LANG=nosuch $AVEN --help
78   exitcode=$?
79 else
80   DISPLAY= SURVEXLANG= LANG=nosuch $AVEN --help > /dev/null 2>&1
81   exitcode=$?
83 if [ -n "$VALGRIND" ] ; then
84   if [ $exitcode = "$vg_error" ] ; then
85     cat "$vg_log"
86     rm "$vg_log"
87     exit 1
88   fi
89   rm "$vg_log"
91 [ "$exitcode" = 0 ] || exit 1
93 test -n "$VERBOSE" && echo "Test passed"
94 exit 0