all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jaeme Sifat via Guix-patches via <guix-patches@gnu.org>
To: 67947@debbugs.gnu.org
Cc: Jaeme Sifat <jaeme@runbox.com>, Efraim Flashner <efraim@flashner.co.il>
Subject: [bug#67947] [PATCH 1/3] guix: build-system: cargo: Add cargo-skip-tests.
Date: Thu, 21 Dec 2023 00:28:40 -0500	[thread overview]
Message-ID: <a6fe9279323eb1fac32153134c5a0bf34ce8cb17.1703135457.git.jaeme@runbox.com> (raw)
In-Reply-To: <cover.1703135457.git.jaeme@runbox.com>

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





  reply	other threads:[~2023-12-21  5:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21  5:11 [bug#67947] [PATCH 0/3 rust-team] guix: cargo-build-system: Add test keys Jaeme Sifat via Guix-patches via
2023-12-21  5:28 ` Jaeme Sifat via Guix-patches via [this message]
2023-12-21  5:28 ` [bug#67947] [PATCH 2/3] guix: build-system: cargo: Add cargo-test-targets Jaeme Sifat via Guix-patches via
2023-12-21  5:28 ` [bug#67947] [PATCH 3/3] guix: Add copyright notice Jaeme Sifat via Guix-patches via
2024-10-31 15:19 ` [bug#67947] cargo-build-system: Add test keys Steve George

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a6fe9279323eb1fac32153134c5a0bf34ce8cb17.1703135457.git.jaeme@runbox.com \
    --to=guix-patches@gnu.org \
    --cc=67947@debbugs.gnu.org \
    --cc=efraim@flashner.co.il \
    --cc=jaeme@runbox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.