source: git/tests/extend.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: 3.2 KB
Line 
1#!/bin/sh
2#
3# Survex test suite - extend tests
4# Copyright (C) 1999-2025 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, see
18# <https://www.gnu.org/licenses/>.
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: ${CAVERN="$testdir"/../src/cavern}
35: ${EXTEND="$testdir"/../src/extend}
36: ${DIFFPOS="$testdir"/../src/diffpos}
37
38: ${TESTS=${*:-"extend extend2names eswap eswap-break"}}
39
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
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
55for file in $TESTS ; do
56  echo $file
57  EXTEND_ARGS=""
58  test -f "$srcdir/$file.espec" && EXTEND_ARGS="--specfile $srcdir/$file.espec"
59  rm -f tmp.*
60  if test -n "$VERBOSE" ; then
61    $CAVERN "$srcdir/$file.svx" --output=tmp > tmp.stdout
62    exitcode=$?
63    [ $exitcode = 0 ] || cat tmp.stdout
64    rm tmp.stdout
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
79    $EXTEND $EXTEND_ARGS tmp.3d tmp.x.3d > tmp.stdout
80    exitcode=$?
81    [ $exitcode = 0 ] || cat tmp.stdout
82    rm tmp.stdout
83  else
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
97    $DIFFPOS tmp.x.3d "$srcdir/${file}x.3d" > tmp.stdout
98    exitcode=$?
99    [ $exitcode = 0 ] || cat tmp.stdout
100    rm tmp.stdout
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"
112  fi
113  [ "$exitcode" = 0 ] || exit 1
114  rm -f tmp.*
115done
116test -n "$VERBOSE" && echo "Test passed"
117exit 0
Note: See TracBrowser for help on using the repository browser.