GNU bug report logs -
#74767
[PATCH rust-team 00/23] Add py-spy.
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Should probably have cargo test not honor both parallel-build and
parallel-tests at the same time.
Also, currently the builds and tests try to use all the cores available,
so if parallel-{build,tests} is false it should go down to 1.
On Tue, Dec 10, 2024 at 11:21:05PM +0900, Maxim Cournoyer wrote:
> * guix/build-system/cargo.scm (cargo-build): Add #:parallel-build? and
> #:parallel-tests? arguments.
> (cargo-cross-build): Likewise.
> * guix/build/cargo-build-system.scm (build): Honor them.
> (check): Likewise.
>
> Change-Id: Idbee7aa3a6a7cd0fc222082837390b83cc8e8c07
> ---
> guix/build-system/cargo.scm | 9 +++++++++
> guix/build/cargo-build-system.scm | 23 ++++++++++++++++++++---
> 2 files changed, 29 insertions(+), 3 deletions(-)
>
> diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
> index f24ff6195e..ea841a34eb 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, 2024 Efraim Flashner <efraim <at> flashner.co.il>
> +;;; Copyright © 2024 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -95,6 +96,8 @@ (define* (cargo-build name inputs
> (cargo-package-flags ''("--no-metadata" "--no-verify"))
> (features ''())
> (skip-build? #f)
> + (parallel-build? #t)
> + (parallel-tests? #t)
> (install-source? #t)
> (phases '%standard-phases)
> (outputs '("out"))
> @@ -122,6 +125,8 @@ (define* (cargo-build name inputs
> #:cargo-target #$(cargo-triplet system)
> #:features #$(sexp->gexp features)
> #:skip-build? #$skip-build?
> + #:parallel-build? #$parallel-build?
> + #:parallel-tests? #$parallel-tests?
> #:install-source? #$install-source?
> #:tests? #$(and tests? (not skip-build?))
> #:phases #$(if (pair? phases)
> @@ -152,6 +157,8 @@ (define* (cargo-cross-build name
> (cargo-target (cargo-triplet (or target system)))
> (features ''())
> (skip-build? #f)
> + (parallel-build? #t)
> + (parallel-tests? #t)
> (install-source? (not (target-mingw? target)))
> (phases '%standard-phases)
> (outputs '("out"))
> @@ -181,6 +188,8 @@ (define* (cargo-cross-build name
> #:cargo-target #$(cargo-triplet (or target system))
> #:features #$(sexp->gexp features)
> #:skip-build? #$skip-build?
> + #:parallel-build? #$parallel-build?
> + #:parallel-tests? #$parallel-tests?
> #:install-source? #$install-source?
> #:tests? #$(and tests? (not skip-build?))
> #:phases #$(if (pair? phases)
> diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm
> index 84897393d9..d125ff20ca 100644
> --- a/guix/build/cargo-build-system.scm
> +++ b/guix/build/cargo-build-system.scm
> @@ -5,6 +5,7 @@
> ;;; Copyright © 2019-2024 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 © 2024 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -239,19 +240,35 @@ (define* (build #:key
> (or skip-build?
> (apply invoke
> `("cargo" "build"
> + ,@(if parallel-build?
> + (list "-j" (number->string (parallel-job-count)))
> + '())
> ,@(if (null? features)
> '()
> `("--features" ,(string-join features)))
> ,@cargo-build-flags))))
>
> (define* (check #:key
> + parallel-build?
> + parallel-tests?
> tests?
> (cargo-test-flags '("--release"))
> #:allow-other-keys)
> "Run tests for a given Cargo package."
> - (if tests?
> - (apply invoke "cargo" "test" cargo-test-flags)
> - #t))
> + (when tests?
> + (apply invoke
> + `("cargo" "test"
> + ,@(if parallel-build?
> + (list "-j" (number->string (parallel-job-count)))
> + '())
> + ,@cargo-test-flags
> + ,@(if parallel-tests?
> + (append (if (member "--" cargo-test-flags)
> + '()
> + '("--"))
> + (list "--test-threads"
> + (number->string (parallel-job-count))))
> + '())))))
>
> (define* (package #:key
> source
> --
> 2.46.0
>
>
>
--
Efraim Flashner <efraim <at> flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 153 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.