all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: 74767@debbugs.gnu.org
Subject: [bug#74767] [PATCH rust-team 02/23] build/cargo: Honor #:parallel-build? and #:parallel-tests? arguments.
Date: Tue, 10 Dec 2024 17:37:20 +0200	[thread overview]
Message-ID: <Z1hgMHWbGp3qu4sH@3900XT> (raw)
In-Reply-To: <b339f673a52517b06372bb47940be72c5ebc5d56.1733840023.git.maxim.cournoyer@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 5683 bytes --]

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@gmail.com>
>  ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
>  ;;; Copyright © 2021, 2024 Efraim Flashner <efraim@flashner.co.il>
> +;;; Copyright © 2024 Maxim Cournoyer <maxim.cournoyer@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@flashner.co.il>
>  ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
>  ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
> +;;; Copyright © 2024 Maxim Cournoyer <maxim.cournoyer@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@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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-12-10 18:44 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10 14:15 [bug#74767] [PATCH rust-team 00/23] Add py-spy Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 01/23] build/cargo: Delete trailing #t in phases Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 02/23] build/cargo: Honor #:parallel-build? and #:parallel-tests? arguments Maxim Cournoyer
2024-12-10 15:37   ` Efraim Flashner [this message]
2024-12-11  1:11     ` Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 03/23] build/cargo: Resolve byte compilation warning Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 04/23] gnu: Add rust-read-process-memory-0.1 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 05/23] gnu: Update ust-wasmparser to 0.218 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 06/23] gnu: rust-ruzstd-0.7: Update to 0.7.3 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 07/23] gnu: rust-libc-0.2: Update to 0.2.168 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 08/23] gnu: rust-proc-macro2-1: Update to 1.0.92 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 09/23] gnu: rust-syn-test-suite-0.0.0: Update to 0.0.0+test Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 10/23] gnu: rust-syn-2: Update to 2.0.90 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 11/23] gnu: Add rust-zerocopy-derive-0.8 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 12/23] gnu: rust-object-0.36: Update to 0.36.5 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 13/23] gnu: rust-gimli-0.31: Update to 0.31.1 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 14/23] gnu: Add rust-goblin-0.9 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 15/23] gnu: Add rust-proc-maps-0.4 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 16/23] gnu: Add rust-mark-flaky-tests-macro-1 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 17/23] gnu: Add rust-mark-flaky-tests-1 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 18/23] gnu: Add rust-remoteprocess-0.5 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 19/23] gnu: Add rust-lru-0.10 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 20/23] gnu: rust-rle-decode-fast-1: Update to 1.0.3 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 21/23] gnu: rust-inferno-0.11: Update to 0.11.21 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 22/23] gnu: Add rust-py-spy-testdata-0.1 Maxim Cournoyer
2024-12-10 14:21 ` [bug#74767] [PATCH rust-team 23/23] gnu: Add py-spy Maxim Cournoyer
2024-12-11  1:48 ` [bug#74767] [PATCH PATCH rust-team v2 01/24] gnu: rust-1.55: Use minimal variant of python-wrapper Maxim Cournoyer
2024-12-11  1:48   ` [bug#74767] [PATCH PATCH rust-team v2 02/24] build/cargo: Delete trailing #t in phases Maxim Cournoyer
2024-12-11  1:48   ` [bug#74767] [PATCH PATCH rust-team v2 03/24] build/cargo: Honor #:parallel-build? and #:parallel-tests? arguments Maxim Cournoyer
2024-12-11  1:48   ` [bug#74767] [PATCH PATCH rust-team v2 04/24] build/cargo: Resolve byte compilation warning Maxim Cournoyer
2024-12-11  1:48   ` [bug#74767] [PATCH PATCH rust-team v2 05/24] gnu: Add rust-read-process-memory-0.1 Maxim Cournoyer
2024-12-11  1:48   ` [bug#74767] [PATCH PATCH rust-team v2 06/24] gnu: Update rust-wasmparser to 0.218 Maxim Cournoyer
2024-12-11  1:48   ` [bug#74767] [PATCH PATCH rust-team v2 07/24] gnu: rust-ruzstd-0.7: Update to 0.7.3 Maxim Cournoyer
2024-12-11  1:48   ` [bug#74767] [PATCH PATCH rust-team v2 08/24] gnu: rust-libc-0.2: Update to 0.2.168 Maxim Cournoyer
2024-12-11  1:48   ` [bug#74767] [PATCH PATCH rust-team v2 09/24] gnu: rust-proc-macro2-1: Update to 1.0.92 Maxim Cournoyer
2024-12-11  1:48   ` [bug#74767] [PATCH PATCH rust-team v2 10/24] gnu: rust-syn-test-suite-0.0.0: Update to 0.0.0+test Maxim Cournoyer
2024-12-11  1:48   ` [bug#74767] [PATCH PATCH rust-team v2 11/24] gnu: rust-syn-2: Update to 2.0.90 Maxim Cournoyer
2024-12-11  1:48   ` [bug#74767] [PATCH PATCH rust-team v2 12/24] gnu: Add rust-zerocopy-derive-0.8 Maxim Cournoyer
2024-12-11  1:49   ` [bug#74767] [PATCH PATCH rust-team v2 13/24] gnu: rust-object-0.36: Update to 0.36.5 Maxim Cournoyer
2024-12-11  1:49   ` [bug#74767] [PATCH PATCH rust-team v2 14/24] gnu: rust-gimli-0.31: Update to 0.31.1 Maxim Cournoyer
2024-12-11  1:49   ` [bug#74767] [PATCH PATCH rust-team v2 15/24] gnu: Add rust-goblin-0.9 Maxim Cournoyer
2024-12-11  1:49   ` [bug#74767] [PATCH PATCH rust-team v2 16/24] gnu: Add rust-proc-maps-0.4 Maxim Cournoyer
2024-12-11  1:49   ` [bug#74767] [PATCH PATCH rust-team v2 17/24] gnu: Add rust-mark-flaky-tests-macro-1 Maxim Cournoyer
2024-12-11  1:49   ` [bug#74767] [PATCH PATCH rust-team v2 18/24] gnu: Add rust-mark-flaky-tests-1 Maxim Cournoyer
2024-12-11  1:49   ` [bug#74767] [PATCH PATCH rust-team v2 19/24] gnu: Add rust-remoteprocess-0.5 Maxim Cournoyer
2024-12-11  1:49   ` [bug#74767] [PATCH PATCH rust-team v2 20/24] gnu: Add rust-lru-0.10 Maxim Cournoyer
2024-12-11  1:49   ` [bug#74767] [PATCH PATCH rust-team v2 21/24] gnu: rust-rle-decode-fast-1: Update to 1.0.3 Maxim Cournoyer
2024-12-11  1:49   ` [bug#74767] [PATCH PATCH rust-team v2 22/24] gnu: rust-inferno-0.11: Update to 0.11.21 Maxim Cournoyer
2024-12-11  1:49   ` [bug#74767] [PATCH PATCH rust-team v2 23/24] gnu: Add rust-py-spy-testdata-0.1 Maxim Cournoyer
2024-12-11  1:49   ` [bug#74767] [PATCH PATCH rust-team v2 24/24] gnu: Add py-spy Maxim Cournoyer

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=Z1hgMHWbGp3qu4sH@3900XT \
    --to=efraim@flashner.co.il \
    --cc=74767@debbugs.gnu.org \
    --cc=maxim.cournoyer@gmail.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.