xref: /netbsd-src/external/mpl/bind/dist/bin/tests/system/formerr/tests.sh (revision 122b5006ee1bd67145794b4cde92f4fe4781a5ec)
1#!/bin/sh
2#
3# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
4#
5# This Source Code Form is subject to the terms of the Mozilla Public
6# License, v. 2.0. If a copy of the MPL was not distributed with this
7# file, you can obtain one at https://mozilla.org/MPL/2.0/.
8#
9# See the COPYRIGHT file distributed with this work for additional
10# information regarding copyright ownership.
11
12SYSTEMTESTTOP=..
13. $SYSTEMTESTTOP/conf.sh
14
15status=0
16
17echo_i "test name too long"
18$PERL formerr.pl -a 10.53.0.1 -p ${PORT} nametoolong > nametoolong.out
19ans=`grep got: nametoolong.out`
20if [ "${ans}" != "got: 000080010000000000000000" ];
21then
22	echo_i "failed"; status=`expr $status + 1`;
23fi
24
25echo_i "two questions"
26$PERL formerr.pl -a 10.53.0.1 -p ${PORT} twoquestions > twoquestions.out
27ans=`grep got: twoquestions.out`
28if [ "${ans}" != "got: 000080010000000000000000" ];
29then
30	echo_i "failed"; status=`expr $status + 1`;
31fi
32
33# this would be NOERROR if it included a COOKIE option,
34# but is a FORMERR without one.
35echo_i "empty question section (and no COOKIE option)"
36$PERL formerr.pl -a 10.53.0.1 -p ${PORT} noquestions > noquestions.out
37ans=`grep got: noquestions.out`
38if [ "${ans}" != "got: 000080010000000000000000" ];
39then
40	echo_i "failed"; status=`expr $status + 1`;
41fi
42
43echo_i "exit status: $status"
44
45[ $status -eq 0 ] || exit 1
46