Package: guix-patches;
Reported by: Jaeme Sifat <jaeme <at> runbox.com>
Date: Thu, 21 Dec 2023 05:27:01 UTC
Severity: normal
Tags: patch
To reply to this bug, email your comments to 67947 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
efraim <at> flashner.co.il, guix-patches <at> gnu.org
:bug#67947
; Package guix-patches
.
(Thu, 21 Dec 2023 05:27:01 GMT) Full text and rfc822 format available.Jaeme Sifat <jaeme <at> runbox.com>
:efraim <at> flashner.co.il, guix-patches <at> gnu.org
.
(Thu, 21 Dec 2023 05:27:01 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Jaeme Sifat <jaeme <at> runbox.com> To: guix-patches <at> gnu.org Cc: Jaeme Sifat <jaeme <at> runbox.com> Subject: [PATCH 0/3 rust-team] guix: cargo-build-system: Add test keys. Date: Thu, 21 Dec 2023 00:11:23 -0500
I propose adding two new keys for the 'check phase of the cargo-build-system. One is #:cargo-skip-tests which accepts a list of strings representing the names of the tests to be skipped and the other is #:cargo-test-targets which accepts a list of strings representing the test targets to be ran. The goal of adding these two keys is to make it so that the packager doesn't have to interface directly with #:cargo-test-flags which is set to --release mode by default. I believe that this leads to cleaner looking build definitions that should be easier to bind to something say, a web-based package definition editor that exists right now. These patches are just a draft of this feature I cooked up. Here's what they should look like in action with the rust-alsa crate: --8<---------------cut here---------------start------------->8--- (define-public rust-alsa-0.8 (package ... (build-system cargo-build-system) (arguments `(#:cargo-test-targets (list "lib" "bins" "tests") #:cargo-skip-tests (list "pcm::drop" "pcm::info_from_default" "pcm::playback_to_default" "pcm::record_from_default" "seq::print_seqs" "seq::seq_loopback" "seq::seq_portsubscribeiter" "seq::seq_subscribe") #:cargo-inputs (("rust-alsa-sys" ,rust-alsa-sys-0.3) ("rust-bitflags" ,rust-bitflags-2) ("rust-libc" ,rust-libc-0.2) ("rust-nix" ,rust-nix-0.26)))) ...)) --8<---------------cut here---------------end--------------->8--- I would like to hear the feedback on this change and its implementation. Of course, if this change is accepted, then there ought to be an update to the Rust crates section of 'Contributing' in the Guix manual that details this. Jaeme Sifat (3): guix: build-system: cargo: Add cargo-skip-tests. guix: build-system: cargo: Add cargo-test-targets. guix: Add copyright notice. guix/build-system/cargo.scm | 9 +++++++++ guix/build/cargo-build-system.scm | 20 +++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) base-commit: 49a7a95ba44e231e9e15a274f9a96de6fa012daf -- 2.41.0
efraim <at> flashner.co.il, guix-patches <at> gnu.org
:bug#67947
; Package guix-patches
.
(Thu, 21 Dec 2023 05:31:02 GMT) Full text and rfc822 format available.Message #8 received at 67947 <at> debbugs.gnu.org (full text, mbox):
From: Jaeme Sifat <jaeme <at> runbox.com> To: 67947 <at> debbugs.gnu.org Cc: Jaeme Sifat <jaeme <at> runbox.com> Subject: [PATCH 1/3] guix: build-system: cargo: Add cargo-skip-tests. Date: Thu, 21 Dec 2023 00:28:40 -0500
The #:cargo-skip-tests key accepts a list of strings that represent the names of tests to be skipped by passing the "--skip=<test-name>" to cargo test. This is so that the packager doesn't have to edit #:cargo-test-flags directly when trying to skip tests. * guix/build-system/cargo.scm (cargo-build): Add cargo-skip-tests. * guix/build-system/cargo.scm (builder): Add cargo-skip-tests. * guix/build-system/cargo.scm (cargo-cross-build): Add cargo-skip-tests. * guix/build/cargo-build-system.scm (check): Add cargo-skip-tests. Change-Id: I2f64370cf29b9495a33a8e072ab930b8635e742d --- guix/build-system/cargo.scm | 4 ++++ guix/build/cargo-build-system.scm | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index c029cc1dda..d2a45f0609 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-skip-tests ''()) (cargo-package-flags ''("--no-metadata" "--no-verify")) (features ''()) (skip-build? #f) @@ -112,6 +113,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-skip-tests #$(sexp->gexp cargo-skip-tests) #:cargo-package-flags #$(sexp->gexp cargo-package-flags) #:features #$(sexp->gexp features) #:skip-build? #$skip-build? @@ -141,6 +143,7 @@ (define* (cargo-cross-build name (vendor-dir "guix-vendor") (cargo-build-flags ''("--release")) (cargo-test-flags ''("--release")) + (cargo-skip-tests ''()) (cargo-package-flags ''("--no-metadata" "--no-verify")) (features ''()) (skip-build? #f) @@ -169,6 +172,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-skip-tests #$(sexp->gexp cargo-skip-tests) #:cargo-package-flags #$(sexp->gexp cargo-package-flags) #:features #$(sexp->gexp features) #:skip-build? #$skip-build? diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index ffb2ec898e..7cdb2a72d3 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -258,11 +258,19 @@ (define* (build #:key (define* (check #:key tests? + cargo-skip-tests (cargo-test-flags '("--release")) #:allow-other-keys) "Run tests for a given Cargo package." (if tests? - (apply invoke "cargo" "test" cargo-test-flags) + (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)) #t)) (define* (package #:key -- 2.41.0
efraim <at> flashner.co.il, guix-patches <at> gnu.org
:bug#67947
; Package guix-patches
.
(Thu, 21 Dec 2023 05:33:02 GMT) Full text and rfc822 format available.Message #11 received at 67947 <at> debbugs.gnu.org (full text, mbox):
From: Jaeme Sifat <jaeme <at> runbox.com> To: 67947 <at> debbugs.gnu.org Cc: Jaeme Sifat <jaeme <at> runbox.com> Subject: [PATCH 2/3] guix: build-system: cargo: Add cargo-test-targets. Date: Thu, 21 Dec 2023 00:28:41 -0500
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 -- 2.41.0
efraim <at> flashner.co.il, guix-patches <at> gnu.org
:bug#67947
; Package guix-patches
.
(Thu, 21 Dec 2023 05:34:01 GMT) Full text and rfc822 format available.Message #14 received at 67947 <at> debbugs.gnu.org (full text, mbox):
From: Jaeme Sifat <jaeme <at> runbox.com> To: 67947 <at> debbugs.gnu.org Cc: Jaeme Sifat <jaeme <at> runbox.com> Subject: [PATCH 3/3] guix: Add copyright notice. Date: Thu, 21 Dec 2023 00:28:42 -0500
* guix/build-system/cargo.scm: Add copyright notice. * guix/build/cargo-build-system.scm: Add copyright notice. Change-Id: I1ccffda9ce10e9bbe75ba573b7de763d0c42d899 --- guix/build-system/cargo.scm | 1 + guix/build/cargo-build-system.scm | 1 + 2 files changed, 2 insertions(+) diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index 7878a3bd6d..ef78a18b5f 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2019 Ivan Petkov <ivanppetkov <at> gmail.com> ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net> ;;; Copyright © 2021 Efraim Flashner <efraim <at> flashner.co.il> +;;; Copyright © 2023 Jaeme Sifat <jaeme <at> runbox.com> ;;; ;;; This file is part of GNU Guix. ;;; diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 5abedfc726..3c74d11911 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2019-2023 Efraim Flashner <efraim <at> flashner.co.il> ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net> ;;; Copyright © 2020 Marius Bakke <marius <at> gnu.org> +;;; Copyright © 2023 Jaeme Sifat <jaeme <at> runbox.com> ;;; ;;; This file is part of GNU Guix. ;;; -- 2.41.0
guix-patches <at> gnu.org
:bug#67947
; Package guix-patches
.
(Thu, 31 Oct 2024 15:20:02 GMT) Full text and rfc822 format available.Message #17 received at 67947 <at> debbugs.gnu.org (full text, mbox):
From: Steve George <steve <at> futurile.net> To: 67947 <at> debbugs.gnu.org Cc: Efraim Flashner <efraim <at> flashner.co.il> Subject: RE: cargo-build-system: Add test keys. Date: Thu, 31 Oct 2024 15:19:16 +0000
Hi, #67947 was the idea of adding some test keys to make testing easier. Unsure if it aligns with the other build-systems, but sounds great. Bumping ... Futurile
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.