all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#69376] [PATCH go-team] build-system/go: Allow providing additional test flags.
@ 2024-02-25  9:06 Troy Figiel
  2024-02-25  9:23 ` Troy Figiel
  2024-03-07 22:59 ` Sharlatan Hellseher
  0 siblings, 2 replies; 5+ messages in thread
From: Troy Figiel @ 2024-02-25  9:06 UTC (permalink / raw)
  To: 69376

By allowing the use of test flags, we can more precisely skip failing tests
(for go version >=1.20), disable the vetting stage or select a subset of tests
(e.g. if an upstream flag is provided to skip tests which require a network
connection).  At the moment, the only way around these test failures is to
remove the test file completely or patch the code ourselves.

* guix/build-system/go.scm (go-build): Add test-flags variable.
(go-cross-build): Add test-flags variable.
* guix/build/go-build-system.scm (check): Pass the additional test flags to the invoke call.
---
 guix/build-system/go.scm       | 4 ++++
 guix/build/go-build-system.scm | 8 +++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index 0934fded07..eb78a289f2 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -184,6 +184,7 @@ (define* (go-build name inputs
                    (unpack-path "")
                    (build-flags ''())
                    (tests? #t)
+                   (test-flags ''())
                    (allow-go-reference? #f)
                    (system (%current-system))
                    (goarch #f)
@@ -214,6 +215,7 @@ (define builder
                     #:unpack-path #$unpack-path
                     #:build-flags #$build-flags
                     #:tests? #$tests?
+                    #:test-flags #$test-flags
                     #:allow-go-reference? #$allow-go-reference?
                     #:inputs #$(input-tuples->gexp inputs)))))
 
@@ -236,6 +238,7 @@ (define* (go-cross-build name
                          (unpack-path "")
                          (build-flags ''())
                          (tests? #f)              ; nothing can be done
+                         (test-flags ''())
                          (allow-go-reference? #f)
                          (system (%current-system))
                          (goarch (first (go-target target)))
@@ -285,6 +288,7 @@ (define %outputs
                     #:unpack-path #$unpack-path
                     #:build-flags #$build-flags
                     #:tests? #$tests?
+                    #:test-flags #$test-flags
                     #:make-dynamic-linker-cache? #f ;cross-compiling
                     #:allow-go-reference? #$allow-go-reference?
                     #:inputs %build-inputs))))
diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm
index 7f25e05d0d..24b5ec1f05 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -271,11 +271,13 @@ (define* (build #:key import-path build-flags #:allow-other-keys)
                               "Here are the results of `go env`:\n"))
       (invoke "go" "env"))))
 
-;; Can this also install commands???
-(define* (check #:key tests? import-path #:allow-other-keys)
+;; go test builds a test binary (or multiple binaries), vets the code and then
+;; runs the test binary. Build, test and test binary flags can be provided as
+;; test-flags. See "go help test" and "go help testflag" for more details.
+(define* (check #:key tests? import-path test-flags #:allow-other-keys)
   "Run the tests for the package named by IMPORT-PATH."
   (when tests?
-    (invoke "go" "test" import-path))
+    (apply invoke "go" "test" `(,import-path ,@test-flags)))
   #t)
 
 (define* (install #:key install-source? outputs import-path unpack-path #:allow-other-keys)

base-commit: 1306beaf3f6c8ddded2a956f5863bc65aad78882
-- 
2.42.0





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#69376] [PATCH go-team] build-system/go: Allow providing additional test flags.
  2024-02-25  9:06 [bug#69376] [PATCH go-team] build-system/go: Allow providing additional test flags Troy Figiel
@ 2024-02-25  9:23 ` Troy Figiel
  2024-03-07 22:59 ` Sharlatan Hellseher
  1 sibling, 0 replies; 5+ messages in thread
From: Troy Figiel @ 2024-02-25  9:23 UTC (permalink / raw)
  To: 69376


[-- Attachment #1.1.1: Type: text/plain, Size: 127 bytes --]

As usual, I forgot to add my copyright. Could a committer be so kind to
add it or let me know if they prefer it in a patch v2?

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 6367 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#69376] [PATCH go-team] build-system/go: Allow providing additional test flags.
  2024-02-25  9:06 [bug#69376] [PATCH go-team] build-system/go: Allow providing additional test flags Troy Figiel
  2024-02-25  9:23 ` Troy Figiel
@ 2024-03-07 22:59 ` Sharlatan Hellseher
  2024-03-08  9:06   ` Troy Figiel
  1 sibling, 1 reply; 5+ messages in thread
From: Sharlatan Hellseher @ 2024-03-07 22:59 UTC (permalink / raw)
  To: 69376

[-- Attachment #1: Type: text/plain, Size: 1225 bytes --]


Hi Troy,

Thank you for the work!

The patch looks reasonable. Does it allow us to run all available tests
as we discussed in
<https://lists.gnu.org/archive/html/guix-devel/2024-01/msg00128.html>?

One nitpick about this section:
--8<---------------cut here---------------start------------->8---
+;; go test builds a test binary (or multiple binaries), vets the code and then
+;; runs the test binary. Build, test and test binary flags can be provided as
+;; test-flags. See "go help test" and "go help testflag" for more details.
--8<---------------cut here---------------end--------------->8---
It is a good material for documentation section, how about to move it
from this comment and compile a proper documentation note describing
#:test-flags for go-build-system?

Something like this:
--8<---------------cut here---------------start------------->8---
#:test-flags is added. The default is '(). These flags are passed as
 arguments to the test command. Note that flags for verbose output is
 always enabled on supported backends.
--8<---------------cut here---------------end--------------->8---
Sourced from <https://guix.gnu.org/manual/en/html_node/Build-Systems.html>

WDYT?

--
Oleg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#69376] [PATCH go-team] build-system/go: Allow providing additional test flags.
  2024-03-07 22:59 ` Sharlatan Hellseher
@ 2024-03-08  9:06   ` Troy Figiel
  2024-03-10 19:52     ` Sharlatan Hellseher
  0 siblings, 1 reply; 5+ messages in thread
From: Troy Figiel @ 2024-03-08  9:06 UTC (permalink / raw)
  To: 69376; +Cc: Sharlatan Hellseher

Hi Oleg,

On 2024-03-07 23:59, Sharlatan Hellseher wrote:
> The patch looks reasonable. Does it allow us to run all available tests
> as we discussed in
> <https://lists.gnu.org/archive/html/guix-devel/2024-01/msg00128.html>?

No, not yet. This only allows providing extra test-flags such as
"-vet=off" or "-skip ..." for Go 1.20+. An example where this is useful,
is go-github-com-wtolson-go-taglib, but I had a couple in my backlog as
well.

> One nitpick about this section:
> --8<---------------cut here---------------start------------->8---
> +;; go test builds a test binary (or multiple binaries), vets the code and then
> +;; runs the test binary. Build, test and test binary flags can be provided as
> +;; test-flags. See "go help test" and "go help testflag" for more details.
> --8<---------------cut here---------------end--------------->8---
> It is a good material for documentation section, how about to move it
> from this comment and compile a proper documentation note describing
> #:test-flags for go-build-system?
> 
> Something like this:
> --8<---------------cut here---------------start------------->8---
> #:test-flags is added. The default is '(). These flags are passed as
>  arguments to the test command. Note that flags for verbose output is
>  always enabled on supported backends.
> --8<---------------cut here---------------end--------------->8---
> Sourced from <https://guix.gnu.org/manual/en/html_node/Build-Systems.html>
> 
> WDYT?

I think that's a great idea. Where would that go exactly? I have only
found "guix.texi" and can add a short section there. Is this the correct
location?

Best wishes,

Troy




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#69376] [PATCH go-team] build-system/go: Allow providing additional test flags.
  2024-03-08  9:06   ` Troy Figiel
@ 2024-03-10 19:52     ` Sharlatan Hellseher
  0 siblings, 0 replies; 5+ messages in thread
From: Sharlatan Hellseher @ 2024-03-10 19:52 UTC (permalink / raw)
  To: Troy Figiel; +Cc: 69376

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

Hi Troy,

It looks like a right place to add
https://git.savannah.gnu.org/cgit/guix.git/tree/doc/guix.texi#n9718

May you send v2 with comments formed as documentation entries please?

Thanks,
Oleg

[-- Attachment #2: Type: text/html, Size: 463 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-10 19:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-25  9:06 [bug#69376] [PATCH go-team] build-system/go: Allow providing additional test flags Troy Figiel
2024-02-25  9:23 ` Troy Figiel
2024-03-07 22:59 ` Sharlatan Hellseher
2024-03-08  9:06   ` Troy Figiel
2024-03-10 19:52     ` Sharlatan Hellseher

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.