]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use feature-test to detect feature support in system tests
authorTom Krizek <tkrizek@isc.org>
Thu, 1 Dec 2022 14:12:28 +0000 (15:12 +0100)
committerTom Krizek <tkrizek@isc.org>
Fri, 2 Dec 2022 09:23:51 +0000 (10:23 +0100)
Previously, there were two different ways to detect feature support.
Either through an environment variable set by configure in conf.sh, or
using the feature-test utility.

It is more simple and consistent to have only one way of detecting the
feature support. Using the feature-test utility seems superior the the
environment variables set by configure.

bin/tests/system/addzone/tests.sh
bin/tests/system/statschannel/tests.sh
bin/tests/system/synthfromdnssec/tests.sh

index 04135c7b0c792b8720dab6c5127a09762089b9f3..0f81eb761bd5bf7d65f071406fb80a49ffa3c3b1 100755 (executable)
@@ -45,7 +45,7 @@ n=`expr $n + 1`
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
-if [ -n "$NZD" ]; then
+if $FEATURETEST --with-lmdb; then
     echo_i "checking that existing NZF file was renamed after migration ($n)"
     [ -e ns2/3bf305731dd26307.nzf~ ] || ret=1
     n=`expr $n + 1`
@@ -124,7 +124,7 @@ n=`expr $n + 1`
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
-if [ -z "$NZD" ]; then
+if ! $FEATURETEST --with-lmdb; then
     echo_i "verifying no comments in NZF file ($n)"
     ret=0
     hcount=`grep "^# New zone file for view: _default" ns2/3bf305731dd26307.nzf | wc -l`
@@ -143,7 +143,7 @@ n=`expr $n + 1`
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
-if [ -n "$NZD" ]; then
+if $FEATURETEST --with-lmdb; then
     echo_i "checking zone is present in NZD ($n)"
     ret=0
     $NZD2NZF ns2/_default.nzd | grep previous.example > /dev/null || ret=1
@@ -169,14 +169,14 @@ check_nzd2nzf() (
        ! grep previous.example nzd2nzf.out.$n > /dev/null
 )
 
-if [ -n "$NZD" ]; then
+if $FEATURETEST --with-lmdb; then
     echo_i "checking zone was deleted from NZD ($n)"
     retry_quiet 10 check_nzd2nzf || ret=1
     if [ $ret != 0 ]; then echo_i "failed"; fi
     status=`expr $status + $ret`
 fi
 
-if [ -z "$NZD" ]; then
+if ! $FEATURETEST --with-lmdb; then
     echo_i "checking NZF file now has comment ($n)"
     ret=0
     hcount=`grep "^# New zone file for view: _default" ns2/3bf305731dd26307.nzf | wc -l`
@@ -512,7 +512,7 @@ n=`expr $n + 1`
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
-if [ -z "$NZD" ]; then
+if ! $FEATURETEST --with-lmdb; then
     echo_i "checking new NZF file has comment ($n)"
     ret=0
     hcount=`grep "^# New zone file for view: external" ns2/external.nzf | wc -l`
@@ -522,7 +522,7 @@ if [ -z "$NZD" ]; then
     status=`expr $status + $ret`
 fi
 
-if [ -n "$NZD" ]; then
+if $FEATURETEST --with-lmdb; then
     echo_i "verifying added.example in external view created an external.nzd DB ($n)"
     ret=0
     [ -e ns2/external.nzd ] || ret=1
@@ -548,7 +548,7 @@ status=`expr $status + $ret`
 
 echo_i "checking rndc showzone with newly added zone ($n)"
 _check_rndc_showzone_newly_added() (
-       if [ -z "$NZD" ]; then
+       if ! $FEATURETEST --with-lmdb; then
                expected='zone "added.example" in external { type primary; file "added.db"; };'
        else
                expected='zone "added.example" { type primary; file "added.db"; };'
@@ -655,7 +655,7 @@ n=`expr $n + 1`
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
-if [ -n "$NZD" ]; then
+if $FEATURETEST --with-lmdb; then
     echo_i "checking NZD file was created in new-zones-directory ($n)"
     expect=ns2/new-zones/directory.nzd
 else
index 7d102af3c6cf5fde0dbb4f5a4a52155579bfa4e2..7c871db27f965e946d867ef852f05be5f9f5b12d 100644 (file)
@@ -17,7 +17,7 @@
 DIGCMD="$DIG @10.53.0.2 -p ${PORT}"
 RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
 
-if [ ! "$HAVEJSONSTATS" ]
+if ! $FEATURETEST --have-json-c
 then
     unset PERL_JSON
     echo_i "JSON was not configured; skipping" >&2
@@ -29,7 +29,7 @@ else
     echo_i "JSON tests require JSON library; skipping" >&2
 fi
 
-if [ ! "$HAVEXMLSTATS" ]
+if ! $FEATURETEST --have-libxml2
 then
     unset PERL_XML
     echo_i "XML was not configured; skipping" >&2
@@ -139,7 +139,7 @@ ret=0
 if [ -x "${CURL}" ] ; then
     for i in 1 2 3 4 5; do
         ret=0
-        if [ "$HAVEXMLSTATS" ];
+        if $FEATURETEST --have-libxml2;
         then
             URL="http://10.53.0.2:${EXTRAPORT1}/xml/v3/server"
             filter_str='s#<current-time>.*</current-time>##g'
@@ -167,7 +167,7 @@ n=$((n + 1))
 
 ret=0
 echo_i "checking if compressed output is really compressed ($n)"
-if [ "$HAVEZLIB" ];
+if $FEATURETEST --with-zlib;
 then
     REGSIZE=`cat regular.headers | \
         grep -i Content-Length | sed -e "s/.*: \([0-9]*\).*/\1/"`
index aee907e2e0809f32638b390dc825de50103acf11..121e8ad4c91560f3164f34510ca6ab7fdd3a1094 100644 (file)
@@ -751,7 +751,7 @@ do
        echo_i "Skipping XML statistics checks"
    fi
 
-   if [ ${HAVEJSONSTATS} ] && [ -x "${CURL}" ] ; then
+   if $FEATURETEST --have-json-c && [ -x "${CURL}" ] ; then
        echo_i "getting JSON statisistcs for (synth-from-dnssec ${description};) ($n)"
        ret=0
        json=json.out$n