]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[rt46602] Allocate 100 ports to each test
authorStephen Morris <stephen@isc.org>
Thu, 14 Dec 2017 17:17:28 +0000 (17:17 +0000)
committerEvan Hunt <each@isc.org>
Sun, 25 Feb 2018 17:26:23 +0000 (09:26 -0800)
(cherry picked from commit edc7a18d844ea4aa40f5c60109c44bf9ef040163)
(cherry picked from commit 61514873e9a0daaa7c7a09fde269005218d59805)
(cherry picked from commit 21e33308d15b9ba1dbe4f467fa89b19e38b40ba1)

bin/tests/system/Makefile.in
bin/tests/system/README
bin/tests/system/run.sh

index 128463d6cb57bfff584d11dfa5d89b5a7a8ac232..f52d4a59c67d654ab78048f4e6eaabb74bca3139 100644 (file)
@@ -48,7 +48,7 @@ feature-test@EXEEXT@: feature-test.@O@
        ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ feature-test.@O@ ${ISCLIBS} ${LIBS}
 
 
-# Running the scripts below is bypassed when a separate build directory is
+# Running the scripts below is bypassed when a separate build directory is
 # used.
 
 # Define the tests that can be run in parallel.  This should be identical to
@@ -66,12 +66,12 @@ parallel.mk:
        @echo ".PHONY: $(PARALLEL)" > $@ ; \
        echo "" >> $@ ; \
        echo "check: $(PARALLEL)" >> $@ ; \
-       port=9990 ; \
+       port=$${STARTPORT:-5000} ; \
        for directory in $(PARALLEL) ; do \
-               port=$$(($$port + 10)) ; \
                echo "" >> $@ ; \
                echo "$$directory:" >> $@ ; \
                echo "  @$(SHELL) ./run.sh -p $$port $$directory" >> $@ ; \
+               port=`expr $$port + 100` ; \
        done
 
 # Targets to run the tests.
index abd79abff2ff614df5a4ddaf7de8531766a6b82b..2b3f40a19e26dd48933f85d0ce87981cb45eed35 100644 (file)
@@ -73,16 +73,18 @@ e.g.
 
 Optional flags are:
 
-    -p <number>     Sets the range of ports used by the test.  A block of 10
+    -p <number>     Sets the range of ports used by the test.  A block of 100
                     ports is available for each test, the number given to the
                     "-p" switch being the number of the start of that block
                     (e.g.  "-p 7900" will mean that the test is able to use
-                    ports 7900 through 7909).  If not specified, the test will
-                    use ports 5300 to 5309.
+                    ports 7900 through 7999).  If not specified, the test will
+                    have ports 5000 to 5099 available to it.
+
     -n              Noclean - do not remove the output files if the test
                     completes successfully.  By default, files created by the
                     test are deleted if it passes;  they are not deleted if the
                     test fails.
