Control: tag -1 patch

Cyril Brulebois <k...@debian.org> (2018-12-30):
> I'll propose the same kind of patch as the other ones through salsa's
> MR system, as requested/suggested by maintainers. :)

There you go:
  https://salsa.debian.org/java-team/kitchensink-clojure/merge_requests/1

(You'll also find it attached.)
  

Cheers,
-- 
Cyril Brulebois (k...@debian.org)            <https://debamax.com/>
D-I release manager -- Release team member -- Freelance Consultant
From 95edcea66dcd114592c4dcc67c806939bab68a9e Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <k...@debian.org>
Date: Sun, 30 Dec 2018 22:21:52 +0000
Subject: [PATCH] Fix FTBFS by running tests in a specific order (Closes:
 #872935).

Instead of blindly sorting the results of the find command and trusting
it to be right, encode a suitable sequence of tests. Also make sure to
error out when tests are added or removed, to make sure this sequence
get refreshed when needed.
---
 debian/changelog | 10 ++++++++++
 debian/rules     | 17 ++++++++++++++---
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c123bad..927e644 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+kitchensink-clojure (2.3.0-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: #872935). 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>  Sun, 30 Dec 2018 22:18:30 +0000
+
 kitchensink-clojure (2.3.0-1) unstable; urgency=medium
 
   * Initial release (Closes: #855739)
diff --git a/debian/rules b/debian/rules
index 3711198..77fc244 100755
--- a/debian/rules
+++ b/debian/rules
@@ -26,10 +26,21 @@ override_jh_clean:
 override_jh_classpath:
 	jh_classpath $(PRODUCED_JAR)
 
+# Tests can't run in a random order (#872935):
+override_dh_auto_test: ORDERED_TESTS=puppetlabs/kitchensink/classpath_test.clj puppetlabs/kitchensink/core_test.clj puppetlabs/kitchensink/json_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 '*_test.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))
+	# 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
-- 
2.20.1

Attachment: signature.asc
Description: PGP signature

Reply via email to