From 98b3b5bba7b129815fce6c371d511807a03dbbb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Thu, 25 Jan 2018 15:26:27 +0100 Subject: [PATCH 1/2] Check for test interfaces before running system tests Prevent runall.sh and "make test" from even attempting to run system tests when "ifconfig.sh up" has not been run beforehand. This ensures the user is not flooded with error messages in such a case. (cherry picked from commit e0221f2d25a88fb0025070ef35463288114048ea) --- bin/tests/system/Makefile.in | 7 +++++++ bin/tests/system/testsummary.sh | 9 --------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/bin/tests/system/Makefile.in b/bin/tests/system/Makefile.in index f625b0cfec..7584ebb9a3 100644 --- a/bin/tests/system/Makefile.in +++ b/bin/tests/system/Makefile.in @@ -96,6 +96,13 @@ parallel.mk: # Targets to run the tests. test: parallel.mk subdirs + @if ! ${PERL} testsock.pl > /dev/null 2>&1; then \ + echo "I:NOTE: System tests were skipped because they require that the" ; \ + echo "I: IP addresses 10.53.0.1 through 10.53.0.8 be configured" ; \ + echo "I: as alias addresses on the loopback interface. Please run" ; \ + echo "I: \"bin/tests/system/ifconfig.sh up\" as root to configure them." ; \ + exit 1 ; \ + fi @$(MAKE) -f parallel.mk check @$(SHELL) ./runsequential.sh -r @$(SHELL) ./testsummary.sh diff --git a/bin/tests/system/testsummary.sh b/bin/tests/system/testsummary.sh index f7cd4569b4..b585a2f6f0 100644 --- a/bin/tests/system/testsummary.sh +++ b/bin/tests/system/testsummary.sh @@ -45,15 +45,6 @@ if [ $keepfile -eq 0 ]; then rm -f */test.output fi -$PERL testsock.pl || { - cat < Date: Sat, 24 Feb 2018 12:35:17 -0800 Subject: [PATCH 2/2] test interfaces directly in runall.sh and parallel.mk (cherry picked from commit a8b583e78ba2bda07953ba94ddd7d4128dba8a20) --- bin/tests/system/Makefile.in | 18 ++++++++++-------- bin/tests/system/runall.sh | 18 ++++++++++++++---- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/bin/tests/system/Makefile.in b/bin/tests/system/Makefile.in index 7584ebb9a3..54a42588c0 100644 --- a/bin/tests/system/Makefile.in +++ b/bin/tests/system/Makefile.in @@ -84,11 +84,20 @@ parallel.mk: @PARALLEL_SANITIZED=`echo $(PARALLEL) | sed "s|\([^ ][^ ]*\)|test-\1|g;" | tr _ -` ; \ echo ".PHONY: $$PARALLEL_SANITIZED" > $@ ; \ echo "" >> $@ ; \ + echo "check_interfaces:" >> $@ ; \ + echo " @${PERL} testsock.pl > /dev/null 2>&1 || { \\" >> $@ ; \ + echo " echo \"I:NOTE: System tests were skipped because they require that the\"; \\" >> $@ ; \ + echo " echo \"I: IP addresses 10.53.0.1 through 10.53.0.8 be configured\"; \\" >> $@ ; \ + echo " echo \"I: as alias addresses on the loopback interface. Please run\"; \\" >> $@ ; \ + echo " echo \"I: \"bin/tests/system/ifconfig.sh up\" as root to configure them.\"; \\" >> $@ ; \ + echo " exit 1; \\" >> $@ ; \ + echo " }" >> $@ ; \ + echo "" >> $@ ; \ echo "test check: $$PARALLEL_SANITIZED" >> $@ ; \ port=$${STARTPORT:-5000} ; \ for directory in $(PARALLEL) ; do \ echo "" >> $@ ; \ - echo "test-`echo $$directory | tr _ -`:" >> $@ ; \ + echo "test-`echo $$directory | tr _ -`: check_interfaces" >> $@ ; \ echo " @$(SHELL) ./run.sh -r -p $$port $$directory 2>&1 | tee $$directory/test.output" >> $@ ; \ port=`expr $$port + 100` ; \ done @@ -96,13 +105,6 @@ parallel.mk: # Targets to run the tests. test: parallel.mk subdirs - @if ! ${PERL} testsock.pl > /dev/null 2>&1; then \ - echo "I:NOTE: System tests were skipped because they require that the" ; \ - echo "I: IP addresses 10.53.0.1 through 10.53.0.8 be configured" ; \ - echo "I: as alias addresses on the loopback interface. Please run" ; \ - echo "I: \"bin/tests/system/ifconfig.sh up\" as root to configure them." ; \ - exit 1 ; \ - fi @$(MAKE) -f parallel.mk check @$(SHELL) ./runsequential.sh -r @$(SHELL) ./testsummary.sh diff --git a/bin/tests/system/runall.sh b/bin/tests/system/runall.sh index 9e343ec670..85d95614e7 100644 --- a/bin/tests/system/runall.sh +++ b/bin/tests/system/runall.sh @@ -77,10 +77,20 @@ if [ "$CYGWIN" = "" ]; then 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.) + # Running on Windows: no "make" available, so ensure test interfaces are up + # and then 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.) + $PERL testsock.pl || { + cat <<-EOF + I:NOTE: System tests were skipped because they require that the + I: IP addresses 10.53.0.1 through 10.53.0.8 be configured + I: as alias addresses on the loopback interface. Please run + I: "bin/tests/system/ifconfig.sh up" as root to configure them. + EOF + exit 1 + } { for testdir in $SUBDIRS; do $SHELL run.sh $testdir || status=1