unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Chris Marusich <cmmarusich@gmail.com>
Cc: 30572@debbugs.gnu.org
Subject: [bug#30572] [PATCH 1/7] tests: Add tests for "guix pack".
Date: Thu, 08 Mar 2018 22:05:41 +0100	[thread overview]
Message-ID: <878tb2l1lm.fsf@gnu.org> (raw)
In-Reply-To: <87woyphhqo.fsf@gmail.com> (Chris Marusich's message of "Tue, 06 Mar 2018 06:53:51 +0100")

Howdy,

Chris Marusich <cmmarusich@gmail.com> skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>>> +# Use --dry-run because it takes too long to actually build everything.
>>> +GUIX_BUILD_OPTIONS="--no-substitutes --dry-run"
>>> +export GUIX_BUILD_OPTIONS
>>> +
>>> +# Build a tarball.
>>> +guix pack coreutils
>>
>> It would be ideal if we could actually build something, but built
>> something cheap.
>>
>> The way we do that in those tests is by:
>>
>>   1. Using the ‘guile-bootstrap’ package as an example, under the
>>      assumption that it’s already available, does not require
>>      networking, and is built in one or two seconds.
>>
>>   2. Using ‘--bootstrap’ or a similar option so that the derivations use
>>      ‘guile-bootstrap’ instead of ‘guile-final’, for the same reason.
>>
>> See for instance tests/guix-package.sh.
>>
>> Would you be willing to try something along these lines?
>
> That's a good idea!  I tried it (see attached patch).  Unfortunately,
> even after adding a --bootstrap option, "guix pack" tries to build many
> things, so tests/guix-pack.sh takes hours to run the first time you try
> it (it ran for 2 hours on my laptop and then failed because gcc failed
> to build for unrelated reasons):

[...]

> It's quicker after the first time, but it's a hefty one-time cost.
>
> I think so many things need to be built because "guix pack" creates the
> pack using a gexp that uses packages.  For example, instead of executing
> "tar" by looking it up in the current environment (e.g. via system*), it
> builds the "tar" package and executes the resulting "tar" program in the
> gexp that creates the pack.  Therefore, even though we do use
> guile-bootstrap to run the gexp, Guix still need to build tar and all of
> its dependencies, so the test takes hours to run.  Can we do better?

Ah indeed, I hadn’t thought about tar.

We could arrange for ‘--bootstrap’ to use:

  (search-bootstrap-binary "tar")

instead of the ‘tar’ package.  We could do the same for ‘xz’.  (You’d
need a ‘trivial-build-system’ package that copies these two binaries in
$out/bin.)

How does that sound?

> Maybe we could move tests like these to a "long-running" test target
> (e.g., "make check-long-running").  I think this could work, but I would
> much rather just write tests that run quickly.

We could do that but let’s see if we can avoid it for now.  :-)

> Maybe we could rewrite "guix pack" so that it uses system* to run tar.

I’d rather not hinder reproducibility “just” for a test.

> Finally, maybe we could stick with running the tests in "dry-run" mode.
> I'm in favor of this idea, but obviously I'm a little biased.  :-)

Well, that would work too, indeed.  :-)

> From 72e672e795fe8f4d67f7e1805ba8b88c874f3fb1 Mon Sep 17 00:00:00 2001
> From: Chris Marusich <cmmarusich@gmail.com>
> Date: Tue, 20 Feb 2018 02:17:54 +0100
> Subject: [PATCH 1/7] tests: Add tests for "guix pack".
>
> * guix/scripts/pack.scm (%options): Add the --bootstrap option.
>   (show-help): Document it.
>   (guix-pack): Honor it.
> * doc/guix.texi (Invoking guix pack): Document the new --bootstrap
>   option.
> * tests/guix-pack.sh: New file.
> * Makefile.am (SH_TESTS): Add guix-pack.sh.
> * gnu/packages/package-management.scm (guix) <inputs>: Add util-linux.

[...]

> +# Build a tarball with a symlink.
> +the_pack="$(guix pack --bootstrap -S /opt/gnu/bin=bin guile-bootstrap)"

In general we use backticks instead of $(…) to stick to POSIX shells.

> +# Build a tarball pack of cross-compiled software.
> +guix pack --bootstrap --target=arm-unknown-linux-gnueabihf guile-bootstrap

This one is a little bit too costly (plus it wouldn’t work because
guile-bootstrap is not actually cross-compilable), so I’d suggest add
‘--dry-run’ and removing ‘-bootstrap’.  :-)

HTH!

Ludo’.

      reply	other threads:[~2018-03-08 21:06 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <handler.30572.B.151929540925748.ack@debbugs.gnu.org>
2018-02-22 10:35 ` [bug#30572] [PATCH 1/7] tests: Add tests for "guix pack" Chris Marusich
2018-02-22 10:35   ` [bug#30572] [PATCH 2/7] vm: Allow control of deduplication in root-partition-initializer Chris Marusich
2018-02-25 14:02     ` Danny Milosavljevic
2018-02-22 10:35   ` [bug#30572] [PATCH 3/7] system: Allow customization of the initrd's Guile Chris Marusich
2018-02-22 12:10     ` Chris Marusich
2018-02-27 17:04       ` Ludovic Courtès
2018-03-07  5:56         ` Chris Marusich
2018-03-07 15:20           ` Ludovic Courtès
2018-02-22 10:35   ` [bug#30572] [PATCH 4/7] docker: Allow the use of a custom temporary directory Chris Marusich
2018-02-26  0:48     ` Danny Milosavljevic
2018-02-26 16:23       ` Chris Marusich
2018-02-26 23:46         ` Danny Milosavljevic
2018-02-27  4:43           ` Chris Marusich
2018-02-27 17:00             ` Ludovic Courtès
2018-03-07  6:24               ` Chris Marusich
2018-03-07 15:24                 ` Ludovic Courtès
2018-02-22 10:35   ` [bug#30572] [PATCH 5/7] docker: Allow the addition of extra files into the image Chris Marusich
2018-02-25 23:36     ` Danny Milosavljevic
2018-02-26 16:25       ` Chris Marusich
2018-02-26 23:47         ` Danny Milosavljevic
2018-02-27 17:08         ` Ludovic Courtès
2018-02-22 10:35   ` [bug#30572] [PATCH 6/7] system: Add "guix system docker-image" command Chris Marusich
2018-02-26 16:30     ` Chris Marusich
2018-02-27 17:17       ` Ludovic Courtès
2018-03-03  7:31         ` Chris Marusich
2018-02-22 10:35   ` [bug#30572] [PATCH 7/7] tests: Add tests for "guix system disk-image" et al Chris Marusich
2018-02-25 14:05     ` Danny Milosavljevic
2018-02-27 16:32   ` [bug#30572] [PATCH 1/7] tests: Add tests for "guix pack" Ludovic Courtès
2018-03-06  5:53     ` Chris Marusich
2018-03-08 21:05       ` Ludovic Courtès [this message]

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=878tb2l1lm.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=30572@debbugs.gnu.org \
    --cc=cmmarusich@gmail.com \
    /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).