[f723062] | 1 | #!/bin/sh |
---|
| 2 | # |
---|
| 3 | # Survex test suite - aven tests |
---|
[43e8c72] | 4 | # Copyright (C) 1999-2021 Olly Betts |
---|
[f723062] | 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 19 | |
---|
| 20 | testdir=`echo $0 | sed 's!/[^/]*$!!' || echo '.'` |
---|
| 21 | |
---|
| 22 | # allow us to run tests standalone more easily |
---|
| 23 | : ${srcdir="$testdir"} |
---|
| 24 | |
---|
| 25 | test -x "$testdir"/../src/cavern || testdir=. |
---|
| 26 | |
---|
| 27 | : ${AVEN="$testdir"/../src/aven} |
---|
| 28 | |
---|
[43e8c72] | 29 | # Suppress checking for leaks on exit if we're build with lsan - we don't |
---|
| 30 | # generally waste effort to free all allocations as the OS will reclaim |
---|
| 31 | # memory on exit. |
---|
| 32 | LSAN_OPTIONS=leak_check_at_exit=0 |
---|
| 33 | export LSAN_OPTIONS |
---|
| 34 | |
---|
[f723062] | 35 | vg_error=123 |
---|
| 36 | vg_log=vg.log |
---|
| 37 | if [ -n "$VALGRIND" ] ; then |
---|
| 38 | rm -f "$vg_log" |
---|
| 39 | AVEN="$VALGRIND --log-file=$vg_log --error-exitcode=$vg_error $AVEN" |
---|
| 40 | fi |
---|
| 41 | |
---|
[77dc44d] | 42 | # This next testcase seems to hang on macos in CI so skip it. |
---|
| 43 | # FIXME: Ideally this should work, and it doesn't seem very different to the |
---|
| 44 | # next testcase which works. |
---|
| 45 | if [ "`uname -s`" != Darwin ] ; then |
---|
| 46 | |
---|
[f723062] | 47 | # Regression test - aven in 1.2.6 segfaulted. |
---|
[8482e79] | 48 | echo "SURVEXLANG=nosuch aven --help" |
---|
[f723062] | 49 | if test -n "$VERBOSE"; then |
---|
[8482e79] | 50 | DISPLAY= SURVEXLANG=nosuch $AVEN --help |
---|
[f723062] | 51 | exitcode=$? |
---|
| 52 | else |
---|
[8482e79] | 53 | DISPLAY= SURVEXLANG=nosuch $AVEN --help > /dev/null 2>&1 |
---|
[f723062] | 54 | exitcode=$? |
---|
| 55 | fi |
---|
| 56 | if [ -n "$VALGRIND" ] ; then |
---|
| 57 | if [ $exitcode = "$vg_error" ] ; then |
---|
| 58 | cat "$vg_log" |
---|
| 59 | rm "$vg_log" |
---|
| 60 | exit 1 |
---|
| 61 | fi |
---|
| 62 | rm "$vg_log" |
---|
| 63 | fi |
---|
| 64 | [ "$exitcode" = 1 ] || exit 1 |
---|
| 65 | |
---|
[77dc44d] | 66 | fi |
---|
| 67 | |
---|
[f723062] | 68 | # Regression test - aven in 1.2.6 segfaulted. |
---|
[8482e79] | 69 | echo "SURVEXLANG= LANG=nosuch aven --help" |
---|
[f723062] | 70 | if test -n "$VERBOSE"; then |
---|
[8482e79] | 71 | DISPLAY= SURVEXLANG= LANG=nosuch $AVEN --help |
---|
[f723062] | 72 | exitcode=$? |
---|
| 73 | else |
---|
[8482e79] | 74 | DISPLAY= SURVEXLANG= LANG=nosuch $AVEN --help > /dev/null 2>&1 |
---|
[f723062] | 75 | exitcode=$? |
---|
| 76 | fi |
---|
| 77 | if [ -n "$VALGRIND" ] ; then |
---|
| 78 | if [ $exitcode = "$vg_error" ] ; then |
---|
| 79 | cat "$vg_log" |
---|
| 80 | rm "$vg_log" |
---|
| 81 | exit 1 |
---|
| 82 | fi |
---|
| 83 | rm "$vg_log" |
---|
| 84 | fi |
---|
[8482e79] | 85 | [ "$exitcode" = 0 ] || exit 1 |
---|
[f723062] | 86 | |
---|
| 87 | test -n "$VERBOSE" && echo "Test passed" |
---|
| 88 | exit 0 |
---|