From patchwork Thu Dec 21 05:28:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaeme Sifat X-Patchwork-Id: 57942 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 7374F27BBEA; Thu, 21 Dec 2023 05:33:07 +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,FREEMAIL_FROM,MAILING_LIST_MULTI,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham 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 8B16D27BBE9 for ; Thu, 21 Dec 2023 05:33:06 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGBg4-0000Sv-RE; Thu, 21 Dec 2023 00:33:01 -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 1rGBg2-0000Pj-Si for guix-patches@gnu.org; Thu, 21 Dec 2023 00:32:59 -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 1rGBg2-0001SV-Iz for guix-patches@gnu.org; Thu, 21 Dec 2023 00:32:58 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rGBg6-0008F3-6W; Thu, 21 Dec 2023 00:33:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67947] [PATCH 2/3] guix: build-system: cargo: Add cargo-test-targets. Resent-From: Jaeme Sifat Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, guix-patches@gnu.org Resent-Date: Thu, 21 Dec 2023 05:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67947 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67947@debbugs.gnu.org Cc: Jaeme Sifat , Efraim Flashner X-Debbugs-Original-Xcc: Efraim Flashner Received: via spool by 67947-submit@debbugs.gnu.org id=B67947.170313672331595 (code B ref 67947); Thu, 21 Dec 2023 05:33:02 +0000 Received: (at 67947) by debbugs.gnu.org; 21 Dec 2023 05:32:03 +0000 Received: from localhost ([127.0.0.1]:42236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGBf8-0008DX-IF for submit@debbugs.gnu.org; Thu, 21 Dec 2023 00:32:02 -0500 Received: from mailtransmit04.runbox.com ([2a0c:5a00:149::25]:38936) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGBf4-0008Cw-40 for 67947@debbugs.gnu.org; Thu, 21 Dec 2023 00:32:01 -0500 Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by mailtransmit04.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1rGBes-000fTz-1M for 67947@debbugs.gnu.org; Thu, 21 Dec 2023 06:31:46 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector2; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To :Message-ID:Date:Subject:Cc:To:From; bh=l6WIy4lpg1XNSvsAZvGc0qEYLXt4GkAwHslarYKOQaM=; b=QpsX1aiDHUC55QY8rJWbBUzD+M 4F9PObrFG0FJjNYEdLJvOw8qTcobr0miTvt6jPU9ycAx8a6nW88F0UYI7kbWQluVHWRb9GXSblf50 C7wuoh6dwhBt5DWvS4Ipkh87lRychNa/z8tE3iTdkTTkyi7HWKniTQlft6PQLgJPOSdO+8tut/Aoj Um0+06cxnqwgPOqlzar/BFgbE/hFpMaUaSH6lGXkr5yjcXFmSwj93RSXE6tFQpm6c/uau/dJqXxyD oNpf1t8qE7X0aZT08z0n+YGWdfivI9eaDin0gC7z16BIBXQKavY3CYmzN2OLUY/+IAyydw8GCO5Rh 2RZzBK4g==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1rGBer-0003ip-NL for 67947@debbugs.gnu.org; Thu, 21 Dec 2023 06:31:45 +0100 Received: by submission03.runbox with esmtpsa [Authenticated ID (1176697)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) id 1rGBeh-008kIc-8X; Thu, 21 Dec 2023 06:31:35 +0100 Date: Thu, 21 Dec 2023 00:28:41 -0500 Message-ID: <413c758092a856dae0c8e8b2e02a36dd1649e4cb.1703135457.git.jaeme@runbox.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Jaeme Sifat X-ACL-Warn: , Jaeme Sifat via Guix-patches X-Patchwork-Original-From: Jaeme Sifat via Guix-patches via From: Jaeme Sifat 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 In addition to adding a key for skipping tests, there ought be a key for specifying which test target(s) should be ran without having to edit the #:cargo-test-flags key directly. * guix/build-system/cargo.scm (cargo-build): Add cargo-test-targets. * guix/build-system/cargo.scm (builder): Add cargo-test-targets. * guix/build-system/cargo.scm (cargo-cross-build): Add cargo-test-targets. * guix/build/cargo-build-system.scm (check): Add cargo-test-targets. Change-Id: Ibdf3cffd2b0f3fdbfe269189975c739192c14f64 --- guix/build-system/cargo.scm | 4 ++++ guix/build/cargo-build-system.scm | 25 +++++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index d2a45f0609..7878a3bd6d 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -86,6 +86,7 @@ (define* (cargo-build name inputs (vendor-dir "guix-vendor") (cargo-build-flags ''("--release")) (cargo-test-flags ''("--release")) + (cargo-test-targets ''()) (cargo-skip-tests ''()) (cargo-package-flags ''("--no-metadata" "--no-verify")) (features ''()) @@ -113,6 +114,7 @@ (define* (cargo-build name inputs #:vendor-dir #$vendor-dir #:cargo-build-flags #$(sexp->gexp cargo-build-flags) #:cargo-test-flags #$(sexp->gexp cargo-test-flags) + #:cargo-test-targets #$(sexp->gexp cargo-test-targets) #:cargo-skip-tests #$(sexp->gexp cargo-skip-tests) #:cargo-package-flags #$(sexp->gexp cargo-package-flags) #:features #$(sexp->gexp features) @@ -143,6 +145,7 @@ (define* (cargo-cross-build name (vendor-dir "guix-vendor") (cargo-build-flags ''("--release")) (cargo-test-flags ''("--release")) + (cargo-test-targets ''()) (cargo-skip-tests ''()) (cargo-package-flags ''("--no-metadata" "--no-verify")) (features ''()) @@ -172,6 +175,7 @@ (define* (cargo-cross-build name #:vendor-dir #$vendor-dir #:cargo-build-flags #$(sexp->gexp cargo-build-flags) #:cargo-test-flags #$(sexp->gexp cargo-test-flags) + #:cargo-test-targets #$(sexp->gexp cargo-test-targets) #:cargo-skip-tests #$(sexp->gexp cargo-skip-tests) #:cargo-package-flags #$(sexp->gexp cargo-package-flags) #:features #$(sexp->gexp features) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 7cdb2a72d3..5abedfc726 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -258,19 +258,28 @@ (define* (build #:key (define* (check #:key tests? + cargo-test-targets cargo-skip-tests (cargo-test-flags '("--release")) #:allow-other-keys) "Run tests for a given Cargo package." (if tests? - (if cargo-skip-tests - (let ((test-lst (map (lambda (test) - (string-append "--skip=" test)) - cargo-skip-tests))) - (apply invoke "cargo" "test" (append - cargo-test-flags - (cons* "--" test-lst)))) - (apply invoke "cargo" "test" cargo-test-flags)) + (let* ((cargo-test-targets-flags + (when cargo-test-targets + (map (lambda (section) + (string-append "--" section)) + cargo-test-targets))) + (cargo-skip-tests-flags + (when cargo-skip-tests + (map (lambda (test) + (string-append "--skip=" test)) + cargo-skip-tests))) + (cargo-test-flags + (append cargo-test-flags + cargo-test-targets-flags + '("--") + cargo-skip-tests-flags))) + (apply invoke "cargo" "test" cargo-test-flags)) #t)) (define* (package #:key