summaryrefslogtreecommitdiffstats
path: root/bin/tests/system/zero
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 16:41:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 16:41:29 +0000
commite2fc8e037ea6bb5de92b25ec9c12a624737ac5ca (patch)
tree65e6bbf5e12c3fe09b43e577f8d1786d06bcd559 /bin/tests/system/zero
parentReleasing progress-linux version 1:9.18.19-1~deb12u1progress7u1. (diff)
downloadbind9-e2fc8e037ea6bb5de92b25ec9c12a624737ac5ca.tar.xz
bind9-e2fc8e037ea6bb5de92b25ec9c12a624737ac5ca.zip
Merging upstream version 1:9.18.24.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bin/tests/system/zero')
-rw-r--r--bin/tests/system/zero/prereq.sh21
-rw-r--r--bin/tests/system/zero/setup.sh2
-rw-r--r--bin/tests/system/zero/tests.sh162
3 files changed, 117 insertions, 68 deletions
diff --git a/bin/tests/system/zero/prereq.sh b/bin/tests/system/zero/prereq.sh
new file mode 100644
index 0000000..c52be9c
--- /dev/null
+++ b/bin/tests/system/zero/prereq.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+#
+# SPDX-License-Identifier: MPL-2.0
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, you can obtain one at https://mozilla.org/MPL/2.0/.
+#
+# See the COPYRIGHT file distributed with this work for additional
+# information regarding copyright ownership.
+
+. ../conf.sh
+
+if ! ${PERL} -MNet::DNS -e ''; then
+ echo_i "perl Net::DNS module is required"
+ exit 1
+fi
+
+exit 0
diff --git a/bin/tests/system/zero/setup.sh b/bin/tests/system/zero/setup.sh
index bf58ee5..794f6a9 100644
--- a/bin/tests/system/zero/setup.sh
+++ b/bin/tests/system/zero/setup.sh
@@ -18,4 +18,4 @@ copy_setports ns2/named.conf.in ns2/named.conf
copy_setports ns3/named.conf.in ns3/named.conf
copy_setports ns4/named.conf.in ns4/named.conf
-$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 4 | sed -e 's/^$TTL 3600$/$TTL 0 ; force TTL to zero/' -e 's/86400.IN SOA/0 SOA/' > ns2/example.db
+$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 4 | sed -e 's/^$TTL 3600$/$TTL 0 ; force TTL to zero/' -e 's/86400.IN SOA/0 SOA/' >ns2/example.db
diff --git a/bin/tests/system/zero/tests.sh b/bin/tests/system/zero/tests.sh
index f5e2038..006552f 100644
--- a/bin/tests/system/zero/tests.sh
+++ b/bin/tests/system/zero/tests.sh
@@ -17,107 +17,135 @@ set -e
. ../conf.sh
dig_with_opts() {
- "$DIG" -p "${PORT}" "$@"
+ "$DIG" -p "${PORT}" "$@"
}
wait_for_pid() (
- for pid in "$@"; do
- kill -0 "$pid" 2>/dev/null && return 1
- done
- return 0
+ for pid in "$@"; do
+ kill -0 "$pid" 2>/dev/null && return 1
+ done
+ return 0
)
status=0
n=0
-n=$((n+1))
+n=$((n + 1))
echo_i "check lookups against TTL=0 records ($n)"
i=0
ret=0
passes=10
-dig_with_opts @10.53.0.2 axfr example | grep -v "^ds0" | \
-awk '$2 == "0" { print "-q", $1, $4; print "-q", "zzz"$1, $4;}' > query.list
+dig_with_opts @10.53.0.2 axfr example | grep -v "^ds0" \
+ | awk '$2 == "0" { print "-q", $1, $4; print "-q", "zzz"$1, $4;}' >query.list
# add 1/5 second per query
-timeout=$(($(wc -l < query.list) / 5))
-while [ $i -lt $passes ]
-do
- (dig_with_opts -d +qr @10.53.0.3 -f query.list > "dig.out$i.1.test$n" 2>&1) & pid1="$!"
- (dig_with_opts -d +qr @10.53.0.3 -f query.list > "dig.out$i.2.test$n" 2>&1) & pid2="$!"
- (dig_with_opts -d +qr @10.53.0.3 -f query.list > "dig.out$i.3.test$n" 2>&1) & pid3="$!"
- (dig_with_opts -d +qr @10.53.0.3 -f query.list > "dig.out$i.4.test$n" 2>&1) & pid4="$!"
- (dig_with_opts -d +qr @10.53.0.3 -f query.list > "dig.out$i.5.test$n" 2>&1) & pid5="$!"
- (dig_with_opts -d +qr @10.53.0.3 -f query.list > "dig.out$i.6.test$n" 2>&1) & pid6="$!"
-
- retry_quiet "$timeout" wait_for_pid "$pid1" "$pid2" "$pid3" "$pid4" "$pid5" "$pid6" || { echo_i "wait_for_pid failed"; ret=1; }
- kill -TERM "$pid1" "$pid2" "$pid3" "$pid4" "$pid5" "$pid6" 2>/dev/null || true
-
- wait "$pid1" || { echo_i "wait $pid1 (dig.out$i.1.test$n) failed with $?"; ret=1; }
- wait "$pid2" || { echo_i "wait $pid2 (dig.out$i.2.test$n) failed with $?"; ret=1; }
- wait "$pid3" || { echo_i "wait $pid3 (dig.out$i.3.test$n) failed with $?"; ret=1; }
- wait "$pid4" || { echo_i "wait $pid4 (dig.out$i.4.test$n) failed with $?"; ret=1; }
- wait "$pid5" || { echo_i "wait $pid5 (dig.out$i.5.test$n) failed with $?"; ret=1; }
- wait "$pid6" || { echo_i "wait $pid6 (dig.out$i.6.test$n) failed with $?"; ret=1; }
-
- grep "status: SERVFAIL" "dig.out$i.1.test$n" > /dev/null && ret=1
- grep "status: SERVFAIL" "dig.out$i.2.test$n" > /dev/null && ret=1
- grep "status: SERVFAIL" "dig.out$i.3.test$n" > /dev/null && ret=1
- grep "status: SERVFAIL" "dig.out$i.4.test$n" > /dev/null && ret=1
- grep "status: SERVFAIL" "dig.out$i.5.test$n" > /dev/null && ret=1
- grep "status: SERVFAIL" "dig.out$i.6.test$n" > /dev/null && ret=1
- [ $ret = 1 ] && break
- i=$((i+1))
- echo_i "successfully completed pass $i of $passes"
+timeout=$(($(wc -l <query.list) / 5))
+while [ $i -lt $passes ]; do
+ (dig_with_opts -d +qr @10.53.0.3 -f query.list >"dig.out$i.1.test$n" 2>&1) &
+ pid1="$!"
+ (dig_with_opts -d +qr @10.53.0.3 -f query.list >"dig.out$i.2.test$n" 2>&1) &
+ pid2="$!"
+ (dig_with_opts -d +qr @10.53.0.3 -f query.list >"dig.out$i.3.test$n" 2>&1) &
+ pid3="$!"
+ (dig_with_opts -d +qr @10.53.0.3 -f query.list >"dig.out$i.4.test$n" 2>&1) &
+ pid4="$!"
+ (dig_with_opts -d +qr @10.53.0.3 -f query.list >"dig.out$i.5.test$n" 2>&1) &
+ pid5="$!"
+ (dig_with_opts -d +qr @10.53.0.3 -f query.list >"dig.out$i.6.test$n" 2>&1) &
+ pid6="$!"
+
+ retry_quiet "$timeout" wait_for_pid "$pid1" "$pid2" "$pid3" "$pid4" "$pid5" "$pid6" || {
+ echo_i "wait_for_pid failed"
+ ret=1
+ }
+ kill -TERM "$pid1" "$pid2" "$pid3" "$pid4" "$pid5" "$pid6" 2>/dev/null || true
+
+ wait "$pid1" || {
+ echo_i "wait $pid1 (dig.out$i.1.test$n) failed with $?"
+ ret=1
+ }
+ wait "$pid2" || {
+ echo_i "wait $pid2 (dig.out$i.2.test$n) failed with $?"
+ ret=1
+ }
+ wait "$pid3" || {
+ echo_i "wait $pid3 (dig.out$i.3.test$n) failed with $?"
+ ret=1
+ }
+ wait "$pid4" || {
+ echo_i "wait $pid4 (dig.out$i.4.test$n) failed with $?"
+ ret=1
+ }
+ wait "$pid5" || {
+ echo_i "wait $pid5 (dig.out$i.5.test$n) failed with $?"
+ ret=1
+ }
+ wait "$pid6" || {
+ echo_i "wait $pid6 (dig.out$i.6.test$n) failed with $?"
+ ret=1
+ }
+
+ grep "status: SERVFAIL" "dig.out$i.1.test$n" >/dev/null && ret=1
+ grep "status: SERVFAIL" "dig.out$i.2.test$n" >/dev/null && ret=1
+ grep "status: SERVFAIL" "dig.out$i.3.test$n" >/dev/null && ret=1
+ grep "status: SERVFAIL" "dig.out$i.4.test$n" >/dev/null && ret=1
+ grep "status: SERVFAIL" "dig.out$i.5.test$n" >/dev/null && ret=1
+ grep "status: SERVFAIL" "dig.out$i.6.test$n" >/dev/null && ret=1
+ [ $ret = 1 ] && break
+ i=$((i + 1))
+ echo_i "successfully completed pass $i of $passes"
done
if [ $ret != 0 ]; then echo_i "failed"; fi
-status=$((status+ret))
+status=$((status + ret))
repeat_query() (
- i=0
- while [ "$i" -lt "$1" ]; do
- dig_with_opts +short "@$2" "$3" | tee "dig.out$i.test$n" || return 1
- i=$((i+1))
- done
+ i=0
+ while [ "$i" -lt "$1" ]; do
+ dig_with_opts +short "@$2" "$3" | tee "dig.out$i.test$n" || return 1
+ i=$((i + 1))
+ done
)
count_unique() (
- repeat_query "$@" | sort -u | wc -l
+ repeat_query "$@" | sort -u | wc -l
)
-n=$((n+1))
+n=$((n + 1))
echo_i "check repeated recursive lookups of non recurring TTL=0 responses get new values ($n)"
ret=0
repeats=9
count=$(count_unique "$repeats" 10.53.0.3 foo.increment)
-if [ "$count" -ne "$repeats" ] ; then echo_i "failed (count=$count, repeats=$repeats)"; ret=1; fi
-status=$((status+ret))
+if [ "$count" -ne "$repeats" ]; then
+ echo_i "failed (count=$count, repeats=$repeats)"
+ ret=1
+fi
+status=$((status + ret))
-n=$((n+1))
+n=$((n + 1))
echo_i "check lookups against TTL=1 records ($n)"
i=0
passes=10
ret=0
-while [ $i -lt $passes ]
-do
- dig_with_opts @10.53.0.3 www.one.tld > "dig.out$i.1.test$n" || ret=1
- dig_with_opts @10.53.0.3 www.one.tld > "dig.out$i.2.test$n" || ret=1
- dig_with_opts @10.53.0.3 www.one.tld > "dig.out$i.3.test$n" || ret=1
- dig_with_opts @10.53.0.3 www.one.tld > "dig.out$i.4.test$n" || ret=1
- dig_with_opts @10.53.0.3 www.one.tld > "dig.out$i.5.test$n" || ret=1
- dig_with_opts @10.53.0.3 www.one.tld > "dig.out$i.6.test$n" || ret=1
- grep "status: SERVFAIL" "dig.out$i.1.test$n" > /dev/null && ret=1
- grep "status: SERVFAIL" "dig.out$i.2.test$n" > /dev/null && ret=1
- grep "status: SERVFAIL" "dig.out$i.3.test$n" > /dev/null && ret=1
- grep "status: SERVFAIL" "dig.out$i.4.test$n" > /dev/null && ret=1
- grep "status: SERVFAIL" "dig.out$i.5.test$n" > /dev/null && ret=1
- grep "status: SERVFAIL" "dig.out$i.6.test$n" > /dev/null && ret=1
- [ $ret = 1 ] && break
- i=$((i+1))
- echo_i "successfully completed pass $i of $passes"
- sleep 1
+while [ $i -lt $passes ]; do
+ dig_with_opts @10.53.0.3 www.one.tld >"dig.out$i.1.test$n" || ret=1
+ dig_with_opts @10.53.0.3 www.one.tld >"dig.out$i.2.test$n" || ret=1
+ dig_with_opts @10.53.0.3 www.one.tld >"dig.out$i.3.test$n" || ret=1
+ dig_with_opts @10.53.0.3 www.one.tld >"dig.out$i.4.test$n" || ret=1
+ dig_with_opts @10.53.0.3 www.one.tld >"dig.out$i.5.test$n" || ret=1
+ dig_with_opts @10.53.0.3 www.one.tld >"dig.out$i.6.test$n" || ret=1
+ grep "status: SERVFAIL" "dig.out$i.1.test$n" >/dev/null && ret=1
+ grep "status: SERVFAIL" "dig.out$i.2.test$n" >/dev/null && ret=1
+ grep "status: SERVFAIL" "dig.out$i.3.test$n" >/dev/null && ret=1
+ grep "status: SERVFAIL" "dig.out$i.4.test$n" >/dev/null && ret=1
+ grep "status: SERVFAIL" "dig.out$i.5.test$n" >/dev/null && ret=1
+ grep "status: SERVFAIL" "dig.out$i.6.test$n" >/dev/null && ret=1
+ [ $ret = 1 ] && break
+ i=$((i + 1))
+ echo_i "successfully completed pass $i of $passes"
+ sleep 1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
-status=$((status+ret))
+status=$((status + ret))
echo_i "exit status: $status"
[ "$status" -eq 0 ] || exit 1