]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[rt46602] Changes to get tests running on Windows
authorStephen Morris <stephen@isc.org>
Fri, 26 Jan 2018 19:42:57 +0000 (19:42 +0000)
committerStephen Morris <stephen@isc.org>
Fri, 16 Feb 2018 16:14:41 +0000 (16:14 +0000)
1. Track changes to conf.sh.in in conf.sh.win32
2. Modifications to prevent Windows "Configure" script replacing
   the sed "@PORT@" substitution tokens in conf.sh.win32.
3. runall.sh now runs Windows tests sequentially

bin/tests/system/conf.sh.win32
bin/tests/system/runall.sh

index 2fd9fafa1d753acccd6199472b0859f5248a8755..a41214be6f6f6c1ab9b6aa8b36ff92c206c24460 100644 (file)
@@ -23,42 +23,42 @@ TOP=`cd $TOP && pwd`
 # Visual Studio build configurations are Release and Debug
 VSCONF=Debug
 
-NAMED=$TOP/Build/$VSCONF/named@EXEEXT@
-DIG=$TOP/Build/$VSCONF/dig@EXEEXT@
-DELV=$TOP/Build/$VSCONF/delv@EXEEXT@
-RNDC=$TOP/Build/$VSCONF/rndc@EXEEXT@
-NSUPDATE=$TOP/Build/$VSCONF/nsupdate@EXEEXT@
+ARPANAME=$TOP/Build/$VSCONF/arpaname@EXEEXT@
+CHECKCONF=$TOP/Build/$VSCONF/named-checkconf@EXEEXT@
+CHECKDS="$PYTHON `cygpath -w $TOP/bin/python/dnssec-checkds.py`"
+CHECKZONE=$TOP/Build/$VSCONF/named-checkzone@EXEEXT@
+COVERAGE="$PYTHON `cygpath -w $TOP/bin/python/dnssec-coverage.py`"
 DDNSCONFGEN=$TOP/Build/$VSCONF/ddns-confgen@EXEEXT@
-TSIGKEYGEN=$TOP/Build/$VSCONF/tsig-keygen@EXEEXT@
-RNDCCONFGEN=$TOP/Build/$VSCONF/rndc-confgen@EXEEXT@
-KEYGEN=$TOP/Build/$VSCONF/dnssec-keygen@EXEEXT@
-KEYFRLAB=$TOP/Build/$VSCONF/dnssec-keyfromlabel@EXEEXT@
-SIGNER=$TOP/Build/$VSCONF/dnssec-signzone@EXEEXT@
-REVOKE=$TOP/Build/$VSCONF/dnssec-revoke@EXEEXT@
-SETTIME=$TOP/Build/$VSCONF/dnssec-settime@EXEEXT@
+DELV=$TOP/Build/$VSCONF/delv@EXEEXT@
+DIG=$TOP/Build/$VSCONF/dig@EXEEXT@
+DNSTAPREAD=$TOP/Build/$VSCONF/dnstap-read@EXEEXT@
 DSFROMKEY=$TOP/Build/$VSCONF/dnssec-dsfromkey@EXEEXT@
+FEATURETEST=$TOP/Build/$VSCONF/feature-test@EXEEXT@
+FSTRM_CAPTURE=@FSTRM_CAPTURE@
+GENRANDOM=$TOP/Build/$VSCONF/genrandom@EXEEXT@
 IMPORTKEY=$TOP/Build/$VSCONF/dnssec-importkey@EXEEXT@
-CHECKDS="$PYTHON `cygpath -w $TOP/bin/python/dnssec-checkds.py`"
-COVERAGE="$PYTHON `cygpath -w $TOP/bin/python/dnssec-coverage.py`"
+JOURNALPRINT=$TOP/Build/$VSCONF/named-journalprint@EXEEXT@
+KEYFRLAB=$TOP/Build/$VSCONF/dnssec-keyfromlabel@EXEEXT@
+KEYGEN=$TOP/Build/$VSCONF/dnssec-keygen@EXEEXT@
 KEYMGR="$PYTHON `cygpath -w $TOP/bin/python/dnssec-keymgr.py`"
