unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Timothy Sample <samplet@ngyro.com>
To: "Ludovic Courtès" <ludovic.courtes@inria.fr>
Cc: 48114@debbugs.gnu.org
Subject: bug#48114: Disarchive occasionally fails tests
Date: Fri, 30 Apr 2021 15:49:52 -0400	[thread overview]
Message-ID: <87pmybeen3.fsf@ngyro.com> (raw)
In-Reply-To: <87v984gkhn.fsf@inria.fr> ("Ludovic Courtès"'s message of "Fri, 30 Apr 2021 12:00:36 +0200")

Hey,

Ludovic Courtès <ludovic.courtes@inria.fr> writes:

> Disarchive 0.2.0 occasionally fails two tests:
>
>   FAIL: tests/kinds/octal.scm - [prop] Writing is reversible
>   FAIL: tests/kinds/octal.scm - [prop] Serializing is reversible

These two tests have a bit of a problem.  They occasionally fail by
“giving up”, which is when too many test cases are discarded rather than
used.  (This happens because you might write a generator for a superset
of the values you’re interested in, and then filter out some values with
“test-when”.)  I don’t think this is happening here, though.  You would
see something like “Gave up! Passed only 0 ests [sic].”

> I added ‘pk’ calls like so:
>
> (test-assert "[prop] Writing is reversible"
>   (quickcheck
>    (property ((octal $octal))
>      (test-when (valid-octal? octal)
>        (begin
>          (equal? (pk 'oct octal) (pk 'decode (decode-octal (encode-octal octal)))))))))
>
> (test-assert "[prop] Serializing is reversible"
>   (quickcheck
>    (property ((octal $octal))
>      (test-when (valid-octal? octal)
>        (equal? (pk 'OCT octal) (pk 'DECODE (serdeser -octal- octal)))))))
>
>
> and got this output:
>
> ;;; (oct #<<unstructured-octal> value: 0 source: #<<zero-string> value: "\U0f94a4\u0912\U025627\U10e96a\u9576\u2077\u048f\U0f2f60\U0f744b" trailer: #vu8(172 156 23 48 25 29 159 226 210)>>)
>
> ;;; (decode #<<unstructured-octal> value: 0 source: #<<zero-string> value: "\U0f94a4\u0912\U025627\U10e96a\u9576\u2077\u048f\U0f2f60\U0f744b" trailer: #vu8(172 156 23 48 25 29 159 226 210)>>)
> actual-value: #f
> actual-error:
> + (out-of-range
> +   #f
> +   "Value out of range ~S to ~S: ~S"
> +   (8 9 10)
> +   (10))
> result: FAIL
>
> […]
>
> ;;; (OCT #<<unstructured-octal> value: 0 source: #<<zero-string> value: "\U0f94a4\u0912\U025627\U10e96a\u9576\u2077\u048f\U0f2f60\U0f744b" trailer: #vu8(172 156 23 48 25 29 159 226 210)>>)
>
> ;;; (DECODE #<<unstructured-octal> value: 0 source: #<<zero-string> value: "\U0f94a4\u0912\U025627\U10e96a\u9576\u2077\u048f\U0f2f60\U0f744b" trailer: #vu8(172 156 23 48 25 29 159 226 210)>>)
> actual-value: #f
> actual-error:
> + (out-of-range
> +   #f
> +   "Value out of range ~S to ~S: ~S"
> +   (8 9 10)
> +   (10))
> result: FAIL
>
> I’m not sure where the exception comes from though.

I can’t seem to reproduce this.  I’ve run the test suite many, many
times, but I also tried:

    ,use (disarchive kinds octal)
    ,use (disarchive kinds zero-string)
    ,use (disarchive serialization)
    (define the-zero-string
      (make-zero-string
       "\U0f94a4\u0912\U025627\U10e96a\u9576\u2077\u048f\U0f2f60\U0f744b"
       #vu8(172 156 23 48 25 29 159 226 210)))
    (define the-octal
      (make-unstructured-octal 0 the-zero-string))
    (equal? the-octal (decode-octal (encode-octal the-octal)))
    (equal? the-octal (serdeser -octal- the-octal))

Which works fine.  (Does it work for you?)

However, isn’t it possible that these values aren’t the culprits?  With
the “pk” calls you added, isn’t it printing the last OK value without
telling us the value causing the issue?

What if you run it with the following?

    (test-assert "[prop] Writing is reversible"
      (quickcheck
       (property ((octal $octal))
         (test-when (valid-octal? octal)
           (false-if-exception  ; <-- changed!
             (equal? octal (decode-octal (encode-octal octal))))))))

This way, Guile-QuickCheck should print the offending value and the seed
used for the tests, which could be helpful for reproducing.  (The fact
that it doesn’t handle exceptions well is a known bug!)


-- Tim




  reply	other threads:[~2021-04-30 19:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30 10:00 bug#48114: Disarchive occasionally fails tests Ludovic Courtès
2021-04-30 19:49 ` Timothy Sample [this message]
2021-05-02 19:57   ` Ludovic Courtès
2021-05-03  2:24     ` Timothy Sample
2021-05-03  4:02       ` Timothy Sample
2021-05-03  6:19         ` Bengt Richter
2021-05-03 20:03         ` Ludovic Courtès
2021-05-13 21:04         ` Ludovic Courtès
2021-05-14  3:06           ` Timothy Sample
2021-05-14 13:51             ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pmybeen3.fsf@ngyro.com \
    --to=samplet@ngyro.com \
    --cc=48114@debbugs.gnu.org \
    --cc=ludovic.courtes@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).