+
     -k              Keep servers running after the test completes.  Each test
                     usually starts a number of nameservers, either instances
                     of the "named" being tested, or custom servers (written in
@@ -92,6 +94,7 @@ Optional flags are:
                     at the end of the test, so that additional queries can be
                     sent by hand.  To stop the servers afterwards, use the
                     command "sh stop.sh <test-name>".
+
     -d <arg>        Arguments to the "date" command used to produce the
                     start and end time of the tests.  For example, the
                     switch
@@ -121,11 +124,36 @@ or
 When running all the tests, the output is sent to the file systests.output
 (in the bin/tests/system) directory.
 
-The "numproc" option specifies the maximum number of tests that can run
-simultaneously.  The default is 1, which means that all of the tests run
-sequentially. If greater than 1, up to "numproc" tests will run simultaneously.
-(Each will use a unique set of ports, so there is no danger of them interfering
-with one another.)
+The "numproc" option specifies the maximum number of tests that can run in
+parallel.  The default is 1, which means that all of the tests run
+sequentially. If greater than 1, up to "numproc" tests will run simultaneously,
+new tests being started as tests finish. Each test will get a unique set of
+ports, so there is no danger of tests interfering with one another.
+
+It is also possible to run the test suites from two installations of BIND on
+the same machine at the same time.  To to this:
+
+1. Each installation must have its own directory tree. The system tests create
+temporary configuration files in the test directories, so separate directory
+trees are required to avoid interference between the same test running in the
+different installations.
+
+2. For one of the test suites, the starting port number must be specified by
+setting the environment variable STARTPORT before starting the test suite.
+Each test suite comprises about 100 tests, each being allocated a set of 100
+ports.  The port ranges are allocated in sequence, so each test suite requires
+about 10,000 ports to itself.  By default, the port allocation starts at 5,000.
+So the following set of commands:
+
+    cd <installation-1>/bin/tests/system
+    sh run.sh 4
+    cd <installation-2>/bin/tests/system
+    STARTPORT=20000 sh run.sh 4
+
+... will start the test suite for installation-1 using the default base port
+of 5,000, so the test suite will use ports 5,000 through 15,000 (or there
+abouts).  The use of "STARTPORT=20000" to prefix the run of the test suite for
+installation-2 will mean the test suite uses ports 20,000 through 30,000 or so.
 
 Parallel running will reduce the total time taken to run the BIND system tests,
 but will mean that the output from all the tests will be mixed up with one
@@ -328,10 +356,6 @@ configured with the appropriate options required.
     * If there is some other problem (e.g. prerequistie software is available
       but is not properly configured), a status code of 255 should be returned.
 
-prereq.sh will be invoked using the '-p <baseport> -- "$@"' form described in
-the previous section.
-
-
 setup.sh
 ---
 This is responsible for setting up the configuration files used in the test.
@@ -425,7 +449,7 @@ clean.sh
 ---
 The inverse of "setup.sh", this is invoked by the framework to clean up the
 test directory.  It should delete all files that have been created by the test
-during its run (including the "named.port" files mentioned earlier).
+during its run.
 
 
 Adding a Test to the System Test Suite
@@ -460,7 +484,7 @@ the form:
         @$(SHELL) run.sh -p <baseport> <test-name>
 
 The <baseport> is unique and the values of <baseport> for each test are
-separated by at least 10 ports.
+separated by at least 100 ports.
 
 
 Valgrind
index 1b4b9db487ec71c288e4529fb9bed8c82d62fa71..e5e35e84740f350dbb4beb4527145f1e107fe7ce 100644 (file)
@@ -36,7 +36,7 @@ while getopts "knp:d:" flag; do
        *) exit 1 ;;
     esac
 done
-shift $(($OPTIND - 1))
+shift `expr $OPTIND - 1`
 OPTIND=1
 
 test $# -gt 0 || { echo "usage: $0 [-k|-n|-p <PORT>] test-directory" >&2; exit 1; }
@@ -46,14 +46,16 @@ shift
 
 test -d $test || { echofail "$0: $test: no such test" >&2; exit 1; }
 
-# Define the number of ports allocated for this test, and the lowest and
-# highest valid values for the "-p" option.  The lowest valid value is one more
-# than the highest privileged port (1024).  As the number specifies the lowest
-# port number in a block of ports, the highest valid value is such that the
-# highest port number in that block is 65535.
+# Define the number of ports allocated for each test, and the lowest and
+# highest valid values for the "-p" option.
 #
-# N.B.  It is assumed that the number of ports is >= 10.
-numport=10
+# The lowest valid value is one more than the highest privileged port number
+# (1024).
+#
+# The highest valid value is calculated by noting that the value passed on the
+# command line is the lowest port number in a block of "numports" consecutive
+# ports and that the highest valid port number is 65,535.
+numport=100
 minvalid=`expr 1024 + 1`
 maxvalid=`expr 65535 - $numport + 1`
 
@@ -62,14 +64,15 @@ if [ $? -ne 0 ]; then
     echofail "Must specify a numeric value for the port"
     exit 1
 elif [ $baseport -lt $minvalid -o $baseport -gt $maxvalid  ]; then
-    echofail "The port must be in the range $minvalid to $maxvalid" >&2
+    echofail "Tte specified port must be in the range $minvalid to $maxvalid" >&2
     exit 1
 fi
 
-# Name the first 10 ports in the set: the query port, the control port and
-# eight extra ports.  Since the lowest numbered port (specified in the command
-# line) will usually be a multiple of 10, the names are chosen so that the
-# number of EXTRAPORTn is "n".
+# Name the first 10 ports in the set (it is assumed that each test has access
+# to ten or more ports): the query port, the control port and eight extra
+# ports.  Since the lowest numbered port (specified in the command line)
+# will usually be a multiple of 10, the names are chosen so that if this is
+# true, the last digit of EXTRAPORTn is "n".
 export PORT=$baseport
 export EXTRAPORT1=`expr $baseport + 1`
 export EXTRAPORT2=`expr $baseport + 2`