From: Troy Figiel <troy@troyfigiel.com>
To: 69376@debbugs.gnu.org
Subject: [bug#69376] [PATCH go-team] build-system/go: Allow providing additional test flags.
Date: Sun, 25 Feb 2024 10:06:52 +0100 [thread overview]
Message-ID: <87a5noaot3.fsf@troyfigiel.com> (raw)
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
next reply other threads:[~2024-02-25 9:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-25 9:06 Troy Figiel [this message]
2024-02-25 9:23 ` [bug#69376] [PATCH go-team] build-system/go: Allow providing additional test flags Troy Figiel
2024-03-07 22:59 ` Sharlatan Hellseher
2024-03-08 9:06 ` Troy Figiel
2024-03-10 19:52 ` Sharlatan Hellseher
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a5noaot3.fsf@troyfigiel.com \
--to=troy@troyfigiel.com \
--cc=69376@debbugs.gnu.org \
/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 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.