GNU bug report logs - #69376
[PATCH go-team] build-system/go: Allow providing additional test flags.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Troy Figiel <troy@HIDDEN>; Keywords: patch; dated Sun, 25 Feb 2024 09:15:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 Feb 2024 09:14:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 25 04:14:56 2024
Received: from localhost ([127.0.0.1]:56927 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1reAb2-0005Lt-2P
	for submit <at> debbugs.gnu.org; Sun, 25 Feb 2024 04:14:56 -0500
Received: from lists.gnu.org ([209.51.188.17]:51270)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <troy@HIDDEN>) id 1reAaz-0005Lh-Se
 for submit <at> debbugs.gnu.org; Sun, 25 Feb 2024 04:14:55 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <troy@HIDDEN>)
 id 1reAaa-0006cN-PJ
 for guix-patches@HIDDEN; Sun, 25 Feb 2024 04:14:28 -0500
Received: from mout-p-102.mailbox.org ([80.241.56.152])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256)
 (Exim 4.90_1) (envelope-from <troy@HIDDEN>)
 id 1reAaX-0001mo-Rq
 for guix-patches@HIDDEN; Sun, 25 Feb 2024 04:14:28 -0500
Received: from smtp1.mailbox.org (smtp1.mailbox.org
 [IPv6:2001:67c:2050:b231:465::1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4TjJ3L1NK5z9scT
 for <guix-patches@HIDDEN>; Sun, 25 Feb 2024 10:14:22 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=troyfigiel.com;
 s=MBO0001; t=1708852462;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=nHlrxH0ATmtUfjFBB6WSk9/wUsS90bY95LW5rVDlT4k=;
 b=muQp2sbdFCI3NoABadS64o2ALUR4EvW8jSgj4i40fWT04JkNNGObPnZv8k2M+i98VPK6AS
 LA5q+KXZWYHZRpzI37kHAcERQO3+lalPJnXutD78R0LBYbx/6Z0CE+RrDs+dFkBLh8WfFT
 IzbqRCNilHe7QZ7CGMRuDAEwrq+rX7rsiuomtFO1ARiXJG0MqTD+PqbSB6RJRm/4ZolsAr
 ortQsXNqiZl9rFrsfOERPXLQEa6MlWg7YBHADq5Ga3W621LbMG1IfE4toIizB+7R93JOmh
 ZxEqR6ycClGy8cO+5zBitrgLzdmv+LOBidEnSWcL4PYB0b5sovCwuXq6ib/0qw==
From: Troy Figiel <troy@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH go-team] build-system/go: Allow providing additional test
 flags.
Date: Sun, 25 Feb 2024 10:06:52 +0100
Message-ID: <87a5noaot3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4TjJ3L1NK5z9scT
Received-SPF: pass client-ip=80.241.56.152; envelope-from=troy@HIDDEN;
 helo=mout-p-102.mailbox.org
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

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





Acknowledgement sent to Troy Figiel <troy@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#69376; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 25 Feb 2024 09:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.