Control: tag -1 patch

Cyril Brulebois <k...@debian.org> (2018-12-29):
> Reopening as I was finally able to reproduce this issue on a test
> machine kindly provided by Santiago[1], but also locally by adding a
> “| sort -R” call after the “find” one in override_dh_auto_test and
> trying a build a few times.
> 
>  1. https://bugs.debian.org/907765#15
> 
> I've checked that using “sort” or “sort -r” both give positive results,
> and I'll propose a patch encoding one of the known-good sequence, as
> already done in other packages[2,3].
> 
>  2. https://bugs.debian.org/907765#25
>  3. https://bugs.debian.org/880351#19

[…]

> I intend to NMU this package in a few days, like the other ones.

You'll find attached the prospective patch.


Cheers,
-- 
Cyril Brulebois (k...@debian.org)            <https://debamax.com/>
D-I release manager -- Release team member -- Freelance Consultant
diff -Nru ssl-utils-clojure-0.8.3/debian/changelog ssl-utils-clojure-0.8.3/debian/changelog
--- ssl-utils-clojure-0.8.3/debian/changelog	2017-08-05 17:17:48.000000000 +0000
+++ ssl-utils-clojure-0.8.3/debian/changelog	2018-12-29 00:54:20.000000000 +0000
@@ -1,3 +1,13 @@
+ssl-utils-clojure (0.8.3-2) UNRELEASED; urgency=medium
+
+  * Fix FTBFS by running tests in a specific order. Instead of blindly
+    sorting the results of the find command and trusting it to be right,
+    encode a suitable sequence of tests (Closes: #880320). Also make sure
+    to error out when tests are added or removed, to make sure this
+    sequence get refreshed when needed.
+
+ -- Cyril Brulebois <k...@debian.org>  Sat, 29 Dec 2018 00:54:20 +0000
+
 ssl-utils-clojure (0.8.3-1) unstable; urgency=medium
 
   * Initial release (Closes: #855740)
diff -Nru ssl-utils-clojure-0.8.3/debian/rules ssl-utils-clojure-0.8.3/debian/rules
--- ssl-utils-clojure-0.8.3/debian/rules	2017-08-05 17:17:48.000000000 +0000
+++ ssl-utils-clojure-0.8.3/debian/rules	2018-12-29 00:54:02.000000000 +0000
@@ -24,10 +24,21 @@
 	rm -f $(CURDIR)/$(PRODUCED_JAR)
 	rm -rf $(CURDIR)/doc/html
 
+# Tests can't run in a random order (#880320):
+override_dh_auto_test: ORDERED_TESTS=puppetlabs/ssl_utils/core_test.clj puppetlabs/ssl_utils/extensions_utils_test.clj puppetlabs/ssl_utils/simple_test.clj
+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 '*.clj' | sed 's,^[.]/,,' | sort | xargs)
 override_dh_auto_test:
-	dh_auto_test
-	(cd test && find . -name "*_test.clj" | \
-		xargs --verbose clojure -cp $(CURDIR)/$(PRODUCED_JAR):$(CLASSPATH):$(TEST_CLASSPATH))
+	# 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):$(CLASSPATH):$(TEST_CLASSPATH) $(ORDERED_TESTS))
 
 get-orig-source:
 	uscan --download-version $(DEB_VERSION_UPSTREAM) --force-download --rename

Attachment: signature.asc
Description: PGP signature

Reply via email to