Bug#1081069: ghc: Don't do tests on crossbuild

Ilias Tsitsimpis iliastsi at debian.org
Mon Sep 9 18:30:56 BST 2024


Hi Samuel,

On Sat, Sep 07, 2024 at 11:05PM, Samuel Thibault wrote:
> Arguably, when cross-building, one should always be using the nocheck
> profile, but it'd still be convenient that debian/rules already avoids
> running tests.

We can definitely do that.

> --- debian/rules.original	2024-09-07 23:04:14.489645147 +0200
> +++ debian/rules	2024-09-07 23:04:15.401631651 +0200
> @@ -165,6 +165,7 @@
>  
>  override_dh_auto_test:
>  ifeq (NO,$(BUILD_CROSS))
> +ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
>  	# Do some very simple tests that the compiler actually works
>  	rm -rf debian/testghc
>  	mkdir debian/testghc
> @@ -180,6 +181,7 @@
>  	@inplace/bin/ghc-stage2 --info
>  	@printf "====END GHC INFO OUTPUT====\n"
>  endif
> +endif

I don't think we can simply add

  ifeq (NO,$(BUILD_CROSS))

here. This will be equivalent to a logical AND, whereas we are looking
for an OR. Maybe something like this?

diff --git a/p/ghc/debian/rules b/p/ghc/debian/rules
index b228c91474..07d66b6704 100755
--- a/p/ghc/debian/rules
+++ b/p/ghc/debian/rules
@@ -369,8 +369,17 @@ override_dh_auto_clean: clean-hadrian
        rm -rf debian/testghc
        rm -rf debian/tmp-db
 
-override_dh_auto_test:
+
+RUN_TESTS=y
+ifeq (NO,$(BUILD_CROSS))
+       RUN_TESTS=n
+endif
 ifeq (,$(filter nocheck, $(DEB_BUILD_OPTIONS)))
+       RUN_TESTS=n
+endif
+
+override_dh_auto_test:
+ifeq "$(RUN_TESTS)" "y"
        # Do some very simple tests that the compiler actually works
        rm -rf debian/testghc
        mkdir debian/testghc

Not sure if there is a more elegant way to do this.

-- 
Ilias



More information about the Pkg-haskell-maintainers mailing list