source: git/tests/3dtopos.tst

main
Last change on this file was 0b99107, checked in by Olly Betts <olly@…>, 5 weeks ago

Eliminate old FSF addresses

Update GPL/LGPL licence files and boilerplate to direct people who
didn't receive the licence text to the FSF website, as the current
versions of the FSF licence texts now do, rather than giving a postal
address.

  • Property mode set to 100755
File size: 2.5 KB
RevLine 
[58f02ae]1#!/bin/sh
[d4ea980]2#
[75dbd81]3# Survex test suite - 3d to pos tests
[a948c08]4# Copyright (C) 1999-2025 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
[0b99107]17# along with this program; if not, see
18# <https://www.gnu.org/licenses/>.
[58f02ae]19
[f96a8a84]20# FIXME survexport is failing to run in CI on msys+mingw.
[d6673eb]21[ "$OSTYPE" != "cygwin" ] || exit 0
[f96a8a84]22
[58f02ae]23testdir=`echo $0 | sed 's!/[^/]*$!!' || echo '.'`
24
25# allow us to run tests standalone more easily
26: ${srcdir="$testdir"}
[87fcddb]27if [ -z "$SURVEXLIB" ] ; then
28  SURVEXLIB=`cd "$srcdir/../lib" && pwd`
29  export SURVEXLIB
[ed34f49]30fi
[58f02ae]31
32# force VERBOSE if we're run on a subset of tests
33test -n "$*" && VERBOSE=1
34
[87681b8]35test -x "$testdir"/../src/cavern || testdir=.
36
[58f02ae]37: ${DIFFPOS="$testdir"/../src/diffpos}
[79b32a95]38: ${SURVEXPORT="$testdir"/../src/survexport}
[58f02ae]39
[e0c8f98]40: ${TESTS=${*:-"pos.pos v0 v0b v1 v2 v3"}}
[58f02ae]41
[43e8c72]42# Suppress checking for leaks on exit if we're build with lsan - we don't
43# generally waste effort to free all allocations as the OS will reclaim
44# memory on exit.
45LSAN_OPTIONS=leak_check_at_exit=0
46export LSAN_OPTIONS
47
[38c4c5c]48vg_error=123
49vg_log=vg.log
50if [ -n "$VALGRIND" ] ; then
51  rm -f "$vg_log"
[79b32a95]52  SURVEXPORT="$VALGRIND --log-file=$vg_log --error-exitcode=$vg_error $SURVEXPORT"
[38c4c5c]53  DIFFPOS="$VALGRIND --log-file=$vg_log --error-exitcode=$vg_error $DIFFPOS"
54fi
55
[58f02ae]56for file in $TESTS ; do
57  echo $file
[de10f8d]58  case $file in
[d4ea980]59  *.pos) input="$srcdir/$file" ;;
60  *) input="$srcdir/$file.3d" ;;
61  esac
[87681b8]62  rm -f tmp.pos diffpos.tmp
[79b32a95]63  $SURVEXPORT "$input" tmp.pos
[38c4c5c]64  exitcode=$?
65  if [ -n "$VALGRIND" ] ; then
66    if [ $exitcode = "$vg_error" ] ; then
67      cat "$vg_log"
68      rm "$vg_log"
69      exit 1
70    fi
71    rm "$vg_log"
72  fi
73  test $exitcode = 0 || exit 1
[d4ea980]74  $DIFFPOS "$input" tmp.pos > diffpos.tmp
[38c4c5c]75  exitcode=$?
[58f02ae]76  if test -n "$VERBOSE" ; then
[a948c08]77    [ $exitcode = 0 ] || cat diffpos.tmp
[58f02ae]78  fi
[38c4c5c]79  if [ -n "$VALGRIND" ] ; then
80    if [ $exitcode = "$vg_error" ] ; then
81      cat "$vg_log"
82      rm "$vg_log"
83      exit 1
84    fi
85    rm "$vg_log"
86  fi
[87681b8]87  test -s diffpos.tmp && exit 1
88  rm -f tmp.pos diffpos.tmp
[58f02ae]89done
[bbe0a27]90test -n "$VERBOSE" && echo "Test passed"
[58f02ae]91exit 0
Note: See TracBrowser for help on using the repository browser.