-CHECKZONE=$TOP/Build/$VSCONF/named-checkzone@EXEEXT@
-CHECKCONF=$TOP/Build/$VSCONF/named-checkconf@EXEEXT@
+MDIG=$TOP/Build/$VSCONF/mdig@EXEEXT@
+NAMED=$TOP/Build/$VSCONF/named@EXEEXT@
+NSLOOKUP=$TOP/Build/$VSCONF/nslookup@EXEEXT@
+NSUPDATE=$TOP/Build/$VSCONF/nsupdate@EXEEXT@
+NZD2NZF=$TOP/Build/$VSCONF/named-nzd2nzf@EXEEXT@
+PK11DEL="$TOP/Build/$VSCONF/pkcs11-destroy@EXEEXT@ -s ${SLOT:-0} -p ${HSMPIN:-1234} -w 0"
 PK11GEN="$TOP/Build/$VSCONF/pkcs11-keygen@EXEEXT@ -q -s ${SLOT:-0} -p ${HSMPIN:-1234}"
 PK11LIST="$TOP/Build/$VSCONF/pkcs11-list@EXEEXT@ -s ${SLOT:-0} -p ${HSMPIN:-1234}"
-PK11DEL="$TOP/Build/$VSCONF/pkcs11-destroy@EXEEXT@ -s ${SLOT:-0} -p ${HSMPIN:-1234} -w 0"
-JOURNALPRINT=$TOP/Build/$VSCONF/named-journalprint@EXEEXT@
-VERIFY=$TOP/Build/$VSCONF/dnssec-verify@EXEEXT@
-ARPANAME=$TOP/Build/$VSCONF/arpaname@EXEEXT@
 RESOLVE=$TOP/lib/samples/resolve
+REVOKE=$TOP/Build/$VSCONF/dnssec-revoke@EXEEXT@
+RNDC=$TOP/Build/$VSCONF/rndc@EXEEXT@
+RNDCCONFGEN=$TOP/Build/$VSCONF/rndc-confgen@EXEEXT@
 RRCHECKER=$TOP/Build/$VSCONF/named-rrchecker@EXEEXT@
-GENRANDOM=$TOP/Build/$VSCONF/genrandom@EXEEXT@
-NSLOOKUP=$TOP/Build/$VSCONF/nslookup@EXEEXT@
-DNSTAPREAD=$TOP/Build/$VSCONF/dnstap-read@EXEEXT@
-MDIG=$TOP/Build/$VSCONF/mdig@EXEEXT@
-NZD2NZF=$TOP/Build/$VSCONF/named-nzd2nzf@EXEEXT@
-FSTRM_CAPTURE=@FSTRM_CAPTURE@
-FEATURETEST=$TOP/Build/$VSCONF/feature-test@EXEEXT@
 SAMPLEUPDATE=$TOP/Build/$VSCONF/update@EXEEXT@
+SETTIME=$TOP/Build/$VSCONF/dnssec-settime@EXEEXT@
+SIGNER=$TOP/Build/$VSCONF/dnssec-signzone@EXEEXT@
+TSIGKEYGEN=$TOP/Build/$VSCONF/tsig-keygen@EXEEXT@
+VERIFY=$TOP/Build/$VSCONF/dnssec-verify@EXEEXT@
 
 # to port WIRETEST=$TOP/Build/$VSCONF/wire_test@EXEEXT@
 
@@ -82,27 +82,27 @@ KRB5_CONFIG=NUL
 #
 # List of tests that use ports 5300 and 9953.  For this reason, these must
 # be run sequentially.
