Update copyright dates
[adns] / regress / r1test
... / ...
CommitLineData
1#!/bin/sh
2# usage: r1test <testcasename>
3# test execution script, for running one test
4#
5# This file is part of adns, which is
6# Copyright (C) 1997-2000,2003,2006,2014-2016 Ian Jackson
7# Copyright (C) 2014 Mark Wooding
8# Copyright (C) 1999-2000,2003,2006 Tony Finch
9# Copyright (C) 1991 Massachusetts Institute of Technology
10# (See the file INSTALL for full details.)
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 3, or (at your option)
15# any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software Foundation.
24
25set -e
26: ${srcdir=.}
27mrc=1
28trap 'exit $mrc' 0
29
30casename="$1"
31case="$srcdir/case-$casename"
32ocase="output-$casename"
33
34exec 4<"$case.sys"
35read <&4 program initfile initflags
36read <&4 queryargs
37
38initstring="`cat $srcdir/init-$initfile.text`"
39xinitflagsf=$srcdir/$program-xinitflags.text
40if test -f $xinitflagsf
41then
42 initflags="$initflags `cat $xinitflagsf`";
43else
44 initflags="$initflags /"
45fi
46
47rm -f $ocase.*
48
49EF_DISABLE_BANNER=1
50export EF_DISABLE_BANNER
51
52if test -f "$case.in"
53then
54 exec <"$case.in"
55else
56 exec </dev/null
57fi
58
59playback=./${program}_playback
60if test ! -f $playback
61then
62 printf "SKIPPED-$casename "
63 mrc=5
64 exit
65fi
66
67set +e
68ADNS_TEST_REPORT_FD=3 ADNS_TEST_IN_FD=4 \
69 3>>"$ocase.report" 4<&4 >"$ocase.out" 2>"$ocase.err" \
70 $ADNS_TEST_DEBUG $playback $initflags"$initstring" $queryargs
71rc=$?
72set -e
73
74if [ "$rc" = 5 ]
75then
76 printf "SKIPPED-$casename "
77 mrc=5
78 exit
79fi
80
81echo "rc=$rc" >>$ocase.out
82
83failed=false
84for part in err out
85do
86 if diff -u -- "$case.$part" "$ocase.$part"
87 then
88 :
89 else
90 failwhy="$failwhy WRONG OUTPUT"
91 fi
92done
93
94cat <&4 >"$ocase.leftover"
95if egrep . /dev/null "$ocase.leftover"
96then
97 failwhy="$failwhy EXITED EARLY"
98fi
99
100if [ "x$failwhy" != x ]
101then
102 scremain="`wc -l <\"$ocase.leftover\"`"
103 echo >&2 "FAILED $case -$failwhy - lines of syscall remaining $scremain"
104 mrc=2
105 exit
106fi
107
108printf "$casename "
109mrc=0