GNU bug report logs - #35812
[PATCH] fix hackage cabal tests

Previous Next

Package: guix-patches;

Reported by: Robert Vollmert <rob <at> vllmrt.net>

Date: Mon, 20 May 2019 19:08:02 UTC

Severity: normal

Tags: patch

Merged with 35846, 35859

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35812 in the body.
You can then email your comments to 35812 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#35812; Package guix-patches. (Mon, 20 May 2019 19:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Robert Vollmert <rob <at> vllmrt.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 20 May 2019 19:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Robert Vollmert <rob <at> vllmrt.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] fix hackage cabal tests
Date: Mon, 20 May 2019 21:06:59 +0200
[Message part 1 (text/plain, inline)]
Hackage cabal tests didn’t run independently due to memoization,
and test-cabal-6 was failing.

Let me know if anything should be done differently.

[0001-tests-fix-cabal-tests-to-test-and-pass.patch (application/octet-stream, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35812; Package guix-patches. (Tue, 21 May 2019 14:49:02 GMT) Full text and rfc822 format available.

Message #8 received at 35812 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Robert Vollmert <rob <at> vllmrt.net>
Cc: 35812 <at> debbugs.gnu.org
Subject: Re: [bug#35812] [PATCH] fix hackage cabal tests
Date: Tue, 21 May 2019 16:48:34 +0200
Hello Robert,

Robert Vollmert <rob <at> vllmrt.net> skribis:

> Hackage cabal tests didn’t run independently due to memoization,
> and test-cabal-6 was failing.

I don’t think memoization can get in the way here: the argument list is
used as a key in the memoization hash table.  Thus, if you pass
different arguments, you get a cache miss and call the underlying
procedure.

Or am I missing something?

> From 8b6dac85a9f6c4e851c1a75a4958dff7915fb2f1 Mon Sep 17 00:00:00 2001
> From: Robert Vollmert <rob <at> vllmrt.net>
> Date: Fri, 17 May 2019 10:48:42 +0200
> Subject: [PATCH] tests: fix cabal tests to test and pass
>
> * guix/import/hackage.scm: export unmemoized import function
> * tests/hackage.scm: use unmemoized import function to make tests independent
> * tests/hackage.scm: fix failing test-cabal-6 by providing expected output

[...]

>  (test-assert "hackage->guix-package test 6"
> -  (eval-test-with-cabal test-cabal-6
> -                        #:cabal-environment '(("impl" . "ghc-7.8"))))
> +  (mock
> +   ((guix import hackage) hackage-fetch
> +    (lambda (name-version)
> +      (call-with-input-string test-cabal-6
> +        read-cabal)))
> +   (match (hackage->guix-package-impl "foo")
> +     (('package
> +        ('name "ghc-foo")
> +        ('version "1.0.0")
> +        ('source
> +         ('origin
> +           ('method 'url-fetch)
> +           ('uri ('string-append
> +                  "https://hackage.haskell.org/package/foo/foo-"
> +                  'version
> +                  ".tar.gz"))
> +           ('sha256
> +            ('base32
> +             (? string? hash)))))
> +        ('build-system 'haskell-build-system)
> +        ('inputs
> +         ('quasiquote
> +          (("ghc-b" ('unquote 'ghc-b))
> +           ("ghc-http" ('unquote 'ghc-http))
> +           ("ghc-mtl" ('unquote 'ghc-mtl)))))
> +        ('native-inputs
> +         ('quasiquote
> +          (("ghc-haskell-gi" ('unquote 'ghc-haskell-gi)))))
> +        ('home-page "http://test.org")
> +        ('synopsis (? string?))
> +        ('description (? string?))
> +        ('license 'bsd-3))
> +      #t)
> +     (x
> +      (pk 'fail x #f)))))

So this test needed to be changed as a result of turning off
memoization?

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#35812; Package guix-patches. (Tue, 21 May 2019 15:12:01 GMT) Full text and rfc822 format available.

Message #11 received at 35812 <at> debbugs.gnu.org (full text, mbox):

From: Robert Vollmert <rob <at> vllmrt.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35812 <at> debbugs.gnu.org
Subject: Re: [bug#35812] [PATCH] fix hackage cabal tests
Date: Tue, 21 May 2019 17:10:51 +0200
Hi Ludo’,

> On 21. May 2019, at 16:48, Ludovic Courtès <ludo <at> gnu.org> wrote:
> Robert Vollmert <rob <at> vllmrt.net> skribis:
> 
>> Hackage cabal tests didn’t run independently due to memoization,
>> and test-cabal-6 was failing.
> 
> I don’t think memoization can get in the way here: the argument list is
> used as a key in the memoization hash table.  Thus, if you pass
> different arguments, you get a cache miss and call the underlying
> procedure.
> 
> Or am I missing something?

I agree that memoization of a pure function shouldn’t have such effects,
but my (limited) understanding is that hackage->guix-packages would
cache import results by package name on the assumption that cabal
files for the same package name don’t change between calls. That
observation is consistent with the test behaviour, but I may well be
missing something.

>> From 8b6dac85a9f6c4e851c1a75a4958dff7915fb2f1 Mon Sep 17 00:00:00 2001
>> From: Robert Vollmert <rob <at> vllmrt.net>
>> Date: Fri, 17 May 2019 10:48:42 +0200
>> Subject: [PATCH] tests: fix cabal tests to test and pass
>> 
>> * guix/import/hackage.scm: export unmemoized import function
>> * tests/hackage.scm: use unmemoized import function to make tests independent
>> * tests/hackage.scm: fix failing test-cabal-6 by providing expected output
> 
> [...]
> 
>> (test-assert "hackage->guix-package test 6"
>> -  (eval-test-with-cabal test-cabal-6
>> -                        #:cabal-environment '(("impl" . "ghc-7.8"))))
>> +  (mock
>> +   ((guix import hackage) hackage-fetch
>> +    (lambda (name-version)
>> +      (call-with-input-string test-cabal-6
>> +        read-cabal)))
>> +   (match (hackage->guix-package-impl "foo")
>> +     (('package
>> +        ('name "ghc-foo")
>> +        ('version "1.0.0")
>> +        ('source
>> +         ('origin
>> +           ('method 'url-fetch)
>> +           ('uri ('string-append
>> +                  "https://hackage.haskell.org/package/foo/foo-"
>> +                  'version
>> +                  ".tar.gz"))
>> +           ('sha256
>> +            ('base32
>> +             (? string? hash)))))
>> +        ('build-system 'haskell-build-system)
>> +        ('inputs
>> +         ('quasiquote
>> +          (("ghc-b" ('unquote 'ghc-b))
>> +           ("ghc-http" ('unquote 'ghc-http))
>> +           ("ghc-mtl" ('unquote 'ghc-mtl)))))
>> +        ('native-inputs
>> +         ('quasiquote
>> +          (("ghc-haskell-gi" ('unquote 'ghc-haskell-gi)))))
>> +        ('home-page "http://test.org")
>> +        ('synopsis (? string?))
>> +        ('description (? string?))
>> +        ('license 'bsd-3))
>> +      #t)
>> +     (x
>> +      (pk 'fail x #f)))))
> 
> So this test needed to be changed as a result of turning off
> memoization?

Precisely. The other tests all expect various cabal fragments
to yield the same package definition, while the extra fragment

custom-setup
  setup-depends: base >= 4.7 && < 5,
                 Cabal >= 1.24,
                 haskell-gi == 0.21.*

in test-cabal-6 causes the extra native input ghc-haskell-gi.
As I understand it, this test failure used to be shadowed
because hackage->guix-packages would just return the successful
parse of the test-cabal-1.

(There’s probably some more elegant way to avoid duplicating
the whole package definition, but I generally prefer a bit of
explicit verbosity in test data.)

Cheers
Rob






Merged 35812 35846 35859. Request was from Robert Vollmert <rob <at> vllmrt.net> to control <at> debbugs.gnu.org. (Thu, 23 May 2019 13:37:01 GMT) Full text and rfc822 format available.

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 26 May 2019 21:24:02 GMT) Full text and rfc822 format available.

Notification sent to Robert Vollmert <rob <at> vllmrt.net>:
bug acknowledged by developer. (Sun, 26 May 2019 21:24:02 GMT) Full text and rfc822 format available.

Message #18 received at 35812-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Robert Vollmert <rob <at> vllmrt.net>
Cc: 35812-done <at> debbugs.gnu.org
Subject: Re: [bug#35812] [PATCH] fix hackage cabal tests
Date: Sun, 26 May 2019 23:23:27 +0200
Hi,

Robert Vollmert <rob <at> vllmrt.net> skribis:

>> On 21. May 2019, at 16:48, Ludovic Courtès <ludo <at> gnu.org> wrote:
>> Robert Vollmert <rob <at> vllmrt.net> skribis:
>> 
>>> Hackage cabal tests didn’t run independently due to memoization,
>>> and test-cabal-6 was failing.
>> 
>> I don’t think memoization can get in the way here: the argument list is
>> used as a key in the memoization hash table.  Thus, if you pass
>> different arguments, you get a cache miss and call the underlying
>> procedure.
>> 
>> Or am I missing something?
>
> I agree that memoization of a pure function shouldn’t have such effects,
> but my (limited) understanding is that hackage->guix-packages would
> cache import results by package name on the assumption that cabal
> files for the same package name don’t change between calls.

Oh, got it.

I pushed a variant of the patch as commit
ad7466aafd7f166d0b6be5eb32dda1d3ee8a6445.

Thanks!

Ludo’.




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 26 May 2019 21:24:02 GMT) Full text and rfc822 format available.

Notification sent to Robert Vollmert <rob <at> vllmrt.net>:
bug acknowledged by developer. (Sun, 26 May 2019 21:24:02 GMT) Full text and rfc822 format available.

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 26 May 2019 21:24:03 GMT) Full text and rfc822 format available.

Notification sent to Robert Vollmert <rob <at> vllmrt.net>:
bug acknowledged by developer. (Sun, 26 May 2019 21:24:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 Jun 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.