Subject: [PATCH 0/3 rust-team] guix: cargo-build-system: Add test keys.

From: Jaeme Sifat <[email-masked]>
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