help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Turning off tests leads to a different store item


From: Simon Tournier
Subject: Re: Turning off tests leads to a different store item
Date: Thu, 02 Nov 2023 18:02:18 +0100

Hi,

On Thu, 02 Nov 2023 at 15:25, Suhail <suhail@bayesians.ca> wrote:

> It certainly seems to be the case. Would you know the specific place(s)
> in the source code (in addition to guix/derivations.scm and
> guix/store.scm) that would be relevant for this discussion?

I guess all the build systems: guix/build/*.scm and
guix/build-system/*/scm too.


> On a related note, is Dolstra's phd thesis relevant for these aspects,
> or do you know if Guix diverges from Nix in some areas?

I do not know.


> Yes, with the test derivation being something like a "fixed-output
> derivation". [[info:guix#Derivations][From the manual]]:

No, it cannot be a “fixed-output” derivation…

> #+begin_quote
> Operations such as file downloads and version-control checkouts for
> which the expected content hash is known in advance are modeled as
> fixed-output derivations. Unlike regular derivations, the outputs of a
> fixed-output derivation are independent of its inputs—e.g., a source
> code download produces the same result regardless of the download method
> and tools being used.
> #+end_quote

…because we cannot know in advance the expected content hash of the
tests output.


> Perhaps not all. The thing that sets the "check" phase (#:tests?) apart
> from the rest is that it's an identity transform with a
> side-effect. i.e., it simply reports on the state of its input (i.e.,
> the build artifact) leaving the build artifact unchanged. The only other
> phase in the gnu-build-system that is similar to the "check phase" is
> the "validate-runpath phase".

I am not sure to follow.

Well, I wrote earlier:

        Well, from my understanding, get the same the store path for the same
        package built with or without its tests ...  would mean to have a
        derivation for building and another derivation – referring to the
        former – for testing.

And from my understanding, one solution would be to have something as
below.  One “object” for building and another “object” for testing.

    ( Here, I am using the same object namely <package> for the both;
just to make concrete the discussion. :-) )

The point is: we have two derivations; one for the build (without tests)
and another for the tests (without build).

--8<---------------cut here---------------start------------->8---
$ guix build -L . hi-test --no-grafts -K

The following derivations will be built:
  /gnu/store/…-hi-test-2.10.drv
  /gnu/store/…-hi-build-2.10.drv

building /gnu/store/…-hi-build-2.10.drv...
starting phase `set-SOURCE-DATE-EPOCH'
phase `set-SOURCE-DATE-EPOCH' succeeded after 0.0 seconds
starting phase `set-paths'
phase `set-paths' succeeded after 0.0 seconds
starting phase `install-locale'
phase `install-locale' succeeded after 0.0 seconds
starting phase `unpack'
phase `unpack' succeeded after 0.0 seconds
starting phase `bootstrap'
phase `bootstrap' succeeded after 0.0 seconds
starting phase `patch-usr-bin-file'
phase `patch-usr-bin-file' succeeded after 0.1 seconds
starting phase `patch-source-shebangs'
phase `patch-source-shebangs' succeeded after 0.0 seconds
starting phase `configure'
phase `configure' succeeded after 14.8 seconds
starting phase `patch-generated-file-shebangs'
phase `patch-generated-file-shebangs' succeeded after 0.0 seconds

starting phase `build'

 … do stuff …
 
phase `build' succeeded after 1.2 seconds

