Control: tag -1 patch

Cyril Brulebois <[email protected]> (2018-12-28):
> Santiago Vila <[email protected]> (2018-12-28):
> > I can offer a test machine where this happens all the time if you
> > need it to reproduce it. Please contact me privately for details.
> 
> This would be super-useful, as I might have a tentative patch but
> can't reproduce the issue in various setups. Will follow-up privately.

Thanks to Santiago, I've managed to reproduce the issue on that test
machine, but also to test a tentative patch, inspired by positive
results there:

  https://bugs.debian.org/880351#12

The attached patch does the trick, but instead of sorting (or here,
reverse-sorting) the list of tests to run, I've chosen to encode a
sequence of tests that makes the test suite run OK. This way, it should
be obvious when new tests are added, so that one can find and document
a suitable sequence of tests.

I intend to NMU the package in the upcoming days (or team-upload it,
as proposed in #88035 already), with this patch or with a more simple
one based on a simpler “| LC_ALL=C sort -r” addition, as you wish.


Cheers,
-- 
Cyril Brulebois ([email protected])            <https://debamax.com/>
D-I release manager -- Release team member -- Freelance Consultant
diff -Nru honeysql-clojure-0.8.2/debian/changelog honeysql-clojure-0.8.2/debian/changelog
--- honeysql-clojure-0.8.2/debian/changelog	2017-08-04 19:40:33.000000000 +0000
+++ honeysql-clojure-0.8.2/debian/changelog	2018-12-28 23:35:12.000000000 +0000
@@ -1,3 +1,13 @@
+honeysql-clojure (0.8.2-2) UNRELEASED; urgency=medium
+
+  * Fix FTBFS by running tests in a specific order. Instead of blindly
+    (reverse-)sorting the results of the find command and trusting it to
+    be right, encode a suitable sequence of tests (Closes: #907765). Also
+    make sure to error out when tests are added or removed, to make sure
+    this sequence get refreshed when needed.
+
+ -- Cyril Brulebois <[email protected]>  Fri, 28 Dec 2018 23:35:12 +0000
+
 honeysql-clojure (0.8.2-1) unstable; urgency=medium
 
   * Initial release (Closes: #855757)
diff -Nru honeysql-clojure-0.8.2/debian/rules honeysql-clojure-0.8.2/debian/rules
--- honeysql-clojure-0.8.2/debian/rules	2017-08-04 19:40:33.000000000 +0000
+++ honeysql-clojure-0.8.2/debian/rules	2018-12-28 23:35:12.000000000 +0000
@@ -22,9 +22,21 @@
 	rm -f $(CURDIR)/$(PRODUCED_JAR)
 	rm -rf $(CURDIR)/doc/html
 
+# Tests can't run in a random order (#907765):
+override_dh_auto_test: ORDERED_TESTS=honeysql/format_test.cljc honeysql/core_test.cljc
+override_dh_auto_test: EXPECTED=$(shell echo "$(ORDERED_TESTS)" | sed 's/ /\n/g' | sort | xargs)
+override_dh_auto_test: FOUND=$(shell cd test && find -name '*.cljc' | sed 's,^[.]/,,' | sort | xargs)
 override_dh_auto_test:
-	(cd test && find . -name '*.cljc' | \
-		xargs clojure -cp $(CURDIR)/$(PRODUCED_JAR))
+	# Make sure to detect when tests appear or disappear:
+	@if [ "$(FOUND)" != "$(EXPECTED)" ]; then \
+		echo "E: sanity check failed, available tests don't match known tests:"; \
+		echo "    - found:    $(FOUND)"; \
+		echo "    - expected: $(EXPECTED)"; \
+		echo "=> Please update ORDERED_TESTS in debian/rules accordingly"; \
+		exit 1; \
+	fi
+	# Run tests:
+	(cd test && clojure -cp $(CURDIR)/$(PRODUCED_JAR) $(ORDERED_TESTS))
 
 %.html:%.md
 	cat debian/header.html > $@

Attachment: signature.asc
Description: PGP signature

Reply via email to