[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#70031] [PATCH v2 01/65] build-system/cmake: Parallelize tests using
From: |
Greg Hogan |
Subject: |
[bug#70031] [PATCH v2 01/65] build-system/cmake: Parallelize tests using ctest. |
Date: |
Tue, 22 Oct 2024 18:08:51 +0000 |
* guix/build/cmake-build-system.scm (check): Replace call to gnu-build's
non-parallelizable check with an implementation using cmake's ctest.
---
guix/build/cmake-build-system.scm | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/guix/build/cmake-build-system.scm
b/guix/build/cmake-build-system.scm
index d1ff5071be..1109b5c7c4 100644
--- a/guix/build/cmake-build-system.scm
+++ b/guix/build/cmake-build-system.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2014, 2015 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2024 Greg Hogan <code@greghogan.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -23,6 +24,7 @@ (define-module (guix build cmake-build-system)
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
#:use-module (guix build utils)
#:use-module (ice-9 match)
+ #:use-module (srfi srfi-34)
#:export (%standard-phases
cmake-build))
@@ -77,12 +79,26 @@ (define* (configure #:key outputs (configure-flags '())
(out-of-source? #t)
(format #t "running 'cmake' with arguments ~s~%" args)
(apply invoke "cmake" args))))
-(define* (check #:key (tests? #t) (parallel-tests? #t) (test-target "test")
+(define %test-suite-log-regexp
+ ;; Name of test suite log files as commonly found in CMake.
+ "^LastTest\\.log$")
+
+(define* (check #:key (tests? #t) (parallel-tests? #t)
+ (test-suite-log-regexp %test-suite-log-regexp)
#:allow-other-keys)
- (let ((gnu-check (assoc-ref gnu:%standard-phases 'check)))
- (setenv "CTEST_OUTPUT_ON_FAILURE" "1")
- (gnu-check #:tests? tests? #:test-target test-target
- #:parallel-tests? parallel-tests?)))
+ (if tests?
+ (guard (c ((invoke-error? c)
+ ;; Dump the test suite log to facilitate debugging.
+ (display "\nTest suite failed, dumping logs.\n"
+ (current-error-port))
+ (gnu:dump-file-contents "." test-suite-log-regexp)
+ (raise c)))
+ (apply invoke "ctest" "--output-on-failure"
+ `(,@(if parallel-tests?
+ `("-j" ,(number->string (parallel-job-count)))
+ ;; When unset CMake defers to the build system.
+ '("-j" "1")))))
+ (format #t "test suite not run~%")))
(define %standard-phases
;; Everything is as with the GNU Build System except for the `configure'
--
2.46.1
- [bug#70031] [PATCH v2 00/65] Use CMake in build-system/cmake., Greg Hogan, 2024/10/22
- [bug#70031] [PATCH v2 01/65] build-system/cmake: Parallelize tests using ctest.,
Greg Hogan <=
- [bug#70031] [PATCH v2 02/65] build-system/cmake: Add generator fields., Greg Hogan, 2024/10/22
- [bug#70031] [PATCH v2 03/65] build-system/qt: Add generator fields., Greg Hogan, 2024/10/22
- [bug#70031] [PATCH v2 08/65] build-system/qt: Add test-exclude fields., Greg Hogan, 2024/10/22
- [bug#70031] [PATCH v2 09/65] build-system/cmake: Add test exclusion., Greg Hogan, 2024/10/22
- [bug#70031] [PATCH v2 05/65] build-system/cmake: Add build., Greg Hogan, 2024/10/22
- [bug#70031] [PATCH v2 07/65] build-system/cmake: Add test-exclude fields., Greg Hogan, 2024/10/22
- [bug#70031] [PATCH v2 06/65] build-system/cmake: Add install., Greg Hogan, 2024/10/22
- [bug#70031] [PATCH v2 11/65] build-system/cmake: Include ninja., Greg Hogan, 2024/10/22
- [bug#70031] [PATCH v2 12/65] build-system/qt: Include ninja., Greg Hogan, 2024/10/22
- [bug#70031] [PATCH v2 14/65] gnu: rdma-core: Remove custom phases., Greg Hogan, 2024/10/22