tests: Add ability to automatically rerun failed tests.
authorBen Pfaff <blp@ovn.org>
Wed, 24 Feb 2016 23:42:24 +0000 (15:42 -0800)
committerBen Pfaff <blp@ovn.org>
Wed, 24 Feb 2016 23:46:09 +0000 (15:46 -0800)
A lot of packaging was doing this already, so this simplifies their
implementation.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
CONTRIBUTING.md
INSTALL.md
debian/rules
rhel/openvswitch-fedora.spec.in
rhel/openvswitch.spec.in
tests/automake.mk
xenserver/openvswitch-xen.spec.in

index 086b6e8..6f69cff 100644 (file)
@@ -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.
index dd4d965..9c96bbe 100644 (file)
@@ -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
 ------
index cc17cd0..2a70bd6 100755 (executable)
@@ -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; \
index 34d8712..9052354 100644 (file)
@@ -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
index 05b9e4d..b86f5db 100644 (file)
@@ -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
index ef0a2f6..592f648 100644 (file)
@@ -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)
 \f
 # Python Coverage support.
 # Requires coverage.py http://nedbatchelder.com/code/coverage/.
index 8bc4a2c..313dc4c 100644 (file)
@@ -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