[sagemath] 02/02: If tests fail but not by too many more, then retry them once

Ximin Luo infinity0 at debian.org
Thu Dec 15 02:40:47 UTC 2016


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository sagemath.

commit 6b509c981d4aded8617bad4aed4f0f37a75f42e1
Author: Ximin Luo <infinity0 at debian.org>
Date:   Thu Dec 15 03:39:48 2016 +0100

    If tests fail but not by too many more, then retry them once
---
 debian/rules | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/debian/rules b/debian/rules
index a11105d..3c6435a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -153,6 +153,7 @@ prune: debian/control
 	cd sage && python ../debian/pruner/pruner.py ||	test $$(dpkg-parsechangelog -l../debian/changelog -SDistribution) = unstable-sage
 	touch prune
 
+run_tests = cd sage && ./sage -t -p $(NUMJOBS) --all --long $(EXTRA_SAGE_TEST_FLAGS) --logfile=logs/ptestlong.log
 ptestlong:
 	cd sage && $(SAGE_LOCAL)/bin/sage-starts
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
@@ -164,8 +165,14 @@ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
 	# to detect a previous successful (override_)dh_auto_build, so if we run
 	# `debian/rules build` twice it will go directly to (override_)dh_auto_test
 	# (and then this target) without trying (override_)dh_auto_build again.
-	cd sage && ./sage -t -p $(NUMJOBS) --all --long $(EXTRA_SAGE_TEST_FLAGS) --logfile=logs/ptestlong.log || true
-	test $$(dpkg-parsechangelog -SDistribution) = unstable-sage || debian/rules had-few-failures
+	$(run_tests) || true
+	# If tests fail but not by too many more, then retry them once
+	if [ $$(dpkg-parsechangelog -SDistribution) = unstable-sage ]; then :; \
+	elif debian/rules -s had-few-failures; then :; else \
+	  debian/rules -s had-not-too-many-failures && \
+	  mv sage/logs/ptestlong.log sage/logs/ptestlong.log.1 && \
+	  { $(run_tests) -f; debian/rules -s had-few-failures; }; \
+	fi
 endif
 
 # If the docbuild fails and you want to try again, you should run this first.
@@ -193,14 +200,18 @@ build-dep: debian/control
 
 had-few-failures:
 	# Allow < 80 tests to fail, but no "special" failures like Killed etc
+	test -f sage/logs/ptestlong.log
 	test "$$(debian/rules -s --no-print-directory failed-tests-total)" -lt 80
 
+had-not-too-many-failures:
+	test -f sage/logs/ptestlong.log
+	test "$$(grep "Failed example:" sage/logs/ptestlong.log | wc -l)" -lt 120
+
 FAILED_TESTS = grep '^sage -t .*  \#' sage/logs/ptestlong.log
 failed-tests:
 	$(FAILED_TESTS)
 
 failed-tests-total:
-	test -f sage/logs/ptestlong.log
 	grep "Failed example:" sage/logs/ptestlong.log | wc -l
 	$(FAILED_TESTS) | { ! grep '# [^0-9]'; }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagemath.git



More information about the debian-science-commits mailing list