Allow retaining system test output using an environment variable

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.
This commit is contained in:
Michał Kępień
2018-02-21 14:59:33 +01:00
parent 643c8c27ff
commit 3862043879
4 changed files with 18 additions and 10 deletions

View File

@@ -151,10 +151,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
@@ -712,7 +712,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.