]> 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)
committerEvan Hunt <each@isc.org>
Sun, 25 Feb 2018 04:04:41 +0000 (20:04 -0800)
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

(cherry picked from commit 7bb9a97904f1ecb1101f5bd4ed140c6d0b0f1634)
(cherry picked from commit c4f5d07c1c36418e54b6972a1099334415e52c6c)

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

index a9021e5b3fe1bd3fd2c97b8021dd49fa9c9b71cb..8d6b77d1f7507284c800f98d112bb06b737f32aa 100644 (file)
@@ -79,7 +79,7 @@ KRB5_CONFIG=/dev/null
 #
 # List of tests that use ports 5300 and 9953.  For this reason, these must
 # be run sequentially.
-SUBDIRS="acl additional addzone autosign builtin
+SEQUENTIALDIRS="acl additional addzone autosign builtin
         cacheclean case chain checkconf @CHECKDS@ checknames
         checkzone cookie @COVERAGE@ database digdelv dlv
         dlz dlzexternal dlzredir dns64 dnssec dsdigest
index 581034bd0bf122c4428c39967730e833f6e4f4cc..7085c3e6659d5d4cbc0f0457c108d8fa16ea27fb 100644 (file)
@@ -31,45 +31,45 @@ TOP=`cd $TOP && pwd`
 # Visual Studio build configurations are Release and Debug
 VSCONF=Debug
 
-NAMED=$TOP/Build/$VSCONF/named@EXEEXT@
-# We must use "named -l" instead of "lwresd" because argv[0] is lost
-# if the program is libtoolized.
-LWRESD="$TOP/Build/$VSCONF/named@EXEEXT@ -l"
-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@
+# We must use "named -l" instead of "lwresd" because argv[0] is lost
+# if the program is libtoolized.
+LWRESD="$TOP/Build/$VSCONF/named@EXEEXT@ -l"
+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@
 
@@ -91,17 +91,15 @@ 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
+SEQUENTIALDIRS="acl additional addzone autosign builtin cacheclean case
         checkconf @CHECKDS@ checknames checkzone cookie @COVERAGE@
-        database digdelv dlv dlvauto dlz dlzexternal
-        dns64 dnssec @DNSTAP@ dscp dsdigest dyndb ecdsa eddsa
-        ednscompliance emptyzones
+        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
         @KEYMGR@ legacy limits logfileconfig lwresd masterfile masterformat
         metadata mkeys names notify nslookup nsupdate nzd2nzf pending
         pipelined @PKCS11_TEST@ reclimit redirect resolver rndc rpz
-        rpzrecurse rrchecker rrl rrsetorder rsabigexponent runtime sfcache
+        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"
@@ -110,7 +108,7 @@ SEQUENTIALDIRS="acl additional addzone autosign builtin
 # 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 rpzrecurse"
 
 SUBDIRS="$SEQUENTIALDIRS $PARALLELDIRS"
 
@@ -167,40 +165,91 @@ 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
+}
+
+#
+# Useful functions in test scripts
+#
+
+# nextpart: read everything that's been appended to a file since the
+# last time 'nextpart' was called.
+nextpart () {
+    [ -f $1.prev ] || echo "0" > $1.prev
+    prev=`cat $1.prev`
+    awk "NR > $prev "'{ print }
+         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
 }
 
 #
index d0420696562b88fe8d4ef2e58ff03ef1166273d8..b2dbb4285c9a5b10a035ae95c6a9290e95eaee97 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
@@ -55,7 +61,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