2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-04 00:25:29 +00:00

Replace expr's with $((expression)) shell constucts

Also make indenting consistent.
This commit is contained in:
Mark Andrews
2022-06-21 12:42:21 +10:00
parent da63e63c41
commit 669c42cd95

View File

@@ -40,20 +40,20 @@ if $test_fixed; then
diff dig.out.fixed dig.out.fixed.good >/dev/null || ret=1 diff dig.out.fixed dig.out.fixed.good >/dev/null || ret=1
done done
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
else else
echo_i "Checking order fixed behaves as cyclic when disabled (primary)" echo_i "Checking order fixed behaves as cyclic when disabled (primary)"
ret=0 ret=0
matches=0 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 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do do
j=`expr $i % 4` j=$((i % 4))
$DIGCMD @10.53.0.1 fixed.example > dig.out.fixed || ret=1 $DIGCMD @10.53.0.1 fixed.example > dig.out.fixed || ret=1
if [ $i -le 4 ]; then if [ $i -le 4 ]; then
cp dig.out.fixed dig.out.$j cp dig.out.fixed dig.out.$j
else else
diff dig.out.fixed dig.out.$j >/dev/null && matches=`expr $matches + 1` diff dig.out.fixed dig.out.$j >/dev/null && matches=$((matches + 1))
fi fi
done done
diff dig.out.0 dig.out.1 >/dev/null && ret=1 diff dig.out.0 dig.out.1 >/dev/null && ret=1
diff dig.out.0 dig.out.2 >/dev/null && ret=1 diff dig.out.0 dig.out.2 >/dev/null && ret=1
@@ -63,7 +63,7 @@ else
diff dig.out.2 dig.out.3 >/dev/null && ret=1 diff dig.out.2 dig.out.3 >/dev/null && ret=1
if [ $matches -ne 16 ]; then ret=1; fi if [ $matches -ne 16 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
fi fi
# #
@@ -74,12 +74,12 @@ ret=0
matches=0 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 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do do
j=`expr $i % 4` j=$((i % 4))
$DIGCMD @10.53.0.1 cyclic.example > dig.out.cyclic || ret=1 $DIGCMD @10.53.0.1 cyclic.example > dig.out.cyclic || ret=1
if [ $i -le 4 ]; then if [ $i -le 4 ]; then
cp dig.out.cyclic dig.out.$j cp dig.out.cyclic dig.out.$j
else else
diff dig.out.cyclic dig.out.$j >/dev/null && matches=`expr $matches + 1` diff dig.out.cyclic dig.out.$j >/dev/null && matches=$((matches + 1))
fi fi
done done
diff dig.out.0 dig.out.1 >/dev/null && ret=1 diff dig.out.0 dig.out.1 >/dev/null && ret=1
@@ -90,7 +90,7 @@ diff dig.out.1 dig.out.3 >/dev/null && ret=1
diff dig.out.2 dig.out.3 >/dev/null && ret=1 diff dig.out.2 dig.out.3 >/dev/null && ret=1
if [ $matches -ne 16 ]; then ret=1; fi if [ $matches -ne 16 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
# #
# #
@@ -100,12 +100,12 @@ ret=0
matches=0 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 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do do
j=`expr $i % 4` j=$((i % 4))
$DIGCMD @10.53.0.1 cyclic2.example > dig.out.cyclic2 || ret=1 $DIGCMD @10.53.0.1 cyclic2.example > dig.out.cyclic2 || ret=1
if [ $i -le 4 ]; then if [ $i -le 4 ]; then
cp dig.out.cyclic2 dig.out.$j cp dig.out.cyclic2 dig.out.$j
else else
diff dig.out.cyclic2 dig.out.$j >/dev/null && matches=`expr $matches + 1` diff dig.out.cyclic2 dig.out.$j >/dev/null && matches=$((matches + 1))
fi fi
done done
diff dig.out.0 dig.out.1 >/dev/null && ret=1 diff dig.out.0 dig.out.1 >/dev/null && ret=1
@@ -116,12 +116,12 @@ diff dig.out.1 dig.out.3 >/dev/null && ret=1
diff dig.out.2 dig.out.3 >/dev/null && ret=1 diff dig.out.2 dig.out.3 >/dev/null && ret=1
if [ $matches -ne 16 ]; then ret=1; fi if [ $matches -ne 16 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
echo_i "Checking order random (primary)" echo_i "Checking order random (primary)"
ret=0 ret=0
for i in $GOOD_RANDOM for i in $GOOD_RANDOM
do do
eval match$i=0 eval match$i=0
done 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 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 do
@@ -137,27 +137,27 @@ done
match=0 match=0
for i in $GOOD_RANDOM for i in $GOOD_RANDOM
do do
eval "match=\`expr \$match + \$match$i\`" eval "match=\$((match + match$i))"
done done
echo_i "Random selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples" echo_i "Random selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples"
if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi if [ $match -lt $((GOOD_RANDOM_NO / 3)) ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
echo_i "Checking order none (primary)" echo_i "Checking order none (primary)"
ret=0 ret=0
# Fetch the "reference" response and ensure it contains the expected records. # Fetch the "reference" response and ensure it contains the expected records.
$DIGCMD @10.53.0.1 none.example > dig.out.none || ret=1 $DIGCMD @10.53.0.1 none.example > dig.out.none || ret=1
for i in 1 2 3 4; do for i in 1 2 3 4; do
grep -F -q 1.2.3.$i dig.out.none || ret=1 grep -F -q 1.2.3.$i dig.out.none || ret=1
done done
# Ensure 20 further queries result in the same response as the "reference" one. # 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 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 $DIGCMD @10.53.0.1 none.example > dig.out.test$i || ret=1
diff dig.out.none dig.out.test$i >/dev/null || ret=1 diff dig.out.none dig.out.test$i >/dev/null || ret=1
done done
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
# #
# #
@@ -171,7 +171,7 @@ if $test_fixed; then
diff dig.out.fixed dig.out.fixed.good || ret=1 diff dig.out.fixed dig.out.fixed.good || ret=1
done done
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
fi fi
# #
@@ -182,12 +182,12 @@ ret=0
matches=0 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 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do do
j=`expr $i % 4` j=$((i % 4))
$DIGCMD @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1 $DIGCMD @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
if [ $i -le 4 ]; then if [ $i -le 4 ]; then
cp dig.out.cyclic dig.out.$j cp dig.out.cyclic dig.out.$j
else else
diff dig.out.cyclic dig.out.$j >/dev/null && matches=`expr $matches + 1` diff dig.out.cyclic dig.out.$j >/dev/null && matches=$((matches + 1))
fi fi
done done
diff dig.out.0 dig.out.1 >/dev/null && ret=1 diff dig.out.0 dig.out.1 >/dev/null && ret=1
@@ -198,7 +198,7 @@ diff dig.out.1 dig.out.3 >/dev/null && ret=1
diff dig.out.2 dig.out.3 >/dev/null && ret=1 diff dig.out.2 dig.out.3 >/dev/null && ret=1
if [ $matches -ne 16 ]; then ret=1; fi if [ $matches -ne 16 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
# #
# #
@@ -208,12 +208,12 @@ ret=0
matches=0 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 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do do
j=`expr $i % 4` j=$((i % 4))
$DIGCMD @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1 $DIGCMD @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
if [ $i -le 4 ]; then if [ $i -le 4 ]; then
cp dig.out.cyclic2 dig.out.$j cp dig.out.cyclic2 dig.out.$j
else else
diff dig.out.cyclic2 dig.out.$j >/dev/null && matches=`expr $matches + 1` diff dig.out.cyclic2 dig.out.$j >/dev/null && matches=$((matches + 1))
fi fi
done done
diff dig.out.0 dig.out.1 >/dev/null && ret=1 diff dig.out.0 dig.out.1 >/dev/null && ret=1
@@ -224,13 +224,13 @@ diff dig.out.1 dig.out.3 >/dev/null && ret=1
diff dig.out.2 dig.out.3 >/dev/null && ret=1 diff dig.out.2 dig.out.3 >/dev/null && ret=1
if [ $matches -ne 16 ]; then ret=1; fi if [ $matches -ne 16 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
echo_i "Checking order random (secondary)" echo_i "Checking order random (secondary)"
ret=0 ret=0
for i in $GOOD_RANDOM for i in $GOOD_RANDOM
do do
eval match$i=0 eval match$i=0
done 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 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 do
@@ -246,27 +246,27 @@ done
match=0 match=0
for i in $GOOD_RANDOM for i in $GOOD_RANDOM
do do
eval "match=\`expr \$match + \$match$i\`" eval "match=\$((match + match$i))"
done done
echo_i "Random selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples" echo_i "Random selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples"
if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi if [ $match -lt $((GOOD_RANDOM_NO / 3)) ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
echo_i "Checking order none (secondary)" echo_i "Checking order none (secondary)"
ret=0 ret=0
# Fetch the "reference" response and ensure it contains the expected records. # Fetch the "reference" response and ensure it contains the expected records.
$DIGCMD @10.53.0.2 none.example > dig.out.none || ret=1 $DIGCMD @10.53.0.2 none.example > dig.out.none || ret=1
for i in 1 2 3 4; do for i in 1 2 3 4; do
grep -F -q 1.2.3.$i dig.out.none || ret=1 grep -F -q 1.2.3.$i dig.out.none || ret=1
done done
# Ensure 20 further queries result in the same response as the "reference" one. # 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 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 $DIGCMD @10.53.0.2 none.example > dig.out.test$i || ret=1
diff dig.out.none dig.out.test$i >/dev/null || ret=1 diff dig.out.none dig.out.test$i >/dev/null || ret=1
done done
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
echo_i "Shutting down secondary" echo_i "Shutting down secondary"
@@ -276,8 +276,8 @@ echo_i "Checking for secondary's on disk copy of zone"
if [ ! -f ns2/root.bk ] if [ ! -f ns2/root.bk ]
then then
echo_i "failed"; echo_i "failed";
status=`expr $status + 1` status=$((status + 1))
fi fi
echo_i "Re-starting secondary" echo_i "Re-starting secondary"
@@ -296,7 +296,7 @@ if $test_fixed; then
diff dig.out.fixed dig.out.fixed.good || ret=1 diff dig.out.fixed dig.out.fixed.good || ret=1
done done
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
fi fi
# #
@@ -307,12 +307,12 @@ ret=0
matches=0 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 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do do
j=`expr $i % 4` j=$((i % 4))
$DIGCMD @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1 $DIGCMD @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
if [ $i -le 4 ]; then if [ $i -le 4 ]; then
cp dig.out.cyclic dig.out.$j cp dig.out.cyclic dig.out.$j
else else
diff dig.out.cyclic dig.out.$j >/dev/null && matches=`expr $matches + 1` diff dig.out.cyclic dig.out.$j >/dev/null && matches=$((matches + 1))
fi fi
done done
diff dig.out.0 dig.out.1 >/dev/null && ret=1 diff dig.out.0 dig.out.1 >/dev/null && ret=1
@@ -323,7 +323,7 @@ diff dig.out.1 dig.out.3 >/dev/null && ret=1
diff dig.out.2 dig.out.3 >/dev/null && ret=1 diff dig.out.2 dig.out.3 >/dev/null && ret=1
if [ $matches -ne 16 ]; then ret=1; fi if [ $matches -ne 16 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
# #
# #
@@ -333,12 +333,12 @@ ret=0
matches=0 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 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do do
j=`expr $i % 4` j=$((i % 4))
$DIGCMD @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1 $DIGCMD @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
if [ $i -le 4 ]; then if [ $i -le 4 ]; then
cp dig.out.cyclic2 dig.out.$j cp dig.out.cyclic2 dig.out.$j
else else
diff dig.out.cyclic2 dig.out.$j >/dev/null && matches=`expr $matches + 1` diff dig.out.cyclic2 dig.out.$j >/dev/null && matches=$((matches + 1))
fi fi
done done
diff dig.out.0 dig.out.1 >/dev/null && ret=1 diff dig.out.0 dig.out.1 >/dev/null && ret=1
@@ -349,49 +349,49 @@ diff dig.out.1 dig.out.3 >/dev/null && ret=1
diff dig.out.2 dig.out.3 >/dev/null && ret=1 diff dig.out.2 dig.out.3 >/dev/null && ret=1
if [ $matches -ne 16 ]; then ret=1; fi if [ $matches -ne 16 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
echo_i "Checking order random (secondary loaded from disk)" echo_i "Checking order random (secondary loaded from disk)"
ret=0 ret=0
for i in $GOOD_RANDOM for i in $GOOD_RANDOM
do do
eval match$i=0 eval match$i=0
done 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 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 do
$DIGCMD @10.53.0.2 random.example > dig.out.random || ret=1 $DIGCMD @10.53.0.2 random.example > dig.out.random || ret=1
match=0 match=0
for j in $GOOD_RANDOM for j in $GOOD_RANDOM
do do
eval "diff dig.out.random dig.out.random.good$j >/dev/null && match$j=1 match=1" eval "diff dig.out.random dig.out.random.good$j >/dev/null && match$j=1 match=1"
if [ $match -eq 1 ]; then break; fi if [ $match -eq 1 ]; then break; fi
done done
if [ $match -eq 0 ]; then ret=1; fi if [ $match -eq 0 ]; then ret=1; fi
done done
match=0 match=0
for i in $GOOD_RANDOM for i in $GOOD_RANDOM
do do
eval "match=\`expr \$match + \$match$i\`" eval "match=\$((match + match$i))"
done done
echo_i "Random selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples" echo_i "Random selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples"
if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi if [ $match -lt $((GOOD_RANDOM_NO / 3)) ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
echo_i "Checking order none (secondary loaded from disk)" echo_i "Checking order none (secondary loaded from disk)"
ret=0 ret=0
# Fetch the "reference" response and ensure it contains the expected records. # Fetch the "reference" response and ensure it contains the expected records.
$DIGCMD @10.53.0.2 none.example > dig.out.none || ret=1 $DIGCMD @10.53.0.2 none.example > dig.out.none || ret=1
for i in 1 2 3 4; do for i in 1 2 3 4; do
grep -F -q 1.2.3.$i dig.out.none || ret=1 grep -F -q 1.2.3.$i dig.out.none || ret=1
done done
# Ensure 20 further queries result in the same response as the "reference" one. # 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 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 $DIGCMD @10.53.0.2 none.example > dig.out.test$i || ret=1
diff dig.out.none dig.out.test$i >/dev/null || ret=1 diff dig.out.none dig.out.test$i >/dev/null || ret=1
done done
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
# #
# #
@@ -405,7 +405,7 @@ if $test_fixed; then
diff dig.out.fixed dig.out.fixed.good || ret=1 diff dig.out.fixed dig.out.fixed.good || ret=1
done done
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
fi fi
# #
@@ -418,12 +418,12 @@ $DIGCMD @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
matches=0 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 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do do
j=`expr $i % 4` j=$((i % 4))
$DIGCMD @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1 $DIGCMD @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
if [ $i -le 4 ]; then if [ $i -le 4 ]; then
cp dig.out.cyclic dig.out.$j cp dig.out.cyclic dig.out.$j
else else
diff dig.out.cyclic dig.out.$j >/dev/null && matches=`expr $matches + 1` diff dig.out.cyclic dig.out.$j >/dev/null && matches=$((matches + 1))
fi fi
done done
diff dig.out.0 dig.out.1 >/dev/null && ret=1 diff dig.out.0 dig.out.1 >/dev/null && ret=1
@@ -434,7 +434,7 @@ diff dig.out.1 dig.out.3 >/dev/null && ret=1
diff dig.out.2 dig.out.3 >/dev/null && ret=1 diff dig.out.2 dig.out.3 >/dev/null && ret=1
if [ $matches -ne 16 ]; then ret=1; fi if [ $matches -ne 16 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
# #
# #
@@ -446,12 +446,12 @@ $DIGCMD @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
matches=0 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 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do do
j=`expr $i % 4` j=$((i % 4))
$DIGCMD @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1 $DIGCMD @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
if [ $i -le 4 ]; then if [ $i -le 4 ]; then
cp dig.out.cyclic2 dig.out.$j cp dig.out.cyclic2 dig.out.$j
else else
diff dig.out.cyclic2 dig.out.$j >/dev/null && matches=`expr $matches + 1` diff dig.out.cyclic2 dig.out.$j >/dev/null && matches=$((matches + 1))
fi fi
done done
diff dig.out.0 dig.out.1 >/dev/null && ret=1 diff dig.out.0 dig.out.1 >/dev/null && ret=1
@@ -462,32 +462,32 @@ diff dig.out.1 dig.out.3 >/dev/null && ret=1
diff dig.out.2 dig.out.3 >/dev/null && ret=1 diff dig.out.2 dig.out.3 >/dev/null && ret=1
if [ $matches -ne 16 ]; then ret=1; fi if [ $matches -ne 16 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
echo_i "Checking order random (cache)" echo_i "Checking order random (cache)"
ret=0 ret=0
for i in $GOOD_RANDOM for i in $GOOD_RANDOM
do do
eval match$i=0 eval match$i=0
done 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 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 do
$DIGCMD @10.53.0.3 random.example > dig.out.random || ret=1 $DIGCMD @10.53.0.3 random.example > dig.out.random || ret=1
match=0 match=0
for j in $GOOD_RANDOM for j in $GOOD_RANDOM
do do
eval "diff dig.out.random dig.out.random.good$j >/dev/null && match$j=1 match=1" eval "diff dig.out.random dig.out.random.good$j >/dev/null && match$j=1 match=1"
if [ $match -eq 1 ]; then break; fi if [ $match -eq 1 ]; then break; fi
done done
if [ $match -eq 0 ]; then ret=1; fi if [ $match -eq 0 ]; then ret=1; fi
done done
match=0 match=0
for i in $GOOD_RANDOM for i in $GOOD_RANDOM
do do
eval "match=\`expr \$match + \$match$i\`" eval "match=\$((match + match$i))"
done done
echo_i "Random selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples" echo_i "Random selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples"
if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi if [ $match -lt $((GOOD_RANDOM_NO / 3)) ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret)) status=$((status + ret))
@@ -496,57 +496,57 @@ ret=0
# Fetch the "reference" response and ensure it contains the expected records. # Fetch the "reference" response and ensure it contains the expected records.
$DIGCMD @10.53.0.3 none.example > dig.out.none || ret=1 $DIGCMD @10.53.0.3 none.example > dig.out.none || ret=1
for i in 1 2 3 4; do for i in 1 2 3 4; do
grep -F -q 1.2.3.$i dig.out.none || ret=1 grep -F -q 1.2.3.$i dig.out.none || ret=1
done done
# Ensure 20 further queries result in the same response as the "reference" one. # 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 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 $DIGCMD @10.53.0.3 none.example > dig.out.test$i || ret=1
diff dig.out.none dig.out.test$i >/dev/null || ret=1 diff dig.out.none dig.out.test$i >/dev/null || ret=1
done done
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
echo_i "Checking default order (cache)" echo_i "Checking default order (cache)"
ret=0 ret=0
for i in $GOOD_RANDOM for i in $GOOD_RANDOM
do do
eval match$i=0 eval match$i=0
done 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 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 do
$DIGCMD @10.53.0.5 random.example > dig.out.random || ret=1 $DIGCMD @10.53.0.5 random.example > dig.out.random || ret=1
match=0 match=0
for j in $GOOD_RANDOM for j in $GOOD_RANDOM
do do
eval "diff dig.out.random dig.out.random.good$j >/dev/null && match$j=1 match=1" eval "diff dig.out.random dig.out.random.good$j >/dev/null && match$j=1 match=1"
if [ $match -eq 1 ]; then break; fi if [ $match -eq 1 ]; then break; fi
done done
if [ $match -eq 0 ]; then ret=1; fi if [ $match -eq 0 ]; then ret=1; fi
done done
match=0 match=0
for i in $GOOD_RANDOM for i in $GOOD_RANDOM
do do
eval "match=\`expr \$match + \$match$i\`" eval "match=\$((match + match$i))"
done done
echo_i "Default selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples" echo_i "Default selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples"
if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi if [ $match -lt $((GOOD_RANDOM_NO / 3)) ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
echo_i "Checking default order no match in rrset-order (cache)" echo_i "Checking default order no match in rrset-order (cache)"
ret=0 ret=0
# Fetch the "reference" response and ensure it contains the expected records. # Fetch the "reference" response and ensure it contains the expected records.
$DIGCMD @10.53.0.4 nomatch.example > dig.out.nomatch || ret=1 $DIGCMD @10.53.0.4 nomatch.example > dig.out.nomatch || ret=1
for i in 1 2 3 4; do for i in 1 2 3 4; do
grep -F -q 1.2.3.$i dig.out.nomatch || ret=1 grep -F -q 1.2.3.$i dig.out.nomatch || ret=1
done done
# Ensure 20 further queries result in the same response as the "reference" one. # 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 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 $DIGCMD @10.53.0.4 nomatch.example > dig.out.test$i || ret=1
diff dig.out.nomatch dig.out.test$i >/dev/null || ret=1 diff dig.out.nomatch dig.out.test$i >/dev/null || ret=1
done done
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=$((status + ret))
echo_i "exit status: $status" echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1 [ $status -eq 0 ] || exit 1