build-system/go: Honor #:parallel-tests?.

guix/build/go-build-system.scm (build): Honor #:parallel-tests?.
guix/build-system/go.scm (go-build): Add PARALLEL-TESTS? parameter.
[builder]: Use it.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
Sarah Morgensen 2021-08-06 21:48:34 -07:00 committed by Ludovic Courtès
parent 92046a65fa
commit 969fb0b2be
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 6 additions and 1 deletions

View file

@ -193,6 +193,7 @@ (define* (go-build name inputs
(build-flags ''())
(tests? #t)
(parallel-build? #t)
(parallel-tests? #t)
(allow-go-reference? #f)
(system (%current-system))
(goarch #f)
@ -224,6 +225,7 @@ (define builder
#:build-flags #$build-flags
#:tests? #$tests?
#:parallel-build? #$parallel-build?
#:parallel-tests? #$parallel-tests?
#:allow-go-reference? #$allow-go-reference?
#:inputs #$(input-tuples->gexp inputs)))))

View file

@ -279,9 +279,12 @@ (define* (build #:key import-path build-flags (parallel-build? #t)
(invoke "go" "env"))))
;; Can this also install commands???
(define* (check #:key tests? import-path #:allow-other-keys)
(define* (check #:key tests? import-path (parallel-tests? #t)
#:allow-other-keys)
"Run the tests for the package named by IMPORT-PATH."
(when tests?
(let* ((njobs (if parallel-tests? (parallel-job-count) 1)))
(setenv "GOMAXPROCS" (number->string njobs)))
(invoke "go" "test" import-path))
#t)