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