From patchwork Sun Feb 25 09:06:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Figiel X-Patchwork-Id: 61100 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4469827BBE9; Sun, 25 Feb 2024 09:14:52 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id BF5AE27BBE2 for ; Sun, 25 Feb 2024 09:14:50 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1reAak-0006d5-MT; Sun, 25 Feb 2024 04:14:38 -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 ) id 1reAaj-0006cv-Po for guix-patches@gnu.org; Sun, 25 Feb 2024 04:14:37 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1reAaj-0001og-Hq for guix-patches@gnu.org; Sun, 25 Feb 2024 04:14:37 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1reAb8-0005Mf-5H for guix-patches@gnu.org; Sun, 25 Feb 2024 04:15:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69376] [PATCH go-team] build-system/go: Allow providing additional test flags. Resent-From: Troy Figiel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 25 Feb 2024 09:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69376 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69376@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.170885249620584 (code B ref -1); Sun, 25 Feb 2024 09:15:01 +0000 Received: (at submit) by debbugs.gnu.org; 25 Feb 2024 09:14:56 +0000 Received: from localhost ([127.0.0.1]:56927 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1reAb2-0005Lt-2P for submit@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 ) id 1reAaz-0005Lh-Se for submit@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 ) id 1reAaa-0006cN-PJ for guix-patches@gnu.org; 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 ) id 1reAaX-0001mo-Rq for guix-patches@gnu.org; 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 ; 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 Date: Sun, 25 Feb 2024 10:06:52 +0100 Message-ID: <87a5noaot3.fsf@troyfigiel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4TjJ3L1NK5z9scT Received-SPF: pass client-ip=80.241.56.152; envelope-from=troy@troyfigiel.com; 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches 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(-) base-commit: 1306beaf3f6c8ddded2a956f5863bc65aad78882 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)