source: git/tests/cavern.tst@ 168df28

RELEASE/1.0 RELEASE/1.2 debug-ci debug-ci-sanitisers faster-cavernlog log-select main stereo stereo-2025 walls-data walls-data-hanging-as-warning warn-only-for-hanging-survey
Last change on this file since 168df28 was 168df28, checked in by Olly Betts <olly@…>, 21 years ago

Backport a whole pile of fixes and minor tweaks from 1.1.7.

git-svn-id: file:///home/survex-svn/survex/trunk@3114 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

  • Property mode set to 100755
File size: 8.6 KB
RevLine 
[fbc3a20]1#!/bin/sh
[d4ea980]2#
3# Survex test suite - cavern tests
[de10f8d]4# Copyright (C) 1999-2004,2005 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
18# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
[fbc3a20]19
[d4d8efe]20testdir=`echo $0 | sed 's!/[^/]*$!!' || echo '.'`
21
[6b8ff5b]22# allow us to run tests standalone more easily
[d4d8efe]23: ${srcdir="$testdir"}
[647407d]24
[64b4d1c]25# force VERBOSE if we're run on a subset of tests
26test -n "$*" && VERBOSE=1
27
[87681b8]28test -x "$testdir"/../src/cavern || testdir=.
29
[d4d8efe]30: ${CAVERN="$testdir"/../src/cavern}
31: ${DIFFPOS="$testdir"/../src/diffpos}
[ce22892]32: ${CAD3D="$testdir"/../src/cad3d}
[647407d]33
[0938f88]34: ${TESTS=${*-"singlefix singlereffix oneleg midpoint noose cross firststn\
[107b8bd]35 deltastar deltastar2 bug3 calibrate_tape nosurvey2 cartesian cartesian2\
36 lengthunits angleunits cmd_truncate cmd_case cmd_fix cmd_solve\
[11f9067]37 cmd_entrance cmd_sd cmd_sd_bad cmd_fix_bad cmd_set cmd_set_bad\
[cfa16ef]38 beginroot revcomplist break_replace_pfx bug0 bug1 bug2 bug4 bug5\
39 expobug require export export2 includecomment\
40 self_loop self_eq_loop reenterwarn cmd_default cmd_prefix\
41 singlefixerr singlereffixerr\
42 begin_no_end end_no_begin end_no_begin_nest require_fail\
43 exporterr1 exporterr2 exporterr3 exporterr4 exporterr5\
44 exporterr1b exporterr2b exporterr3b exporterr6 exporterr6b\
[f4b609d]45 hanging_cpt badinc badinc2 non_existant_file ONELEG\
[52ec967]46 stnsurvey1 stnsurvey2 stnsurvey3\
[0af7076]47 tapelessthandepth longname chinabug chinabug2\
[54c4612]48 multinormal multinormignall multidiving multicylpolar multicartesian\
49 multinosurv multinormalbad multibug\
50 cmd_title cmd_titlebad cmd_dummy cmd_infer\
51 cartes diving cylpolar normal normignall nosurv cmd_flags bad_cmd_flags\
[11e919a]52 plumb unusedstation exportnakedbegin oldestyle bugdz baddatacylpolar\
[8781a97]53 badnewline badquantities imgoffbyone infereqtopofil 3sdfixbug omitclino back\
[fa42426]54 notentranceorexport inferunknown inferexports bad_units_factor\
[a49b4493]55 percent_gradient dotinsurvey leandroclino lowsd revdir gettokennullderef\
[168df28]56 nosurveyhanging cmd_solve_nothing cmd_solve_nothing_implicit\
57 lech level 2fixbug declination.dat ignore.dat backread.dat dot17 3dcorner\
58 surfequate passage"}}
[4515ba18]59
60for file in $TESTS ; do
[cfa16ef]61 # how many warnings to expect
[b97d134]62 warn=
63 # how many errors to expect
64 error=
[de10f8d]65 case $file in
[b97d134]66 singlefix) pos=yes ; warn=1;;
67 singlereffix) pos=yes ; warn=0 ;;
68 oneleg) pos=yes ; warn=0 ;;
69 midpoint) pos=yes ; warn=0 ;;
70 noose) pos=yes ; warn=0 ;;
71 cross) pos=yes ; warn=0 ;;
72 firststn) pos=yes ; warn=0 ;;
73 deltastar) pos=yes ; warn=0 ;;
74 deltastar2) pos=yes ; warn=0 ;;
75 bug3) pos=yes ; warn=0 ;;
76 calibrate_tape) pos=yes ; warn=0 ;;
77 nosurvey2) pos=yes ; warn=0 ;;
78 cartesian) pos=yes ; warn=0 ;;
[107b8bd]79 cartesian2) pos=yes ; warn=0 ;;
[b97d134]80 lengthunits) pos=yes ; warn=0 ;;
81 angleunits) pos=yes ; warn=0 ;;
82 cmd_truncate) pos=yes ; warn=0 ;;
83 cmd_case) pos=yes ; warn=0 ;;
84 cmd_fix) pos=yes ; warn=1 ;;
[c80bd34]85 cmd_fix_bad) pos=fail ; error=10 ;;
[b97d134]86 cmd_solve) pos=yes ; warn=0 ;;
87 cmd_entrance) pos=no ; warn=0 ;;
[3a33d12]88 cmd_sd) pos=no ; warn=0 ;;
[fa42426]89 cmd_sd_bad) pos=fail ; error=7 ;;
[11f9067]90 cmd_set) pos=no ; warn=0 ;;
91 cmd_set_bad) pos=fail ; error=7 ;;
[cfa16ef]92 beginroot) pos=no ;;
[b97d134]93 revcomplist) pos=no ; warn=0 ;;
94 break_replace_pfx) pos=no ; warn=0 ;;
95 bug0) pos=no ; warn=0 ;;
96 bug1) pos=no ; warn=0 ;;
97 bug2) pos=no ; warn=0 ;;
98 bug4) pos=no ; warn=0 ;;
99 bug5) pos=no ; warn=0 ;;
100 expobug) pos=no ; warn=0 ;;
101 require) pos=no ; warn=0 ;;
102 export) pos=no ; warn=0 ;;
103 export2) pos=no ; warn=0 ;;
104 includecomment) pos=no ; warn=0 ;;
105 self_loop) pos=fail ; warn=0 ;;
106 self_eq_loop) pos=no ; warn=1 ;;
107 reenterwarn) pos=no ; warn=2 ;;
108 cmd_default) pos=no ; warn=3 ;;
109 singlereffixerr) pos=no ; warn=0 ;;
110 cmd_prefix) pos=no ; warn=1 ;;
111 singlefixerr) pos=no ; warn=1 ;;
112 tapelessthandepth) pos=no ; warn=1 ;;
113 chinabug2) pos=no ; warn=0 ;;
114 longname) pos=no ; warn=0 ;;
[097c0b1]115 chinabug) pos=fail ;;
[cfa16ef]116 begin_no_end) pos=fail ;;
117 end_no_begin) pos=fail ;;
118 end_no_begin_nest) pos=fail ;;
119 require_fail) pos=fail ;;
120 exporterr1) pos=fail ;;
121 exporterr2) pos=fail ;;
122 exporterr3) pos=fail ;;
123 exporterr4) pos=fail ;;
124 exporterr5) pos=fail ;;
125 exporterr1b) pos=fail ;;
126 exporterr2b) pos=fail ;;
127 exporterr3b) pos=fail ;;
128 exporterr6) pos=fail ;;
129 exporterr6b) pos=fail ;;
130 hanging_cpt) pos=fail ;;
131 badinc) pos=fail ;;
132 badinc2) pos=fail ;;
133 non_existant_file) pos=fail ;;
[f4b609d]134 ONELEG) pos=fail ;;
[cfa16ef]135 stnsurvey1) pos=fail ;;
136 stnsurvey2) pos=fail ;;
[52ec967]137 stnsurvey3) pos=fail ;;
[b97d134]138 multinormal) pos=yes ; warn=0 ;;
139 multinormignall) pos=yes ; warn=0 ;;
140 multidiving) pos=yes ; warn=0 ;;
[54c4612]141 multicylpolar) pos=yes ; warn=0 ;;
[b97d134]142 multicartesian) pos=yes ; warn=0 ;;
143 multinosurv) pos=yes ; warn=0 ;;
[eef4d8c]144 multinormalbad) pos=fail ;;
[b97d134]145 multibug) pos=no ; warn=0 ;;
146 cmd_title) pos=no ; warn=0 ;;
[457a390]147 cmd_titlebad) pos=fail ; error=4 ;;
[52b6220]148 cmd_dummy) pos=no ; warn=0 ;;
[f964a20]149 cmd_infer) pos=yes ; warn=0 ;;
[7b25479]150 cartes) pos=yes ; warn=0 ;;
151 diving) pos=yes ; warn=0 ;;
[54c4612]152 cylpolar) pos=yes ; warn=0 ;;
[7b25479]153 normal) pos=yes ; warn=0 ;;
154 normignall) pos=yes ; warn=0 ;;
155 nosurv) pos=yes ; warn=0 ;;
[9881759]156 cmd_flags) pos=no ; warn=0 ;;
157 bad_cmd_flags) pos=fail ; error=19 ;;
[26a805f]158 plumb) pos=yes ; warn=0 ;;
[7d86d87]159 unusedstation) pos=no ; warn=2 ;;
[d6d3576]160 oldestyle) pos=no ; warn=1 ;;
[4dcd3af]161 exportnakedbegin) pos=fail ;;
[a6d094f]162 bugdz) pos=yes ; warn=0 ;;
163 baddatacylpolar) pos=fail ; error=1 ;;
[6114207]164 badnewline) pos=fail ; error=2 ;;
[4b156b3]165 badquantities) pos=fail ; error=11 ;;
166 imgoffbyone) pos=yes ;; # don't actually care about coords, just the names
[107b8bd]167 infereqtopofil) pos=yes ; warn=0 ;;
[a9e3f6c]168 3sdfixbug) pos=yes ; warn=0 ;;
[5b7c1b7]169 omitclino) pos=yes ; warn=0 ;;
[0b71cfc]170 back) pos=yes; warn=0 ;;
[b14f44f]171 notentranceorexport) pos=fail; warn=0 ;;
[c00c74a9]172 inferunknown) pos=fail; error=1 ;;
173 inferexports) pos=no; warn=0 ;;
[fa42426]174 bad_units_factor) pos=fail; error=5 ;;
[cfcfd28]175 percent_gradient) pos=yes; warn=0 ;;
176 dotinsurvey) pos=no; warn=0 ;;
[fbafe28]177 leandroclino) pos=yes; warn=0 ;;
[cc6857f]178 lowsd) pos=no; warn=0 ;;
[defb715]179 revdir) pos=yes; warn=0 ;;
[22b85ce6]180 gettokennullderef) pos=fail ;;
[a49b4493]181 lech) pos=no; warn=0 ;;
[34afc2d]182 level) pos=yes; warn=0 ;;
[b91bdce]183 2fixbug) pos=no; warn=0 ;;
[168df28]184 declination.dat|ignore.dat|backread.dat) pos=yes; warn=0 ;;
[c46952f]185 dot17) pos=yes; warn=0 ;;
186 3dcorner) pos=yes; warn=0 ;;
[ce22892]187 surfequate) pos=dxf; warn=0 ;;
[fbae3de]188 nosurveyhanging) pos=fail ;;
[168df28]189 cmd_solve_hanging) pos=fail ;;
190 cmd_solve_nothing*) pos=no; warn=0 ;;
191 passage) pos=no; warn=0 ;;
[8781a97]192 *) echo "Warning: don't know how to run test '$file' - skipping it"
193 file='' ;;
[cfa16ef]194 esac
[4a2bb00]195
[cfcfd28]196 if test -n "$file" ; then
197 echo "$file"
[de10f8d]198 case $file in
[d4ea980]199 *.*)
200 input="$srcdir/$file"
[de10f8d]201 posfile="$srcdir"/`echo "$file"|sed 's/\.[^.]*$/.pos/'`
202 dxffile="$srcdir"/`echo "$file"|sed 's/\.[^.]*$/.dxf/'` ;;
[d4ea980]203 *)
204 input="$srcdir/$file.svx"
[ce22892]205 posfile="$srcdir/$file.pos"
206 dxffile="$srcdir/$file.dxf" ;;
[d4ea980]207 esac
[87681b8]208 rm -f tmp.*
[b91bdce]209 $CAVERN "$input" --output=tmp > tmp.out
210 exitcode=$?
211 test -n "$VERBOSE" && cat tmp.out
212 if test fail = "$pos" ; then
213 # success gives 0, signal (128 + <signal number>)
214 test $exitcode = 1 || exit 1
[cfa16ef]215 else
[b91bdce]216 test $exitcode = 0 || exit 1
[cfa16ef]217 fi
[b97d134]218 if test -n "$warn" ; then
[87681b8]219 w=`sed '$!d;$s/^Done.*/0/;s/[^0-9]*\([0-9]*\).*/\1/' tmp.out`
[b97d134]220 test x"$w" = x"$warn" || exit 1
221 fi
222 if test -n "$error" ; then
[87681b8]223 e=`sed '$!d;$s/^Done.*/0/;s/[^0-9]*[0-9][0-9]*[^0-9][^0-9]*\([0-9][0-9]*\).*/\1/;s/\(.*[^0-9].*\)/0/' tmp.out`
[b97d134]224 test x"$e" = x"$error" || exit 1
[cfa16ef]225 fi
[b91bdce]226 nan=`sed 's/.*\<[Nn]a[Nn]m\?\>.*/x/p;d' tmp.out`
227 if test -n "$nan" ; then
228 exit 1
229 fi
[b97d134]230
[de10f8d]231 case $pos in
[cfa16ef]232 yes)
233 if test -n "$VERBOSE" ; then
[d4ea980]234 $DIFFPOS tmp.3d "$posfile" || exit 1
[cfa16ef]235 else
[d4ea980]236 $DIFFPOS tmp.3d "$posfile" > /dev/null || exit 1
[cfa16ef]237 fi ;;
[ce22892]238 dxf)
239 if test -n "$VERBOSE" ; then
240 $CAD3D tmp.3d tmp.dxf || exit 1
241 diff tmp.dxf "$dxffile" || exit 1
242 else
243 $CAD3D tmp.3d tmp.dxf > /dev/null || exit 1
244 cmp -s tmp.dxf "$dxffile" || exit 1
245 fi ;;
[cfa16ef]246 no)
[87681b8]247 test -f tmp.3d || exit 1 ;;
[cfa16ef]248 fail)
[168df28]249 test -f tmp.3d && exit 1
250 # Check that last line doesn't contains "Bug in program detected"
251 case `tail -n 1 tmp.out` in
252 *"Bug in program detected"*) exit 1 ;;
253 esac ;;
[097c0b1]254 *)
[cfcfd28]255 echo "Bad value for pos: '$pos'" ; exit 1 ;;
[cfa16ef]256 esac
[87681b8]257 rm -f tmp.*
[cfa16ef]258 fi
[4a2bb00]259done
[cfcfd28]260test -n "$VERBOSE" && echo "Test passed"
[fbc3a20]261exit 0
Note: See TracBrowser for help on using the repository browser.