-SEQUENTIALDIRS="acl additional addzone autosign builtin
-        cacheclean case catz
-        checkconf @CHECKDS@ checknames checkzone cookie @COVERAGE@
-        database digdelv dlv dlvauto dlz dlzexternal dname
-        dns64 dnssec @DNSTAP@ dscp dsdigest dyndb ecdsa eddsa
-        ednscompliance emptyzones
-        fetchlimit filter-aaaa formerr forward geoip glue gost inline ixfr
-        keepalive @KEYMGR@ legacy limits logfileconfig masterfile
-        masterformat metadata mkeys names notify nslookup nsupdate
-        nzd2nzf padding pending pipelined @PKCS11_TEST@ reclimit
-        redirect resolver rndc rpz rrchecker rrl
-        rrsetorder rsabigexponent runtime sfcache smartsign sortlist
-        spf staticstub statistics statschannel stub tcp tkey tsig
-        tsiggss unknown upforwd verify views wildcard xfer xferquota
+SEQUENTIALDIRS="acl additional addzone autosign builtin \
+        cacheclean case \
+        checkconf @CHECKDS@ checknames checkzone cookie @COVERAGE@ \
+        database digdelv dlv dlvauto dlz dlzexternal dname \
+        dns64 dnssec @DNSTAP@ dscp dsdigest dyndb ecdsa eddsa \
+        ednscompliance emptyzones \
+        fetchlimit filter-aaaa formerr forward geoip glue gost inline ixfr \
+        keepalive @KEYMGR@ legacy limits logfileconfig masterfile \
+        masterformat metadata mkeys names notify nslookup nsupdate \
+        nzd2nzf padding pending pipelined @PKCS11_TEST@ reclimit \
+        redirect resolver rndc rpz rrchecker rrl \
+        rrsetorder rsabigexponent runtime sfcache smartsign sortlist \
+        spf staticstub statistics statschannel stub tcp tkey tsig \
+        tsiggss unknown upforwd verify views wildcard xfer xferquota \
         zero zonechecks"
 
 # List of tests that use unique ports (other than 5300 and 9953). These
 # tests can be run in parallel.
 #
 # This symbol must be kept in step with the PARALLEL macro in Makefile.in
-PARALLELDIRS="allow_query rpzrecurse serve-stale"
+PARALLELDIRS="allow_query catz rpzrecurse serve-stale"
 
 SUBDIRS="$SEQUENTIALDIRS $PARALLELDIRS"
 
@@ -163,40 +163,49 @@ NZD=@NZD_TOOLS@
 # Set up color-coded test output
 #
 if test -t 1 && type tput > /dev/null; then
+    COLOR_END=`tput setaf 4`    # blue
     COLOR_FAIL=`tput setaf 1`   # red
-    COLOR_WARN=`tput setaf 3`   # yellow
-    COLOR_PASS=`tput setaf 2`   # green
     COLOR_INFO=`tput bold`      # bold
     COLOR_NONE=`tput sgr0`
+    COLOR_PASS=`tput setaf 2`   # green
+    COLOR_START=`tput setaf 4`  # blue
+    COLOR_WARN=`tput setaf 3`   # yellow
 else
     # set to empty strings so printf succeeds
+    COLOR_END=''
     COLOR_FAIL=''
-    COLOR_WARN=''
-    COLOR_PASS=''
     COLOR_INFO=''
     COLOR_NONE=''
+    COLOR_PASS=''
+    COLOR_START=''
+    COLOR_WARN=''
 fi
 
 echofail () {
         printf "${COLOR_FAIL}%s${COLOR_NONE}\n" "$*"
 }
-
 echowarn () {
         printf "${COLOR_WARN}%s${COLOR_NONE}\n" "$*"
 }
-
 echopass () {
         printf "${COLOR_PASS}%s${COLOR_NONE}\n" "$*"
 }
-
 echoinfo () {
         printf "${COLOR_INFO}%s${COLOR_NONE}\n" "$*"
 }
+echostart () {
+        printf "${COLOR_START}%s${COLOR_NONE}\n" "$*"
+}
+echoend () {
+        printf "${COLOR_END}%s${COLOR_NONE}\n" "$*"
+}
 
 TESTNAME="`basename $PWD`"
 
 echo_i() {
-    echoinfo "I:$TESTNAME:$@"
+    echo "$@" | while read LINE ; do
+       echoinfo "I:$TESTNAME:$LINE"
+    done
 }
 
 #
