mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-02-07 11:29:59 +01:00
build-system/go: Allow providing additional test flags.
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. * doc/guix.texi (go-build-system): Document <#:test-flags> parameter. Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com> Change-Id: I4015870fbbc15503cb405fe9ef6032953a5ff17f
This commit is contained in:
parent
7f6a9ecaa3
commit
56cc37bfb2
3 changed files with 12 additions and 3 deletions
|
@ -9582,6 +9582,12 @@ in their documentation}.
|
||||||
The key @code{#:go} can be used to specify the Go compiler package with
|
The key @code{#:go} can be used to specify the Go compiler package with
|
||||||
which to build the package.
|
which to build the package.
|
||||||
|
|
||||||
|
The phase @code{check} provides a wrapper for @code{go test} which
|
||||||
|
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
|
||||||
|
@code{#:test-flags} parameter, default is @code{'()}. See @code{go help
|
||||||
|
test} and @code{go help testflag} for more details.
|
||||||
|
|
||||||
@end defvar
|
@end defvar
|
||||||
|
|
||||||
@defvar glib-or-gtk-build-system
|
@defvar glib-or-gtk-build-system
|
||||||
|
|
|
@ -192,6 +192,7 @@ commit hash and its date rather than a proper release tag."
|
||||||
(unpack-path "")
|
(unpack-path "")
|
||||||
(build-flags ''())
|
(build-flags ''())
|
||||||
(tests? #t)
|
(tests? #t)
|
||||||
|
(test-flags ''())
|
||||||
(parallel-build? #t)
|
(parallel-build? #t)
|
||||||
(parallel-tests? #t)
|
(parallel-tests? #t)
|
||||||
(allow-go-reference? #f)
|
(allow-go-reference? #f)
|
||||||
|
@ -224,6 +225,7 @@ commit hash and its date rather than a proper release tag."
|
||||||
#:unpack-path #$unpack-path
|
#:unpack-path #$unpack-path
|
||||||
#:build-flags #$build-flags
|
#:build-flags #$build-flags
|
||||||
#:tests? #$tests?
|
#:tests? #$tests?
|
||||||
|
#:test-flags #$test-flags
|
||||||
#:parallel-build? #$parallel-build?
|
#:parallel-build? #$parallel-build?
|
||||||
#:parallel-tests? #$parallel-tests?
|
#:parallel-tests? #$parallel-tests?
|
||||||
#:allow-go-reference? #$allow-go-reference?
|
#:allow-go-reference? #$allow-go-reference?
|
||||||
|
@ -248,6 +250,7 @@ commit hash and its date rather than a proper release tag."
|
||||||
(unpack-path "")
|
(unpack-path "")
|
||||||
(build-flags ''())
|
(build-flags ''())
|
||||||
(tests? #f) ; nothing can be done
|
(tests? #f) ; nothing can be done
|
||||||
|
(test-flags ''())
|
||||||
(allow-go-reference? #f)
|
(allow-go-reference? #f)
|
||||||
(system (%current-system))
|
(system (%current-system))
|
||||||
(goarch (first (go-target target)))
|
(goarch (first (go-target target)))
|
||||||
|
@ -297,6 +300,7 @@ commit hash and its date rather than a proper release tag."
|
||||||
#:unpack-path #$unpack-path
|
#:unpack-path #$unpack-path
|
||||||
#:build-flags #$build-flags
|
#:build-flags #$build-flags
|
||||||
#:tests? #$tests?
|
#:tests? #$tests?
|
||||||
|
#:test-flags #$test-flags
|
||||||
#:make-dynamic-linker-cache? #f ;cross-compiling
|
#:make-dynamic-linker-cache? #f ;cross-compiling
|
||||||
#:allow-go-reference? #$allow-go-reference?
|
#:allow-go-reference? #$allow-go-reference?
|
||||||
#:inputs %build-inputs))))
|
#:inputs %build-inputs))))
|
||||||
|
|
|
@ -278,14 +278,13 @@ unpacking."
|
||||||
"Here are the results of `go env`:\n"))
|
"Here are the results of `go env`:\n"))
|
||||||
(invoke "go" "env"))))
|
(invoke "go" "env"))))
|
||||||
|
|
||||||
;; Can this also install commands???
|
(define* (check #:key tests? import-path test-flags (parallel-tests? #t)
|
||||||
(define* (check #:key tests? import-path (parallel-tests? #t)
|
|
||||||
#:allow-other-keys)
|
#:allow-other-keys)
|
||||||
"Run the tests for the package named by IMPORT-PATH."
|
"Run the tests for the package named by IMPORT-PATH."
|
||||||
(when tests?
|
(when tests?
|
||||||
(let* ((njobs (if parallel-tests? (parallel-job-count) 1)))
|
(let* ((njobs (if parallel-tests? (parallel-job-count) 1)))
|
||||||
(setenv "GOMAXPROCS" (number->string njobs)))
|
(setenv "GOMAXPROCS" (number->string njobs)))
|
||||||
(invoke "go" "test" import-path))
|
(apply invoke "go" "test" `(,import-path ,@test-flags)))
|
||||||
#t)
|
#t)
|
||||||
|
|
||||||
(define* (install #:key install-source? outputs import-path unpack-path #:allow-other-keys)
|
(define* (install #:key install-source? outputs import-path unpack-path #:allow-other-keys)
|
||||||
|
|
Loading…
Add table
Reference in a new issue