]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Allow retaining system test output using an environment variable
authorMichał Kępień <michal@isc.org>
Wed, 21 Feb 2018 13:59:33 +0000 (14:59 +0100)
committerEvan Hunt <each@isc.org>
Sun, 25 Feb 2018 21:34:35 +0000 (13:34 -0800)
Instead of exporting an environment variable containing a command line
argument (NOCLEAN="-n"), extend run.sh to handle a "boolean" environment
variable (SYSTEMTEST_NO_CLEAN) itself.  The former method is buggy
because the value of NOCLEAN is set in parallel.mk when that file is
first created, but it is not subsequently updated upon each test run
(because make considers parallel.mk to be up to date).

To retain backward compatibility, the "-n" command line argument for
run.sh is still supported (and has a higher priority than the relevant
environment variable).

The SYSTEMTEST_NO_CLEAN environment variable can also be used directly
to prevent cleanup when using "make test" instead of runall.sh.

Apart from fixing a bug, this simplifies the way runall.sh controls
run.sh behavior due to the Makefile being bypassed.  Direct processing
of environment variables in run.sh is more scalable in the long run,
given that the previously utilized technique, even with its
implementation fixed, would still require Makefile.in to be modified in
two places each time a new flag needed to be passed from runall.sh to
run.sh.

(cherry picked from commit 3862043879534542a75e40d5e6c0cc09f37f8d6b)
(cherry picked from commit e9c4dbe36147c6ae16dd353793eb7d376ff622a7)
(cherry picked from commit 0e3840e4b4f883fefec42b4b2d369aefd36036f4)

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

index 5a06e8e6a926d4152d4bd8c315b2ce9c89fdc8e9..83e28655e841ed2fa189a440882f9b8f039ddd00 100644 (file)
@@ -122,7 +122,7 @@ parallel.mk:
        for directory in $(PARALLEL) ; do \
                echo "" >> $@ ; \
                echo "test-`echo $$directory | tr _ -`:" >> $@ ; \
-               echo "  @$(SHELL) ./run.sh $$NOCLEAN -r -p $$port $$directory 2>&1 | tee $$directory/test.output" >> $@ ; \
+               echo "  @$(SHELL) ./run.sh -r -p $$port $$directory 2>&1 | tee $$directory/test.output" >> $@ ; \
                port=`expr $$port + 100` ; \
        done
 
@@ -130,7 +130,7 @@ parallel.mk:
 
 test: parallel.mk subdirs
        @$(MAKE) -f parallel.mk check
-       @$(SHELL) ./runsequential.sh $$NOCLEAN -r
+       @$(SHELL) ./runsequential.sh -r
        @$(SHELL) ./testsummary.sh
 
 check: test
index 56a15593f0008f05667dfcdfc4b8ba9ba2ea054c..e696ab62b4457bb0d3edaa43bad9e25f13ad8387 100644 (file)
@@ -149,10 +149,10 @@ A run of all the system tests can also be initiated via make:
     make [-j numproc] test
 
 In this case, retention of the output files after a test completes successfully
-is specified by setting the environment variable NOCLEAN to "-n" prior to
-running make, e.g.
+is specified by setting the environment variable SYSTEMTEST_NO_CLEAN to 1 prior
+to running make, e.g.
 
-    NOCLEAN=-n make [-j numproc] test
+    SYSTEMTEST_NO_CLEAN=1 make [-j numproc] test
 
 
 
@@ -710,7 +710,7 @@ the ports are assigned when the tests are run.  This is achieved by having the
 when "make check" is run, and contains a target for each test of the form:
 
     <test-name>:
-        @$(SHELL) run.sh $$NOCLEAN -r -p <baseport> <test-name>
+        @$(SHELL) run.sh -r -p <baseport> <test-name>
 
 The <baseport> is unique and the values of <baseport> for each test are
 separated by at least 100 ports.
index ce73443c83c63c62dbf138751a324d2ef0442cbb..4ed22bb2c1f98d1d60a8a66d00b3c6bb960a6961 100644 (file)
@@ -23,9 +23,14 @@ SYSTEMTESTTOP=.
 . $SYSTEMTESTTOP/conf.sh
 
 stopservers=true
-clean=true
 baseport=5300
 
+if [ ${SYSTEMTEST_NO_CLEAN:-0} -eq 1 ]; then
+       clean=false
+else
+       clean=true
+fi
+
 while getopts "knp:r" flag; do
     case "$flag" in
        k) stopservers=false ;;
index 2105d3893a60ec6a50e045cd5a4e95b0eef637cc..150047e36bff0a755a29f83c38ae7f9ca009569b 100644 (file)
@@ -31,12 +31,13 @@ SYSTEMTESTTOP=.
 
 usage="Usage: ./runall.sh [-n] [numprocesses]"
 
+SYSTEMTEST_NO_CLEAN=0
+
 # Handle "-n" switch if present.
 
-NOCLEAN=""
 while getopts "n" flag; do
     case "$flag" in
-        n) NOCLEAN="-n" ;;
+        n) SYSTEMTEST_NO_CLEAN=1 ;;
     esac
 done
 export NOCLEAN
@@ -61,6 +62,8 @@ fi
 
 # Run the tests.
 
+export SYSTEMTEST_NO_CLEAN
+
 status=0
 if [ "$CYGWIN" = "" ]; then
     # Running on Unix, use "make" to run tests in parallel.
@@ -73,7 +76,7 @@ else
     # used, the tests would be run sequentially anyway.)
     {
         for testdir in $SUBDIRS; do
-            $SHELL run.sh $NOCLEAN $testdir || status=1
+            $SHELL run.sh $testdir || status=1
         done
     } 2>&1 | tee "systests.output"
 fi