source: git/tests/extend.tst @ 8a7804fb

main
Last change on this file since 8a7804fb 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: 3.2 KB
RevLine 
[01b9d0f]1#!/bin/sh
[d4ea980]2#
3# Survex test suite - extend 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/>.
[01b9d0f]19
[d4d8efe]20testdir=`echo $0 | sed 's!/[^/]*$!!' || echo '.'`
21
[01b9d0f]22# allow us to run tests standalone more easily
[d4d8efe]23: ${srcdir="$testdir"}
[87fcddb]24if [ -z "$SURVEXLIB" ] ; then
25  SURVEXLIB=`cd "$srcdir/../lib" && pwd`
26  export SURVEXLIB
[ed34f49]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
[a948c08]61    $CAVERN "$srcdir/$file.svx" --output=tmp > tmp.stdout
[33a2d49]62    exitcode=$?
[a948c08]63    [ $exitcode = 0 ] || cat tmp.stdout
64    rm tmp.stdout
[33a2d49]65  else
66    $CAVERN "$srcdir/$file.svx" --output=tmp > /dev/null
67    exitcode=$?
68  fi
69  if [ -n "$VALGRIND" ] ; then
70    if [ $exitcode = "$vg_error" ] ; then
71      cat "$vg_log"
72      rm "$vg_log"
73      exit 1
74    fi
75    rm "$vg_log"
76  fi
77  [ "$exitcode" = 0 ] || exit 1
78  if test -n "$VERBOSE" ; then
[a948c08]79    $EXTEND $EXTEND_ARGS tmp.3d tmp.x.3d > tmp.stdout
[33a2d49]80    exitcode=$?
[a948c08]81    [ $exitcode = 0 ] || cat tmp.stdout
82    rm tmp.stdout
[d4d8efe]83  else
[33a2d49]84    $EXTEND $EXTEND_ARGS tmp.3d tmp.x.3d > /dev/null
85    exitcode=$?
86  fi
87  if [ -n "$VALGRIND" ] ; then
88    if [ $exitcode = "$vg_error" ] ; then
89      cat "$vg_log"
90      rm "$vg_log"
91      exit 1
92    fi
93    rm "$vg_log"
94  fi
95  [ "$exitcode" = 0 ] || exit 1
96  if test -n "$VERBOSE" ; then
[a948c08]97    $DIFFPOS tmp.x.3d "$srcdir/${file}x.3d" > tmp.stdout
[33a2d49]98    exitcode=$?
[a948c08]99    [ $exitcode = 0 ] || cat tmp.stdout
100    rm tmp.stdout
[33a2d49]101  else
102    $DIFFPOS tmp.x.3d "$srcdir/${file}x.3d" > /dev/null
103    exitcode=$?
104  fi
105  if [ -n "$VALGRIND" ] ; then
106    if [ $exitcode = "$vg_error" ] ; then
107      cat "$vg_log"
108      rm "$vg_log"
109      exit 1
110    fi
111    rm "$vg_log"
[d4d8efe]112  fi
[33a2d49]113  [ "$exitcode" = 0 ] || exit 1
[87681b8]114  rm -f tmp.*
[01b9d0f]115done
[bbe0a27]116test -n "$VERBOSE" && echo "Test passed"
[01b9d0f]117exit 0
Note: See TracBrowser for help on using the repository browser.