@@ -212,6 +221,35 @@ nextpart () {
          END          { print NR > "/dev/stderr" }' $1 2> $1.prev
 }
 
+# copy_setports - Copy Configuration File and Replace Ports
+#
+# Convenience function to copy a configuration file, replacing the tokens
+# QUERYPORT, CONTROLPORT and EXTRAPORT[1-8] with the values of the equivalent
+# environment variables. (These values are set by "run.sh", which calls the
+# scripts invoking this function.)
+#
+# Usage:
+#   copy_setports infile outfile
+
+copy_setports() {
+    # The indirect method of handling the substitution of the PORT variables
+    # (defining "atsign" then substituting for it in the "sed" statement) is
+    # required because to prevent the "Configure" script (in the the
+    # bin9/win32utils directory) replacing the the <at>PORT<at> substitution
+    # tokens when it processes this file and produces conf.sh.
+    atsign="@"
+    sed -e "s/${atsign}PORT${atsign}/${PORT}/g" \
+        -e "s/${atsign}EXTRAPORT1${atsign}/${EXTRAPORT1}/g" \
+        -e "s/${atsign}EXTRAPORT2${atsign}/${EXTRAPORT2}/g" \
+        -e "s/${atsign}EXTRAPORT3${atsign}/${EXTRAPORT3}/g" \
+        -e "s/${atsign}EXTRAPORT4${atsign}/${EXTRAPORT4}/g" \
+        -e "s/${atsign}EXTRAPORT5${atsign}/${EXTRAPORT5}/g" \
+        -e "s/${atsign}EXTRAPORT6${atsign}/${EXTRAPORT6}/g" \
+        -e "s/${atsign}EXTRAPORT7${atsign}/${EXTRAPORT7}/g" \
+        -e "s/${atsign}EXTRAPORT8${atsign}/${EXTRAPORT8}/g" \
+        -e "s/${atsign}CONTROLPORT${atsign}/${CONTROLPORT}/g" $1 > $2
+}
+
 #
 # Export command paths
 #
index f5f9b87db386bab333f9077979356fb092ffca5a..ad2a825c2e9a4c384443672088783396dc616410 100644 (file)
 #
 #   numprocess  Number of concurrent processes to use when running the tests.
 #               The default is one, which causes the tests to run sequentially.
+#               (This is ignored when running on Windows as the tests are always
+#               run sequentially on that platform.)
 
 SYSTEMTESTTOP=.
 . $SYSTEMTESTTOP/conf.sh
 
 usage="Usage: ./runall.sh [-n] [numprocesses]"
 
-NOCLEAN=""
+# Handle "-n" switch if present.
 
+NOCLEAN=""
 while getopts "n" flag; do
     case "$flag" in
-       n) NOCLEAN="-n" ;;
+        n) NOCLEAN="-n" ;;
     esac
 done
+export NOCLEAN
 shift `expr $OPTIND - 1`
 
+# Obtain number of processes to use.
+
 if [ $# -eq 0 ]; then
     numproc=1
 elif [ $# -eq 1 ]; then
@@ -46,7 +52,22 @@ else
     exit 1
 fi
 
-export NOCLEAN
-make -j $numproc check
+# Run the tests.
 
-exit $?
+status=0
+if [ "$CYGWIN" = "" ]; then
+    # Running on Unix, use "make" to run tests in parallel.
+    make -j $numproc check
+    status=$?
+else
+    # Running on Windows: no "make" available, so run the tests sequentially.
+    # (This is simpler than working out where "nmake" is likely to be found.
+    # Besides, "nmake" does not support parallel execution so if "nmake" is
+    # used, the tests would be run sequentially anyway.)
+    {
+        for testdir in $SUBDIRS; do
+            $SHELL run.sh $NOCLEAN $testdir || status=1
+        done
+    } 2>&1 | tee "systests.output"
+fi
+exit $status