help-guix
[Top][All Lists]
Advanced

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

Re: Getting Unit Test Results Out Of Guix Build


From: Phil Beadling
Subject: Re: Getting Unit Test Results Out Of Guix Build
Date: Thu, 4 Nov 2021 13:52:02 +0000

Hi,

On Tue, 26 Oct 2021 at 19:31, Phil <phil@beadling.co.uk> wrote:

> Hi,
>
> raingloom writes:
>
>
> > Couldn't this just be another package output? Maybe not the most elegant
> > solution, since those are not usually used this way, but it can sort of
> > work. Just add a phase that copies the logs to the "tests" output if
> > it exists. Kinda like how the "debug" is currently used.
>
> Yes this could work - so for my-package I could just define
> my-package:tests which would add an extra test directory to the package
> in the store which I would copy the test results into.
>
>
I gave this a got it almost working with one significant snag I was hoping
someone might be able to help with?

Once the build is complete is possible to retrieve the location of the test
files using a simple REPL script - In my example this is nested in Groovy
script in my case which will interpolate the ${packageExpression} for me to
give a proper Scheme expression (this isn't important just mentioning it so
the script makes sense):













*(use-modules (guix packages)             (gnu packages)             (guix
store)             (guix derivations))(define my-drv  (with-store store
(run-with-store store      (package->derivation
${packageExpression}))))(format #t "~a~%" (assoc-ref
(derivation->output-paths my-drv) "test"))*


The below details are no overly important (IMHO), but script is fed into a
Groovy variable called testLocationSCript, and called from shell script
like so (localCannelSwitch is just a "-L /path/to/my/local/channel"
variable):
TESTDIR=`guix repl ${localChannelSwitch} -- <(cat <<<
'${testLocationScript}')`


This all works great *until* you actually have a unit test failure - then
because that unit test failure will fail the "guix build", the
"package->derivation" command seems to try to rebuild the package, which of
course fails again for exactly the same reason.as the original failure and
provides no location for derivation->output-paths.

*So what I need is a way of asking what will the output path be, without
actually building, or inspite of a build failure?*

This must be techincally possible because mid-build the output paths are
available - so they are known ahead of build completion.

So, does anyone have a way of getting the output directories from Guix
without first requiring a successful build?


Thanks!


reply via email to

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