From dfcc96d8f48716ae5aefb383c58b153d5bcb407c Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Wed, 3 Nov 2021 12:07:22 -0400 Subject: build: meson: Replace the 'test-target' argument by 'test-options'. This change is motivated by the need to disable the default 30 seconds timeout that Meson uses (see: https://gitlab.gnome.org/GNOME/glib/-/issues/2522), and also by desire to specify extra options to run the check phase without having to override it. * guix/build-system/meson.scm (meson-build) : Replace argument with... : ... this one. * guix/build/meson-build-system.scm (check): Invoke 'meson test' instead of 'ninja test-target', as the former is configurable via options. * doc/guix.texi (Build Systems) : Update doc. --- guix/build-system/meson.scm | 12 ++++++------ guix/build/meson-build-system.scm | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 14 deletions(-) (limited to 'guix') diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm index 198aa08729..ba7441a3eb 100644 --- a/guix/build-system/meson.scm +++ b/guix/build-system/meson.scm @@ -169,7 +169,7 @@ (define* (meson-build name inputs (search-paths '()) (build-type "debugoptimized") (tests? #t) - (test-target "test") + (test-options ''()) (glib-or-gtk? #f) (parallel-build? #t) (parallel-tests? #f) @@ -218,7 +218,7 @@ (define build-phases configure-flags) #:build-type #$build-type #:tests? #$tests? - #:test-target #$test-target + #:test-options #$(sexp->gexp test-options) #:parallel-build? #$parallel-build? #:parallel-tests? #$parallel-tests? #:validate-runpath? #$validate-runpath? @@ -251,7 +251,7 @@ (define* (meson-cross-build name (build-type "debugoptimized") (tests? #f) - (test-target "test") + (test-options ''()) (glib-or-gtk? #f) (parallel-build? #t) (parallel-tests? #f) @@ -281,7 +281,7 @@ (define inputs (if (null? target-inputs) (input-tuples->gexp host-inputs) #~(append #$(input-tuples->gexp host-inputs) - #+(input-tuples->gexp target-inputs)))) + #+(input-tuples->gexp target-inputs)))) (define builder (with-imported-modules imported-modules #~(begin @@ -306,7 +306,7 @@ (define build-phases #:native-inputs #+(input-tuples->gexp build-inputs) #:search-paths '#$(sexp->gexp (map search-path-specification->sexp - search-paths)) + search-paths)) #:native-search-paths '#$(sexp->gexp (map search-path-specification->sexp native-search-paths)) @@ -318,7 +318,7 @@ (define build-phases configure-flags)) #:build-type #$build-type #:tests? #$tests? - #:test-target #$test-target + #:test-options #$(sexp->gexp test-options) #:parallel-build? #$parallel-build? #:parallel-tests? #$parallel-tests? #:validate-runpath? #$validate-runpath? diff --git a/guix/build/meson-build-system.scm b/guix/build/meson-build-system.scm index cc2ba83889..61ce45367d 100644 --- a/guix/build/meson-build-system.scm +++ b/guix/build/meson-build-system.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2017 Peter Mikkelsen ;;; Copyright © 2018 Ricardo Wurmus ;;; Copyright © 2018 Marius Bakke +;;; Copyright © 2021 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -63,16 +64,17 @@ (define* (build #:key parallel-build? (number->string (parallel-job-count)) "1"))) -(define* (check #:key test-target parallel-tests? tests? +(define* (check #:key tests? test-options parallel-tests? #:allow-other-keys) - (setenv "MESON_TESTTHREADS" - (if parallel-tests? - (number->string (parallel-job-count)) - "1")) (if tests? - (invoke "ninja" test-target) - (format #t "test suite not run~%")) - #t) + (begin + (setenv "MESON_TESTTHREADS" + (if parallel-tests? + (number->string (parallel-job-count)) + "1")) + ;; Always provide "-t 0" to disable the 30 s default timeout. + (apply invoke "meson" "test" "--print-errorlogs" "-t" "0" test-options)) + (format #t "test suite not run~%"))) (define* (install #:rest args) (invoke "ninja" "install")) -- cgit v1.2.3