From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu2jo-0006fO-Bm for guix-patches@gnu.org; Thu, 08 Mar 2018 16:06:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eu2jk-0007Ho-93 for guix-patches@gnu.org; Thu, 08 Mar 2018 16:06:08 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:43632) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eu2jk-0007He-56 for guix-patches@gnu.org; Thu, 08 Mar 2018 16:06:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eu2ji-0004f9-5O for guix-patches@gnu.org; Thu, 08 Mar 2018 16:06:03 -0500 Subject: [bug#30572] [PATCH 1/7] tests: Add tests for "guix pack". Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180222103528.5108-1-cmmarusich@gmail.com> <87y3jez943.fsf@gnu.org> <87woyphhqo.fsf@gmail.com> Date: Thu, 08 Mar 2018 22:05:41 +0100 In-Reply-To: <87woyphhqo.fsf@gmail.com> (Chris Marusich's message of "Tue, 06 Mar 2018 06:53:51 +0100") Message-ID: <878tb2l1lm.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Chris Marusich Cc: 30572@debbugs.gnu.org Howdy, Chris Marusich skribis: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >>> +# Use --dry-run because it takes too long to actually build everything. >>> +GUIX_BUILD_OPTIONS=3D"--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 =E2=80=98guile-bootstrap=E2=80=99 package as an example, = under the >> assumption that it=E2=80=99s already available, does not require >> networking, and is built in one or two seconds. >> >> 2. Using =E2=80=98--bootstrap=E2=80=99 or a similar option so that the= derivations use >> =E2=80=98guile-bootstrap=E2=80=99 instead of =E2=80=98guile-final= =E2=80=99, 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=E2=80=99t thought about tar. We could arrange for =E2=80=98--bootstrap=E2=80=99 to use: (search-bootstrap-binary "tar") instead of the =E2=80=98tar=E2=80=99 package. We could do the same for =E2= =80=98xz=E2=80=99. (You=E2=80=99d need a =E2=80=98trivial-build-system=E2=80=99 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=E2=80=99s see if we can avoid it for now. :-) > Maybe we could rewrite "guix pack" so that it uses system* to run tar. I=E2=80=99d rather not hinder reproducibility =E2=80=9Cjust=E2=80=9D 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 > 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) : Add util-linux. [...] > +# Build a tarball with a symlink. > +the_pack=3D"$(guix pack --bootstrap -S /opt/gnu/bin=3Dbin guile-bootstra= p)" In general we use backticks instead of $(=E2=80=A6) to stick to POSIX shell= s. > +# Build a tarball pack of cross-compiled software. > +guix pack --bootstrap --target=3Darm-unknown-linux-gnueabihf guile-boots= trap This one is a little bit too costly (plus it wouldn=E2=80=99t work because guile-bootstrap is not actually cross-compilable), so I=E2=80=99d suggest a= dd =E2=80=98--dry-run=E2=80=99 and removing =E2=80=98-bootstrap=E2=80=99. :-) HTH! Ludo=E2=80=99.