unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mathieu Lirzin <mthl@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] build: Add a scheme custom test driver using SRFI-64.
Date: Sun, 01 Nov 2015 20:48:34 +0100	[thread overview]
Message-ID: <87lhahcxgt.fsf@gnu.org> (raw)
In-Reply-To: <87h9l54p8p.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sun, 01 Nov 2015 18:13:26 +0100")

Hi,

ludo@gnu.org (Ludovic Courtès) writes:

> Mathieu Lirzin <mthl@gnu.org> skribis:
>
>> While reading the Automake manual I have discovered that it provides an
>> API for custom test drivers, so I've tried to implement something for
>> the scheme API for test suites (SRFI-64) which Guix is using.  The
>> result provides support for multiple test cases in a single file, and
>> allow ‘make check’ display the results individually:
>>
>>   PASS: tests/base32.scm - bytevector->base32-string
>>   PASS: tests/base32.scm - base32-string->bytevector
>>   PASS: tests/base32.scm - nix-base32-string->bytevector
>>   PASS: tests/base32.scm - &invalid-base32-character
>>   SKIP: tests/base32.scm - sha256 & bytevector->nix-base32-string
>>   PASS: tests/base64.scm - empty string
>
> Awesome!  Are the “inner” tests displayed by default?  Or is there some
> environment variable to control that?

Yes, each test case is displayed by default.

> I’d prefer the default to display only file names, as is currently the
> case (it’s more concise.)

IMO This would be reasonable to have an option for making the output more
concise since there are 563 test cases in Guix.  this is not part of the
test driver API specification, but it does not seem too hard to add an
additional option to the test driver script like what the TAP driver is
doing:

  https://www.gnu.org/software/automake/manual/automake.html#Use-TAP-with-the-Automake-test-harness

I think ‘--brief’ could be a good name for this option.  Default
verbosity would specified by adding “AM_SCM_LOG_DRIVER= --brief=yes” in
Makefile.am, then the user can overide that with:

  make check -j4 TESTS=tests/rocket-science.scm SCM_LOG_DRIVER="--brief=no"

>> Finally the ‘.log’ files are no longer fragmented between
>> “${top_srcdir}” and “tests/”.  If something went wrong (FAIL, SKIP,
>> XPASS) then the entire log file is copied in ‘test-suite.log’ so no need
>> to ask for an additional file when someone is reporting some ‘make
>> check’ error.
>
> Nice.  “Running the Test Suite” needs to be updated accordingly.

Thanks for reminding me this.  ;)

>> One caveat is that ‘tests/cpio.scm‘ is now failing.
>
> Why is that?  Does it relate to this change?

I didn't try to debug the problem but it has appeared when I started
messing with redirection of the output/error ports.  Here is the failure
output.

--8<---------------cut here---------------start------------->8---
test-name: bit-identical to GNU cpio's output
location: /home/mthl/src/gnu/guix/tests/cpio.scm:49
source:
+ (test-assert
+   "bit-identical to GNU cpio's output"
+   (call-with-temporary-output-file
+     (lambda (link _)
+       (delete-file link)
+       (symlink "chbouib" link)
+       (let ((files (cons* "/"
+                           (canonicalize-path
+                             (dirname (search-path %load-path "guix.scm")))
+                           link
+                           (map (compose
+                                  canonicalize-path
+                                  (cut search-path %load-path <>))
+                                '("guix.scm"
+                                  "guix/build/syscalls.scm"
+                                  "guix/packages.scm")))))
+         (call-with-temporary-output-file
+           (lambda (ref-file _)
+             (let ((pipe (open-pipe*
+                           OPEN_WRITE
+                           %cpio-program
+                           "-o"
+                           "-O"
+                           ref-file
+                           "-H"
+                           "newc"
+                           "--null")))
+               (for-each
+                 (lambda (file) (format pipe "~a\x00" file))
+                 files)
+               (and (zero? (close-pipe pipe))
+                    (call-with-temporary-output-file
+                      (lambda (file port)
+                        (write-cpio-archive files port)
+                        (close-port port)
+                        (or (file=? ref-file file)
+                            (throw 'cpio-archives-differ
+                                   files
+                                   ref-file
+                                   file
+                                   (stat:size (stat ref-file))
+                                   (stat:size (stat file))))))))))))))
value: #f
result: FAIL
--8<---------------cut here---------------end--------------->8---

