From: Ben Pfaff Date: Wed, 24 Feb 2016 23:42:24 +0000 (-0800) Subject: tests: Add ability to automatically rerun failed tests. X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=0d3f215202191016792b9c7c37d6a6b7e2d57234 tests: Add ability to automatically rerun failed tests. A lot of packaging was doing this already, so this simplifies their implementation. Signed-off-by: Ben Pfaff Acked-by: Andy Zhou --- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 086b6e8b4..6f69cfff0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,8 +29,9 @@ In particular: Testing is also important: - - A patch that modifies existing code should be tested with - `make check` before submission. + - A patch that modifies existing code should be tested with `make + check` before submission. Please see INSTALL.md, under + "Self-Tests", for more information. - A patch that adds or deletes files should also be tested with `make distcheck` before submission. diff --git a/INSTALL.md b/INSTALL.md index dd4d9651a..9c96bbe0f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -525,7 +525,10 @@ valgrind results are easier to interpret if you put "-q" in Sometimes a few tests may fail on some runs but not others. This is usually a bug in the testsuite, not a bug in Open vSwitch itself. If you find that a test fails intermittently, please report it, since the -developers may not have noticed. +developers may not have noticed. You can make the testsuite +automatically rerun tests that fail, by adding RECHECK=yes to the +"make" command line, e.g.: + `make check TESTSUITEFLAGS=-j8 RECHECK=yes` OFTest ------ diff --git a/debian/rules b/debian/rules index cc17cd0fe..2a70bd63f 100755 --- a/debian/rules +++ b/debian/rules @@ -34,8 +34,7 @@ override_dh_auto_configure: override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) - if $(MAKE) check TESTSUITEFLAGS='$(PARALLEL)' || \ - $(MAKE) check TESTSUITEFLAGS='--recheck'; then :; \ + if $(MAKE) check TESTSUITEFLAGS='$(PARALLEL)' RECHECK=yes; then :; \ else \ cat tests/testsuite.log; \ exit 1; \ diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in index 34d871272..9052354ba 100644 --- a/rhel/openvswitch-fedora.spec.in +++ b/rhel/openvswitch-fedora.spec.in @@ -184,8 +184,7 @@ rm -f $RPM_BUILD_ROOT%{_bindir}/ovs-parse-backtrace \ %check %if %{with check} - if make check TESTSUITEFLAGS='%{_smp_mflags}' || - make check TESTSUITEFLAGS='--recheck'; then :; + if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :; else cat tests/testsuite.log exit 1 diff --git a/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in index 05b9e4d28..b86f5db26 100644 --- a/rhel/openvswitch.spec.in +++ b/rhel/openvswitch.spec.in @@ -76,8 +76,7 @@ install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch %check %if %{with check} - if make check TESTSUITEFLAGS='%{_smp_mflags}' || - make check TESTSUITEFLAGS='--recheck'; then :; + if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :; else cat tests/testsuite.log exit 1 diff --git a/tests/automake.mk b/tests/automake.mk index ef0a2f685..592f64888 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -115,7 +115,8 @@ DISTCLEANFILES += tests/atconfig tests/atlocal AUTOTEST_PATH = utilities:vswitchd:ovsdb:vtep:tests:$(PTHREAD_WIN32_DIR_DLL):ovn/controller-vtep:ovn/northd:ovn/utilities:ovn/controller check-local: tests/atconfig tests/atlocal $(TESTSUITE) - $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS) + set $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS); \ + "$$@" || (test X'$(RECHECK)' = Xyes && "$$@" --recheck) # Python Coverage support. # Requires coverage.py http://nedbatchelder.com/code/coverage/. diff --git a/xenserver/openvswitch-xen.spec.in b/xenserver/openvswitch-xen.spec.in index 8bc4a2c36..313dc4ccd 100644 --- a/xenserver/openvswitch-xen.spec.in +++ b/xenserver/openvswitch-xen.spec.in @@ -162,8 +162,7 @@ install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch %check %if %{with check} - if make check TESTSUITEFLAGS='%{_smp_mflags}' || - make check TESTSUITEFLAGS='--recheck'; then :; + if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :; else cat tests/testsuite.log exit 1