source: git/tests/3dtopos.tst @ f5e6be8

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

Check SURVEXLIB instead of SURVEX_LIB

Better to be consistent with the existing environmental variable
SURVEXLANG.

  • Property mode set to 100755
File size: 2.4 KB
Line 
1#!/bin/sh
2#
3# Survex test suite - 3d to pos 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 "$SURVEXLIB" ] ; then
25  SURVEXLIB=`cd "$srcdir/../lib" && pwd`
26  export SURVEXLIB
27fi
28
29# force VERBOSE if we're run on a subset of tests
30test -n "$*" && VERBOSE=1
31
32test -x "$testdir"/../src/cavern || testdir=.
33
34: ${DIFFPOS="$testdir"/../src/diffpos}
35: ${SURVEXPORT="$testdir"/../src/survexport}
36
37: ${TESTS=${*:-"pos.pos v0 v0b v1 v2 v3"}}
38
39# Suppress checking for leaks on exit if we're build with lsan - we don't
40# generally waste effort to free all allocations as the OS will reclaim
41# memory on exit.
42LSAN_OPTIONS=leak_check_at_exit=0
43export LSAN_OPTIONS
44
45vg_error=123
46vg_log=vg.log
47if [ -n "$VALGRIND" ] ; then
48  rm -f "$vg_log"
49  SURVEXPORT="$VALGRIND --log-file=$vg_log --error-exitcode=$vg_error $SURVEXPORT"
50  DIFFPOS="$VALGRIND --log-file=$vg_log --error-exitcode=$vg_error $DIFFPOS"
51fi
52
53for file in $TESTS ; do
54  echo $file
55  case $file in
56  *.pos) input="$srcdir/$file" ;;
57  *) input="$srcdir/$file.3d" ;;
58  esac
59  rm -f tmp.pos diffpos.tmp
60  $SURVEXPORT "$input" tmp.pos
61  exitcode=$?
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  test $exitcode = 0 || exit 1
71  $DIFFPOS "$input" tmp.pos > diffpos.tmp
72  exitcode=$?
73  if test -n "$VERBOSE" ; then
74    cat diffpos.tmp
75  fi
76  if [ -n "$VALGRIND" ] ; then
77    if [ $exitcode = "$vg_error" ] ; then
78      cat "$vg_log"
79      rm "$vg_log"
80      exit 1
81    fi
82    rm "$vg_log"
83  fi
84  test -s diffpos.tmp && exit 1
85  rm -f tmp.pos diffpos.tmp
86done
87test -n "$VERBOSE" && echo "Test passed"
88exit 0
Note: See TracBrowser for help on using the repository browser.