guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: guix-commits
Subject: 47/75: build-system/go: Honor #:parallel-tests?.
Date: Sun, 21 Jan 2024 13:21:48 -0500 (EST)

apteryx pushed a commit to branch core-updates
in repository guix.

commit f3019cc6b051f420cb274cfb658f6bcaacb6cbc2
Author: Sarah Morgensen <iskarian@mgsn.dev>
AuthorDate: Fri Aug 6 21:48:34 2021 -0700

    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>
---
 guix/build-system/go.scm       | 2 ++
 guix/build/go-build-system.scm | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index 0acaeca1cc..329e760f66 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -185,6 +185,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))
                    (goarch #f)
@@ -216,6 +217,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 a55381b0c6..5346110e86 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -277,9 +277,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)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]