[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#67947] [PATCH 1/3] guix: build-system: cargo: Add cargo-skip-tests.
From: |
Jaeme Sifat |
Subject: |
[bug#67947] [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