source: git/tests/smoke.tst @ e2ac794

stereo-2025warn-only-for-hanging-survey
Last change on this file since e2ac794 was ed34f49, checked in by Olly Betts <olly@…>, 13 months ago

Check SURVEX_LIB env var for support file location

We no longer look at srcdir for this.

  • Property mode set to 100755
File size: 2.2 KB
Line 
1#!/bin/sh
2#
3# Survex test suite - smoke tests
4# Copyright (C) 1999-2024 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
20testdir=`echo $0 | sed 's!/[^/]*$!!' || echo '.'`
21
22# allow us to run tests standalone more easily
23: ${srcdir="$testdir"}
24if [ -z "$SURVEX_LIB" ] ; then
25  SURVEX_LIB=`cd "$srcdir/../lib" && pwd`
26  export SURVEX_LIB
27fi
28
29test -x "$testdir"/../src/cavern || testdir=.
30
31# Ensure that --version and --help work without an X display.
32DISPLAY=
33export DISPLAY
34
35PROGS="cavern diffpos extend sorterr survexport aven"
36
37# Suppress checking for leaks on exit if we're build with lsan - we don't
38# generally waste effort to free all allocations as the OS will reclaim
39# memory on exit.
40LSAN_OPTIONS=leak_check_at_exit=0
41export LSAN_OPTIONS
42
43vgrun=
44vg_error=123
45vg_log=vg.log
46if [ -n "$VALGRIND" ] ; then
47  rm -f "$vg_log"
48  vgrun="$VALGRIND --log-file=$vg_log --error-exitcode=$vg_error"
49fi
50
51for p in ${PROGS}; do
52  echo $p
53  for o in version help ; do
54    if test -n "$VERBOSE"; then
55      $vgrun "$testdir/../src/$p" --$o
56      exitcode=$?
57    else
58      $vgrun "$testdir/../src/$p" --$o > /dev/null
59      exitcode=$?
60    fi 2> stderr.log
61    if [ -s stderr.log ] ; then
62      echo "$p --$o produced output on stderr:"
63      cat stderr.log
64      rm stderr.log
65      exit 1
66    fi
67    rm stderr.log
68    if [ -n "$VALGRIND" ] ; then
69      if [ $exitcode = "$vg_error" ] ; then
70        cat "$vg_log"
71        rm "$vg_log"
72        exit 1
73      fi
74      rm "$vg_log"
75    fi
76    [ "$exitcode" = 0 ] || exit 1
77  done
78done
79
80test -n "$VERBOSE" && echo "Test passed"
81exit 0
Note: See TracBrowser for help on using the repository browser.