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,19 +40,19 @@ if $test_fixed; then
diff dig.out.fixed dig.out.fixed.good >/dev/null || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
else
echo_i "Checking order fixed behaves as cyclic when disabled (primary)"
ret=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
do
j=`expr $i % 4`
j=$((i % 4))
$DIGCMD @10.53.0.1 fixed.example > dig.out.fixed || ret=1
if [ $i -le 4 ]; then
cp dig.out.fixed dig.out.$j
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
done
diff dig.out.0 dig.out.1 >/dev/null && ret=1
@@ -63,7 +63,7 @@ else
diff dig.out.2 dig.out.3 >/dev/null && ret=1
if [ $matches -ne 16 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
fi
#
@@ -74,12 +74,12 @@ ret=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
do
j=`expr $i % 4`
j=$((i % 4))
$DIGCMD @10.53.0.1 cyclic.example > dig.out.cyclic || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic dig.out.$j
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
done
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
if [ $matches -ne 16 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
#
#
@@ -100,12 +100,12 @@ ret=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
do
j=`expr $i % 4`
j=$((i % 4))
$DIGCMD @10.53.0.1 cyclic2.example > dig.out.cyclic2 || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic2 dig.out.$j
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
done
diff dig.out.0 dig.out.1 >/dev/null && ret=1
@@ -116,7 +116,7 @@ diff dig.out.1 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 [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
echo_i "Checking order random (primary)"
ret=0
for i in $GOOD_RANDOM
@@ -137,12 +137,12 @@ done
match=0
for i in $GOOD_RANDOM
do
eval "match=\`expr \$match + \$match$i\`"
eval "match=\$((match + match$i))"
done
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
status=`expr $status + $ret`
status=$((status + ret))
echo_i "Checking order none (primary)"
ret=0
@@ -157,7 +157,7 @@ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
diff dig.out.none dig.out.test$i >/dev/null || ret=1
done
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
done
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
fi
#
@@ -182,12 +182,12 @@ ret=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
do
j=`expr $i % 4`
j=$((i % 4))
$DIGCMD @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic dig.out.$j
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
done
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
if [ $matches -ne 16 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
#
#
@@ -208,12 +208,12 @@ ret=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
do
j=`expr $i % 4`
j=$((i % 4))
$DIGCMD @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic2 dig.out.$j
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
done
diff dig.out.0 dig.out.1 >/dev/null && ret=1
@@ -224,7 +224,7 @@ diff dig.out.1 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 [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
echo_i "Checking order random (secondary)"
ret=0
@@ -246,12 +246,12 @@ done
match=0
for i in $GOOD_RANDOM
do
eval "match=\`expr \$match + \$match$i\`"
eval "match=\$((match + match$i))"
done
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
status=`expr $status + $ret`
status=$((status + ret))
echo_i "Checking order none (secondary)"
ret=0
@@ -266,7 +266,7 @@ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
diff dig.out.none dig.out.test$i >/dev/null || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
echo_i "Shutting down secondary"
@@ -277,7 +277,7 @@ echo_i "Checking for secondary's on disk copy of zone"
if [ ! -f ns2/root.bk ]
then
echo_i "failed";
status=`expr $status + 1`
status=$((status + 1))
fi
echo_i "Re-starting secondary"
@@ -296,7 +296,7 @@ if $test_fixed; then
diff dig.out.fixed dig.out.fixed.good || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
fi
#
@@ -307,12 +307,12 @@ ret=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
do
j=`expr $i % 4`
j=$((i % 4))
$DIGCMD @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic dig.out.$j
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
done
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
if [ $matches -ne 16 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
#
#
@@ -333,12 +333,12 @@ ret=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
do
j=`expr $i % 4`
j=$((i % 4))
$DIGCMD @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic2 dig.out.$j
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
done
diff dig.out.0 dig.out.1 >/dev/null && ret=1
@@ -349,7 +349,7 @@ diff dig.out.1 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 [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
echo_i "Checking order random (secondary loaded from disk)"
ret=0
@@ -371,12 +371,12 @@ done
match=0
for i in $GOOD_RANDOM
do
eval "match=\`expr \$match + \$match$i\`"
eval "match=\$((match + match$i))"
done
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
status=`expr $status + $ret`
status=$((status + ret))
echo_i "Checking order none (secondary loaded from disk)"
ret=0
@@ -391,7 +391,7 @@ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
diff dig.out.none dig.out.test$i >/dev/null || ret=1
done
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
done
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
fi
#
@@ -418,12 +418,12 @@ $DIGCMD @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=`expr $i % 4`
j=$((i % 4))
$DIGCMD @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic dig.out.$j
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
done
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
if [ $matches -ne 16 ]; then ret=1; 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
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=`expr $i % 4`
j=$((i % 4))
$DIGCMD @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
if [ $i -le 4 ]; then
cp dig.out.cyclic2 dig.out.$j
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
done
diff dig.out.0 dig.out.1 >/dev/null && ret=1
@@ -462,7 +462,7 @@ diff dig.out.1 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 [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
echo_i "Checking order random (cache)"
ret=0
@@ -484,10 +484,10 @@ done
match=0
for i in $GOOD_RANDOM
do
eval "match=\`expr \$match + \$match$i\`"
eval "match=\$((match + match$i))"
done
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
status=$((status + ret))
@@ -504,7 +504,7 @@ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
diff dig.out.none dig.out.test$i >/dev/null || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
echo_i "Checking default order (cache)"
ret=0
@@ -526,12 +526,12 @@ done
match=0
for i in $GOOD_RANDOM
do
eval "match=\`expr \$match + \$match$i\`"
eval "match=\$((match + match$i))"
done
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
status=`expr $status + $ret`
status=$((status + ret))
echo_i "Checking default order no match in rrset-order (cache)"
ret=0
@@ -546,7 +546,7 @@ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
diff dig.out.nomatch dig.out.test$i >/dev/null || ret=1
done
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
status=$((status + ret))
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1