>> Since this script is not intented to be exclusively used by Guix, I have
>> used a generic copyright notice.  I guess Guix is the best place to
>> challenge and improve it, but IMO it will be better hosted elsewhere
>> like in Gnulib.  Opinions?
>
> I think we could start using it and testing it for a while in Guix, and
> eventually submit it for inclusion in Gnulib once we are more confident.

So you recommend to add ”this file is part of GNU Guix” and use “GNU
Guix” instead of “this program” for now?

>> From 977e0586a6689df204fd9b522f8508ec318180c0 Mon Sep 17 00:00:00 2001
>> From: Mathieu Lirzin <mthl@openmailbox.org>
>> Date: Mon, 26 Oct 2015 23:47:24 +0100
>> Subject: [PATCH] build: Add a scheme custom test driver using SRFI-64.
>>
>> This provides support for multiple scheme test cases in a unique file and
>> fixes the fragmentation of '.log' files.
>>
>> * build-aux/test-driver.scm: New file.
>> * Makefile.am (SCM_LOG_DRIVER): New variable.
>>   (SCM_LOG_COMPILER, AM_SCM_LOG_FLAGS): Delete variables.
>>   (AM_TESTS_ENVIRONMENT): Set GUILE_AUTO_COMPILE to 0.
>> * tests/base32.scm, tests/build-utils.scm, tests/builders.scm,
>>   tests/challenge.scm, tests/containers.scm, tests/cpan.scm,
>>   tests/cpio.scm, tests/cran.scm, tests/derivations.scm, tests/elpa.scm,
>>   tests/file-systems.scm, tests/gem.scm, tests/gexp.scm,
>>   tests/graph.scm, tests/gremlin.scm, tests/hackage.scm, tests/hash.scm,
>>   tests/lint.scm, tests/monads.scm, tests/nar.scm, tests/packages.scm,
>>   tests/pk-crypto.scm, tests/pki.scm, tests/profiles.scm,
>>   tests/publish.scm, tests/pypi.scm, tests/records.scm,
>>   tests/scripts.scm, tests/services.scm, tests/sets.scm, tests/size.scm,
>>   tests/snix.scm, tests/store.scm, tests/substitute.scm,
>>   tests/syscalls.scm, tests/ui.scm, tests/union.scm, tests/utils.scm:
>>   Don't exit at the end of each test.
>
> AIUI each tests/foo.scm file is still run with its own Guile instance,
> in ./test-env, right?  (This is important.  It also means tests can run
> in parallel.)
>
> If this is OK, it LGTM.

I think it is OK :)

> However, I’m unsure if we should push it now, or after the release.  On
> one hand, I’d rather avoid potentially disrupting changes like this
> now.  On the other hand, since it makes it easier (and different) to
> report test failures, it’s nice.
>
> How confident are you?  :-)

IMHO we should wait after the next release in order to make this test
driver more bullet proof.

Thanks for your comments!

--
Mathieu Lirzin

  reply	other threads:[~2015-11-01 19:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-01  2:59 [PATCH] build: Add a scheme custom test driver using SRFI-64 Mathieu Lirzin
2015-11-01 17:13 ` Ludovic Courtès
2015-11-01 19:48   ` Mathieu Lirzin [this message]
2015-11-01 23:23     ` Mathieu Lirzin
2015-11-02  8:48       ` Ludovic Courtès
2015-11-02  8:59     ` Ludovic Courtès
2015-11-05 21:44       ` Mathieu Lirzin
2015-11-06 21:20         ` 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=87lhahcxgt.fsf@gnu.org \
    --to=mthl@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /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).