source: git/tests/3dtopos.tst

Last change on this file 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
RevLine 
[58f02ae]1#!/bin/sh
[d4ea980]2#
[75dbd81]3# Survex test suite - 3d to pos 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
[58f02ae]19
20testdir=`echo $0 | sed 's!/[^/]*$!!' || echo '.'`
21
22# allow us to run tests standalone more easily
23: ${srcdir="$testdir"}
[87fcddb]24if [ -z "$SURVEXLIB" ] ; then
25  SURVEXLIB=`cd "$srcdir/../lib" && pwd`
26  export SURVEXLIB
[ed34f49]27fi
[58f02ae]28
29# force VERBOSE if we're run on a subset of tests
30test -n "$*" && VERBOSE=1
31
[87681b8]32test -x "$testdir"/../src/cavern || testdir=.
33
[58f02ae]34: ${DIFFPOS="$testdir"/../src/diffpos}
[79b32a95]35: ${SURVEXPORT="$testdir"/../src/survexport}
[58f02ae]36
[e0c8f98]37: ${TESTS=${*:-"pos.pos v0 v0b v1 v2 v3"}}
[58f02ae]38
[43e8c72]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
[38c4c5c]45vg_error=123
46vg_log=vg.log
47if [ -n "$VALGRIND" ] ; then
48  rm -f "$vg_log"
[79b32a95]49  SURVEXPORT="$VALGRIND --log-file=$vg_log --error-exitcode=$vg_error $SURVEXPORT"
[38c4c5c]50  DIFFPOS="$VALGRIND --log-file=$vg_log --error-exitcode=$vg_error $DIFFPOS"
51fi
52
[58f02ae]53for file in $TESTS ; do
54  echo $file
[de10f8d]55  case $file in
[d4ea980]56  *.pos) input="$srcdir/$file" ;;
57  *) input="$srcdir/$file.3d" ;;
58  esac
[87681b8]59  rm -f tmp.pos diffpos.tmp
[79b32a95]60  $SURVEXPORT "$input" tmp.pos
[38c4c5c]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
[d4ea980]71  $DIFFPOS "$input" tmp.pos > diffpos.tmp
[38c4c5c]72  exitcode=$?
[58f02ae]73  if test -n "$VERBOSE" ; then
[87681b8]74    cat diffpos.tmp
[58f02ae]75  fi
[38c4c5c]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
[87681b8]84  test -s diffpos.tmp && exit 1
85  rm -f tmp.pos diffpos.tmp
[58f02ae]86done
[bbe0a27]87test -n "$VERBOSE" && echo "Test passed"
[58f02ae]88exit 0
Note: See TracBrowser for help on using the repository browser.