@@ -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)
@@ -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