diff mbox series

[bug#49919,core-updates,2/2] build-system/go: Honor #:parallel-tests?.

Message ID 0ec3e2c95c5be19dd9c07dd21f7f55283ebdc9da.1628309588.git.iskarian@mgsn.dev
State New
Headers show
Series build-system/go: Enable parallelism. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Sarah Morgensen Aug. 7, 2021, 4:48 a.m. UTC
guix/build/go-build-system.scm (build): Honor #:parallel-tests?.
guix/build-system/go.scm (go-build): Add PARALLEL-TESTS? parameter.
[builder]: Use it.
---
 guix/build-system/go.scm       | 2 ++
 guix/build/go-build-system.scm | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index a5aa21b99e..7b66163779 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -131,6 +131,7 @@  commit hash and its date rather than a proper release tag."
                    (build-flags ''())
                    (tests? #t)
                    (parallel-build? #t)
+                   (parallel-tests? #t)
                    (allow-go-reference? #f)
                    (system (%current-system))
                    (guile #f)
@@ -156,6 +157,7 @@  commit hash and its date rather than a proper release tag."
                     #: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)))))
 
diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm
index 521bad9667..0ad580a484 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -239,9 +239,12 @@  unpacking."
       (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)