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 http://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
15DIGOPTS="-p ${PORT}"
16
17status=0
18
19echo_i "1000 A records"
20$DIG $DIGOPTS +tcp +norec 1000.example. @10.53.0.1 a > dig.out.1000 || status=1
21# $DIG $DIGOPTS 1000.example. @10.53.0.1 a > knowngood.dig.out.1000
22digcomp knowngood.dig.out.1000 dig.out.1000 || status=1
23
24echo_i "2000 A records"
25$DIG $DIGOPTS +tcp +norec 2000.example. @10.53.0.1 a > dig.out.2000 || status=1
26# $DIG $DIGOPTS 2000.example. @10.53.0.1 a > knowngood.dig.out.2000
27digcomp knowngood.dig.out.2000 dig.out.2000 || status=1
28
29echo_i "3000 A records"
30$DIG $DIGOPTS +tcp +norec 3000.example. @10.53.0.1 a > dig.out.3000 || status=1
31# $DIG $DIGOPTS 3000.example. @10.53.0.1 a > knowngood.dig.out.3000
32digcomp knowngood.dig.out.3000 dig.out.3000 || status=1
33
34echo_i "4000 A records"
35$DIG $DIGOPTS +tcp +norec 4000.example. @10.53.0.1 a > dig.out.4000 || status=1
36# $DIG $DIGOPTS 4000.example. @10.53.0.1 a > knowngood.dig.out.4000
37digcomp knowngood.dig.out.4000 dig.out.4000 || status=1
38
39echo_i "exactly maximum rrset"
40$DIG $DIGOPTS +tcp +norec +noedns a-maximum-rrset.example. @10.53.0.1 a > dig.out.a-maximum-rrset \
41	|| status=1
42# $DIG $DIGOPTS a-maximum-rrset.example. @10.53.0.1 a > knowngood.dig.out.a-maximum-rrset
43digcomp knowngood.dig.out.a-maximum-rrset dig.out.a-maximum-rrset || status=1
44
45echo_i "exceed maximum rrset (5000 A records)"
46$DIG $DIGOPTS +tcp +norec +noadd 5000.example. @10.53.0.1 a > dig.out.exceed || status=1
47# Look for truncation bit (tc).
48grep 'flags: .*tc.*;' dig.out.exceed > /dev/null || {
49    echo_i "TC bit was not set"
50    status=1
51}
52
53echo_i "exit status: $status"
54[ $status -eq 0 ] || exit 1
55