starting phase `install'
phase `install' succeeded after 0.5 seconds
starting phase `patch-shebangs'
phase `patch-shebangs' succeeded after 0.0 seconds
starting phase `strip'
phase `strip' succeeded after 0.0 seconds
starting phase `validate-runpath'
phase `validate-runpath' succeeded after 0.0 seconds
starting phase `validate-documentation-location'
phase `validate-documentation-location' succeeded after 0.0 seconds
starting phase `delete-info-dir-file'
phase `delete-info-dir-file' succeeded after 0.0 seconds
starting phase `patch-dot-desktop-files'
phase `patch-dot-desktop-files' succeeded after 0.0 seconds
starting phase `make-dynamic-linker-cache'
starting phase `install-license-files'
phase `install-license-files' succeeded after 0.0 seconds
starting phase `reset-gzip-timestamps'
phase `reset-gzip-timestamps' succeeded after 0.0 seconds
starting phase `compress-documentation'
phase `compress-documentation' succeeded after 0.0 seconds
successfully built /gnu/store/…-hi-build-2.10.drv


building /gnu/store/gnjj4hq5pk890l211b28nkd1dwx4z09k-hi-test-2.10.drv...
starting phase `set-SOURCE-DATE-EPOCH'
phase `set-SOURCE-DATE-EPOCH' succeeded after 0.0 seconds
starting phase `set-paths'
phase `set-paths' succeeded after 0.0 seconds
starting phase `install-locale'
phase `install-locale' succeeded after 0.0 seconds
starting phase `unpack'
phase `unpack' succeeded after 0.0 seconds
starting phase `bootstrap'
phase `bootstrap' succeeded after 0.0 seconds
starting phase `patch-usr-bin-file'
phase `patch-usr-bin-file' succeeded after 0.0 seconds
starting phase `patch-source-shebangs'
phase `patch-source-shebangs' succeeded after 0.0 seconds
starting phase `configure'
phase `configure' succeeded after 8.9 seconds
starting phase `patch-generated-file-shebangs'
phase `patch-generated-file-shebangs' succeeded after 0.0 seconds

starting phase `check'
[...]

============================================================================
Testsuite summary for GNU Hello 2.10
============================================================================
# TOTAL: 5
# PASS:  4
# SKIP:  1
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
phase `check' succeeded after 0.4 seconds

starting phase `install'
phase `install' succeeded after 0.3 seconds
successfully built /gnu/store/gnjj4hq5pk890l211b28nkd1dwx4z09k-hi-test-2.10.drv

/gnu/store/7fc3933yqq9hnp4rrxp84gxdpg270k7v-hi-build-2.10
/gnu/store/7fc3933yqq9hnp4rrxp84gxdpg270k7v-hi-test-2.10
--8<---------------cut here---------------end--------------->8---

with the file attached.

(define-module (hello)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (guix licenses)
  #:use-module (gnu packages gawk))

(define-public hi
  (package
    (name "hi-build")
    (version "2.10")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://gnu/hello/hello-" version
                                  ".tar.gz"))
              (sha256
               (base32
                "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
    (build-system gnu-build-system)
    (arguments
     `(#:configure-flags '("--enable-silent-rules")
       #:phases
       (modify-phases %standard-phases
         (delete 'check))))
    (inputs (list gawk))
    (synopsis "Hello, GNU world: An example GNU package")
    (description "Guess what GNU Hello prints!")
    (home-page "https://www.gnu.org/software/hello/";)
    (license gpl3+)))

(define-public hi-test
  (package/inherit hi
    (name "hi-test")
    (build-system gnu-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (delete 'build)

         (delete 'patch-shebangs)
         (delete 'strip)
         (delete 'validate-runpath)
         (delete 'reset-gzip-timestamps)
         (delete 'validate-documentation-location)
         (delete 'delete-info-dir-file)
         (delete 'patch-dot-desktop-files)
         (delete 'make-dynamic-linker-cache)
         (delete 'install-license-files)
         (delete 'compress-documentation))))
    (inputs (list hi))))
Somehow, we could have a “build” build-system and a “test” build-system.
And the “build object” would be an inputs of the “test object“.  Well,
somehow perhaps some revamp of the <package> record.

Hum, I do not know… I am not convinced by my own words. :-)

Cheers,
simon

reply via email to

[Prev in Thread] Current Thread [Next in Thread]