]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Replace expr commands with $((expression)) shell constucts
authorAram Sargsyan <aram@isc.org>
Wed, 20 Jul 2022 13:21:27 +0000 (13:21 +0000)
committerAram Sargsyan <aram@isc.org>
Fri, 19 Aug 2022 08:11:44 +0000 (08:11 +0000)
Update the "statschannel" system test to use the $((expression))
shell constucts instead of executing the `expr` program.

bin/tests/system/statschannel/tests.sh

index a247ef48826444188336096b33d4a28cd8eaa680..5485a5cbbf9cabae0e2756ad1f242ad390c142e0 100644 (file)
@@ -110,8 +110,8 @@ if [ $PERL_JSON ]; then
     [ "$noerror_count" -eq "$json_noerror_count" ] || ret=1
 fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
-n=`expr $n + 1`
+status=$((status + ret))
+n=$((n + 1))
 
 ret=0
 echo_i "checking malloced memory statistics xml/json ($n)"
@@ -131,8 +131,8 @@ if [ $PERL_JSON ]; then
     grep '"Malloced":[0-9][0-9]*,' json.mem > /dev/null || ret=1
 fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
-n=`expr $n + 1`
+status=$((status + ret))
+n=$((n + 1))
 
 echo_i "checking consistency between regular and compressed output ($n)"
 for i in 1 2 3 4 5; do
@@ -158,8 +158,8 @@ for i in 1 2 3 4 5; do
        fi
 done
 
-status=`expr $status + $ret`
-n=`expr $n + 1`
+status=$((status + ret))
+n=$((n + 1))
 
 ret=0
 echo_i "checking if compressed output is really compressed ($n)"
@@ -169,15 +169,15 @@ then
        grep -i Content-Length | sed -e "s/.*: \([0-9]*\).*/\1/"`
     COMPSIZE=`cat compressed.headers | \
        grep -i Content-Length | sed -e "s/.*: \([0-9]*\).*/\1/"`
-    if [ ! `expr $REGSIZE / $COMPSIZE` -gt 2 ]; then
+    if [ ! $((REGSIZE / COMPSIZE)) -gt 2 ]; then
        ret=1
     fi
 else
     echo_i "skipped"
 fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
-n=`expr $n + 1`
+status=$((status + ret))
+n=$((n + 1))
 
 # Test dnssec sign statistics.
 zone="dnssec"
@@ -208,8 +208,8 @@ if [ $PERL_JSON ]; then
     cmp zones.out.j$n zones.expect.$n || ret=1
 fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
-n=`expr $n + 1`
+status=$((status + ret))
+n=$((n + 1))
 
 # Test sign operations after dynamic update.
 ret=0
@@ -238,8 +238,8 @@ if [ $PERL_JSON ]; then
     cmp zones.out.j$n zones.expect.$n || ret=1
 fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
-n=`expr $n + 1`
+status=$((status + ret))
+n=$((n + 1))
 
 # Test sign operations of KSK.
 ret=0
@@ -265,8 +265,8 @@ if [ $PERL_JSON ]; then
     cmp zones.out.j$n zones.expect.$n || ret=1
 fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
-n=`expr $n + 1`
+status=$((status + ret))
+n=$((n + 1))
 
 # Test sign operations for scheduled resigning (many keys).
 ret=0
@@ -306,8 +306,8 @@ if [ $PERL_JSON ]; then
     cmp zones.out.j$n zones.expect.$n || ret=1
 fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
-n=`expr $n + 1`
+status=$((status + ret))
+n=$((n + 1))
 
 # Test sign operations after dynamic update (many keys).
 ret=0
@@ -344,8 +344,8 @@ if [ $PERL_JSON ]; then
     cmp zones.out.j$n zones.expect.$n || ret=1
 fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
-n=`expr $n + 1`
+status=$((status + ret))
+n=$((n + 1))
 
 # Test sign operations after dnssec-policy change (removing keys).
 ret=0
@@ -373,8 +373,8 @@ if [ $PERL_JSON ]; then
     cmp zones.out.j$n zones.expect.$n || ret=1
 fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
-n=`expr $n + 1`
+status=$((status + ret))
+n=$((n + 1))
 
 if [ -x "${NC}" ] ; then
     echo_i "Check HTTP/1.1 pipelined requests are handled ($n)"
@@ -391,8 +391,8 @@ EOF
     lines=$(grep "^HTTP/1.1" nc.out$n | wc -l)
     test $lines = 2 || ret=1
     if [ $ret != 0 ]; then echo_i "failed"; fi
-    status=`expr $status + $ret`
-    n=`expr $n + 1`
+    status=$((status + ret))
+    n=$((n + 1))
 else
     echo_i "skipping test as nc not found"
 fi
@@ -421,8 +421,8 @@ test $((time2 - time1)) -lt 5 || ret=1
 lines=$(grep "^HTTP/1.1" send.out$n | wc -l)
 test $lines = 91 || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
-n=`expr $n + 1`
+status=$((status + ret))
+n=$((n + 1))
 
 echo_i "exit status: $status"
 [ $status -eq 0 ] || exit 1