source: git/tests/extend.tst @ e2ac794

stereo-2025warn-only-for-hanging-survey
Last change on this file since e2ac794 was ed34f49, checked in by Olly Betts <olly@…>, 12 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: 3.0 KB
RevLine 
[01b9d0f]1#!/bin/sh
[d4ea980]2#
3# Survex test suite - extend tests
[ed34f49]4# Copyright (C) 1999-2024 Olly Betts
[d4ea980]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
[cc49471]18# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
[01b9d0f]19
[d4d8efe]20testdir=`echo $0 | sed 's!/[^/]*$!!' || echo '.'`
21
[01b9d0f]22# allow us to run tests standalone more easily
[d4d8efe]23: ${srcdir="$testdir"}
[ed34f49]24if [ -z "$SURVEX_LIB" ] ; then
25  SURVEX_LIB=`cd "$srcdir/../lib" && pwd`
26  export SURVEX_LIB
27fi
[d4d8efe]28
29# force VERBOSE if we're run on a subset of tests
30test -n "$*" && VERBOSE=1
[01b9d0f]31
[87681b8]32test -x "$testdir"/../src/cavern || testdir=.
33
[d4d8efe]34: ${CAVERN="$testdir"/../src/cavern}
35: ${EXTEND="$testdir"/../src/extend}
[4d214ec]36: ${DIFFPOS="$testdir"/../src/diffpos}
[01b9d0f]37
[414cdd0]38: ${TESTS=${*:-"extend extend2names eswap eswap-break"}}
[01b9d0f]39
[43e8c72]40# Suppress checking for leaks on exit if we're build with lsan - we don't
41# generally waste effort to free all allocations as the OS will reclaim
42# memory on exit.
43LSAN_OPTIONS=leak_check_at_exit=0
44export LSAN_OPTIONS
45
[33a2d49]46vg_error=123
47vg_log=vg.log
48if [ -n "$VALGRIND" ] ; then
49  rm -f "$vg_log"
50  CAVERN="$VALGRIND --log-file=$vg_log --error-exitcode=$vg_error $CAVERN"
51  EXTEND="$VALGRIND --log-file=$vg_log --error-exitcode=$vg_error $EXTEND"
52  DIFFPOS="$VALGRIND --log-file=$vg_log --error-exitcode=$vg_error $DIFFPOS"
53fi
54
[01b9d0f]55for file in $TESTS ; do
56  echo $file
[dc2a4bf]57  EXTEND_ARGS=""
[4b9be72]58  test -f "$srcdir/$file.espec" && EXTEND_ARGS="--specfile $srcdir/$file.espec"
[87681b8]59  rm -f tmp.*
[d4d8efe]60  if test -n "$VERBOSE" ; then
[33a2d49]61    $CAVERN "$srcdir/$file.svx" --output=tmp
62    exitcode=$?
63  else
64    $CAVERN "$srcdir/$file.svx" --output=tmp > /dev/null
65    exitcode=$?
66  fi
67  if [ -n "$VALGRIND" ] ; then
68    if [ $exitcode = "$vg_error" ] ; then
69      cat "$vg_log"
70      rm "$vg_log"
71      exit 1
72    fi
73    rm "$vg_log"
74  fi
75  [ "$exitcode" = 0 ] || exit 1
76  if test -n "$VERBOSE" ; then
77    $EXTEND $EXTEND_ARGS tmp.3d tmp.x.3d
78    exitcode=$?
[d4d8efe]79  else
[33a2d49]80    $EXTEND $EXTEND_ARGS tmp.3d tmp.x.3d > /dev/null
81    exitcode=$?
82  fi
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"
90  fi
91  [ "$exitcode" = 0 ] || exit 1
92  if test -n "$VERBOSE" ; then
93    $DIFFPOS tmp.x.3d "$srcdir/${file}x.3d"
94    exitcode=$?
95  else
96    $DIFFPOS tmp.x.3d "$srcdir/${file}x.3d" > /dev/null
97    exitcode=$?
98  fi
99  if [ -n "$VALGRIND" ] ; then
100    if [ $exitcode = "$vg_error" ] ; then
101      cat "$vg_log"
102      rm "$vg_log"
103      exit 1
104    fi
105    rm "$vg_log"
[d4d8efe]106  fi
[33a2d49]107  [ "$exitcode" = 0 ] || exit 1
[87681b8]108  rm -f tmp.*
[01b9d0f]109done
[bbe0a27]110test -n "$VERBOSE" && echo "Test passed"
[01b9d0f]111exit 0
Note: See TracBrowser for help on using the repository browser.