From cfe7ed9732e77eacf7f9e6b6db0d731b2f7d100e Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sun, 19 Jul 2020 23:13:28 -0400 Subject: [PATCH] gnu: rust: Disable check phases of versions before 1.40. This saves 49 hours of total build time on a Thinkpad X200. * gnu/packages/rust.scm (rust-1.19)[arguments]: Add "#:tests? #f". (rust-1.20, rust-1.26)[arguments]: Modify the custom 'check' phase to honor the '#:tests?' argument. (rust-1.40)[arguments]: Override '#:tests?' argument to be #t. --- gnu/packages/rust.scm | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 3952a17908..2b9f26c204 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -236,6 +236,8 @@ safety and thread safety guarantees.") (arguments `(#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums' #:modules ((guix build utils) (ice-9 match) (guix build gnu-build-system)) + #:tests? #f ;Disable the test suite for early versions of rust to save + ;compile time. #:phases (modify-phases %standard-phases (add-after 'unpack 'set-env @@ -596,11 +598,16 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" (invoke "./x.py" "build") (invoke "./x.py" "build" "src/tools/cargo"))) (replace 'check - (lambda* _ - ;; Disable parallel execution to prevent EAGAIN errors when - ;; running tests. - (invoke "./x.py" "-j1" "test" "-vv") - (invoke "./x.py" "-j1" "test" "src/tools/cargo") + (lambda* (#:key (tests? #t) #:allow-other-keys) + (if tests? + (let ((parallel-job-spec + ;; Disable parallel execution to prevent EAGAIN + ;; errors when running tests. + "-j1")) + (invoke "./x.py" parallel-job-spec "test" "-vv") + (invoke "./x.py" parallel-job-spec "test" + "src/tools/cargo")) + (format #t "test suite not run~%")) #t)) (replace 'install (lambda* (#:key outputs #:allow-other-keys) @@ -774,15 +781,16 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" ;; binaryen was replaced with LLD project from LLVM (delete 'dont-build-native) (replace 'check - (lambda* _ - ;; Enable parallel execution. - (let ((parallel-job-spec - (string-append "-j" (number->string - (min 4 - (parallel-job-count)))))) - (invoke "./x.py" parallel-job-spec "test" "-vv") - (invoke "./x.py" parallel-job-spec "test" - "src/tools/cargo")))) + (lambda* (#:key (tests? #t) #:allow-other-keys) + (if tests? + (let ((parallel-job-spec + ;; Enable parallel execution. + (format #f "-j~a" (min 4 (parallel-job-count))))) + (invoke "./x.py" parallel-job-spec "test" "-vv") + (invoke "./x.py" parallel-job-spec "test" + "src/tools/cargo")) + (format #t "test suite not run~%")) + #t)) (replace 'remove-unsupported-tests (lambda* _ ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH. @@ -1226,6 +1234,10 @@ move around." ;; which makes this workaround only necessary for this release. (cons* #:validate-runpath? #f (substitute-keyword-arguments (package-arguments base-rust) + ((#:tests? _ #t) + ;; Enable the test suite, which was disabled for earlier versions + ;; of rust to save compile time. + #t) ((#:phases phases) `(modify-phases ,phases ;; We often need to patch tests with various Guix-specific paths. -- 2.31.1