. ../conf.sh
DIGOPTS="+nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short +nocookie"
-DIGCMD="$DIG $DIGOPTS -p ${PORT}"
+
+dig_cmd() {
+ # shellcheck disable=SC2086
+ "$DIG" $DIGOPTS -p "${PORT}" "$@" | grep -v '^;'
+}
status=0
ret=0
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
do
- $DIGCMD @10.53.0.1 fixed.example > dig.out.fixed || ret=1
+ dig_cmd @10.53.0.1 fixed.example > dig.out.fixed || ret=1
diff dig.out.fixed dig.out.fixed.good >/dev/null || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
j=$((i % 4))
- $DIGCMD @10.53.0.1 fixed.example > dig.out.fixed || ret=1
+ dig_cmd @10.53.0.1 fixed.example > dig.out.fixed || ret=1
if [ $i -le 4 ]; then
cp dig.out.fixed dig.out.$j
else
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
j=$((i % 4))
- $DIGCMD @10.53.0.1 cyclic.example > dig.out.cyclic || ret=1
+ dig_cmd @10.53.0.1 cyclic.example > dig.out.cyclic || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic dig.out.$j
else
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
j=$((i % 4))
- $DIGCMD @10.53.0.1 cyclic2.example > dig.out.cyclic2 || ret=1
+ dig_cmd @10.53.0.1 cyclic2.example > dig.out.cyclic2 || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic2 dig.out.$j
else
done
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
do
- $DIGCMD @10.53.0.1 random.example > dig.out.random || ret=1
+ dig_cmd @10.53.0.1 random.example > dig.out.random || ret=1
match=0
for j in $GOOD_RANDOM
do
echo_i "Checking order none (primary)"
ret=0
# Fetch the "reference" response and ensure it contains the expected records.
-$DIGCMD @10.53.0.1 none.example > dig.out.none || ret=1
+dig_cmd @10.53.0.1 none.example > dig.out.none || ret=1
for i in 1 2 3 4; do
grep -F -q 1.2.3.$i dig.out.none || ret=1
done
# Ensure 20 further queries result in the same response as the "reference" one.
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
- $DIGCMD @10.53.0.1 none.example > dig.out.test$i || ret=1
+ dig_cmd @10.53.0.1 none.example > dig.out.test$i || ret=1
diff dig.out.none dig.out.test$i >/dev/null || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
ret=0
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
do
- $DIGCMD @10.53.0.2 fixed.example > dig.out.fixed || ret=1
+ dig_cmd @10.53.0.2 fixed.example > dig.out.fixed || ret=1
diff dig.out.fixed dig.out.fixed.good || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
j=$((i % 4))
- $DIGCMD @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
+ dig_cmd @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic dig.out.$j
else
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
j=$((i % 4))
- $DIGCMD @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
+ dig_cmd @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic2 dig.out.$j
else
done
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
do
- $DIGCMD @10.53.0.2 random.example > dig.out.random || ret=1
+ dig_cmd @10.53.0.2 random.example > dig.out.random || ret=1
match=0
for j in $GOOD_RANDOM
do
echo_i "Checking order none (secondary)"
ret=0
# Fetch the "reference" response and ensure it contains the expected records.
-$DIGCMD @10.53.0.2 none.example > dig.out.none || ret=1
+dig_cmd @10.53.0.2 none.example > dig.out.none || ret=1
for i in 1 2 3 4; do
grep -F -q 1.2.3.$i dig.out.none || ret=1
done
# Ensure 20 further queries result in the same response as the "reference" one.
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
- $DIGCMD @10.53.0.2 none.example > dig.out.test$i || ret=1
+ dig_cmd @10.53.0.2 none.example > dig.out.test$i || ret=1
diff dig.out.none dig.out.test$i >/dev/null || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
ret=0
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
do
- $DIGCMD @10.53.0.2 fixed.example > dig.out.fixed || ret=1
+ dig_cmd @10.53.0.2 fixed.example > dig.out.fixed || ret=1
diff dig.out.fixed dig.out.fixed.good || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
j=$((i % 4))
- $DIGCMD @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
+ dig_cmd @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic dig.out.$j
else
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
j=$((i % 4))
- $DIGCMD @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
+ dig_cmd @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic2 dig.out.$j
else
done
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
do
- $DIGCMD @10.53.0.2 random.example > dig.out.random || ret=1
+ dig_cmd @10.53.0.2 random.example > dig.out.random || ret=1
match=0
for j in $GOOD_RANDOM
do
echo_i "Checking order none (secondary loaded from disk)"
ret=0
# Fetch the "reference" response and ensure it contains the expected records.
-$DIGCMD @10.53.0.2 none.example > dig.out.none || ret=1
+dig_cmd @10.53.0.2 none.example > dig.out.none || ret=1
for i in 1 2 3 4; do
grep -F -q 1.2.3.$i dig.out.none || ret=1
done
# Ensure 20 further queries result in the same response as the "reference" one.
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
- $DIGCMD @10.53.0.2 none.example > dig.out.test$i || ret=1
+ dig_cmd @10.53.0.2 none.example > dig.out.test$i || ret=1
diff dig.out.none dig.out.test$i >/dev/null || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
ret=0
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
do
- $DIGCMD @10.53.0.3 fixed.example > dig.out.fixed || ret=1
+ dig_cmd @10.53.0.3 fixed.example > dig.out.fixed || ret=1
diff dig.out.fixed dig.out.fixed.good || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
echo_i "Checking order cyclic (cache + additional)"
ret=0
# prime acache
-$DIGCMD @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
+dig_cmd @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
matches=0
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
j=$((i % 4))
- $DIGCMD @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
+ dig_cmd @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic dig.out.$j
else
echo_i "Checking order cyclic (cache)"
ret=0
# prime acache
-$DIGCMD @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
+dig_cmd @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
matches=0
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
j=$((i % 4))
- $DIGCMD @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
+ dig_cmd @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic2 dig.out.$j
else
done
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
do
- $DIGCMD @10.53.0.3 random.example > dig.out.random || ret=1
+ dig_cmd @10.53.0.3 random.example > dig.out.random || ret=1
match=0
for j in $GOOD_RANDOM
do
echo_i "Checking order none (cache)"
ret=0
# Fetch the "reference" response and ensure it contains the expected records.
-$DIGCMD @10.53.0.3 none.example > dig.out.none || ret=1
+dig_cmd @10.53.0.3 none.example > dig.out.none || ret=1
for i in 1 2 3 4; do
grep -F -q 1.2.3.$i dig.out.none || ret=1
done
# Ensure 20 further queries result in the same response as the "reference" one.
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
- $DIGCMD @10.53.0.3 none.example > dig.out.test$i || ret=1
+ dig_cmd @10.53.0.3 none.example > dig.out.test$i || ret=1
diff dig.out.none dig.out.test$i >/dev/null || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
done
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
do
- $DIGCMD @10.53.0.5 random.example > dig.out.random || ret=1
+ dig_cmd @10.53.0.5 random.example > dig.out.random || ret=1
match=0
for j in $GOOD_RANDOM
do
echo_i "Checking default order no match in rrset-order (cache)"
ret=0
# Fetch the "reference" response and ensure it contains the expected records.
-$DIGCMD @10.53.0.4 nomatch.example > dig.out.nomatch || ret=1
+dig_cmd @10.53.0.4 nomatch.example > dig.out.nomatch || ret=1
for i in 1 2 3 4; do
grep -F -q 1.2.3.$i dig.out.nomatch || ret=1
done
# Ensure 20 further queries result in the same response as the "reference" one.
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
- $DIGCMD @10.53.0.4 nomatch.example > dig.out.test$i || ret=1
+ dig_cmd @10.53.0.4 nomatch.example > dig.out.test$i || ret=1
diff dig.out.nomatch dig.out.test$i >/dev/null || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi