guix_mirror_bot pushed a commit to branch c++-team in repository guix. commit 161f9d174eb50a1d7eabed3f221b38f7925cbd98 Author: Greg Hogan <c...@greghogan.com> AuthorDate: Fri Jul 11 19:04:53 2025 +0000
gnu: cmake-build: Retry failed tests. * guix/build-system/cmake.scm (cmake-build, cmake-cross-build), * guix/build-system/qt.scm (qt-build, qt-cross-build): Add test-repeat-until-pass? and test-repeat-until-pass-count fields. * guix/build/cmake-build-system.scm (check): Add and use new fields. * doc/guix.texi: Document new parameters. Change-Id: I046dfc86a18fb2a2be4ae362c1226c2f8cab129c --- doc/guix.texi | 10 ++++++++++ guix/build-system/cmake.scm | 8 ++++++++ guix/build-system/qt.scm | 8 ++++++++ guix/build/cmake-build-system.scm | 9 ++++++++- 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index ebf5b9d36b..6985355808 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9727,6 +9727,16 @@ responsible for writing the input files for the native build system. @item #:test-exclude Tests matching this regular expression are excluded from testing by @url{https://cmake.org/cmake/help/latest/manual/ctest.1.html, ctest}. + +@item #:test-repeat-until-pass? +Directs @url{https://cmake.org/cmake/help/latest/manual/ctest.1.html, ctest} to +@url{https://cmake.org/cmake/help/latest/manual/ctest.1.html#cmdoption-ctest-repeat, repeat} +failed tests up to @code{#:test-repeat-until-pass-count} times and is enabled by +default. + +@item #:test-repeat-until-pass-count +When @code{#:test-repeat-until-pass?} is enabled this parameter sets the maximum +number of failures for each test. The default is @code{5}. @end table @end defvar diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm index a453ee8868..b0587fddf0 100644 --- a/guix/build-system/cmake.scm +++ b/guix/build-system/cmake.scm @@ -129,6 +129,8 @@ (build-type "RelWithDebInfo") (tests? #t) (test-exclude "") + (test-repeat-until-pass? #t) + (test-repeat-until-pass-count 5) (parallel-build? #t) (parallel-tests? #t) (validate-runpath? #t) (patch-shebangs? #t) @@ -170,6 +172,8 @@ provides a 'CMakeLists.txt' file as its build system." #:build-type #$build-type #:tests? #$tests? #:test-exclude #$test-exclude + #:test-repeat-until-pass? #$test-repeat-until-pass? + #:test-repeat-until-pass-count #$test-repeat-until-pass-count #:parallel-build? #$parallel-build? #:parallel-tests? #$parallel-tests? #:validate-runpath? #$validate-runpath? @@ -209,6 +213,8 @@ provides a 'CMakeLists.txt' file as its build system." (build-type "RelWithDebInfo") (tests? #f) ; nothing can be done (test-exclude "") + (test-repeat-until-pass? #t) + (test-repeat-until-pass-count 5) (parallel-build? #t) (parallel-tests? #t) (validate-runpath? #t) (patch-shebangs? #t) @@ -273,6 +279,8 @@ build system." #:build-type #$build-type #:tests? #$tests? #:test-exclude #$test-exclude + #:test-repeat-until-pass? #$test-repeat-until-pass? + #:test-repeat-until-pass-count #$test-repeat-until-pass-count #:parallel-build? #$parallel-build? #:parallel-tests? #$parallel-tests? #:validate-runpath? #$validate-runpath? diff --git a/guix/build-system/qt.scm b/guix/build-system/qt.scm index 85ae2f0047..84e008bfe7 100644 --- a/guix/build-system/qt.scm +++ b/guix/build-system/qt.scm @@ -127,6 +127,8 @@ (build-type "RelWithDebInfo") (tests? #t) (test-exclude "") + (test-repeat-until-pass? #t) + (test-repeat-until-pass-count 5) (parallel-build? #t) (parallel-tests? #t) (validate-runpath? #t) (patch-shebangs? #t) @@ -168,6 +170,8 @@ provides a 'CMakeLists.txt' file as its build system." #:build-type #$build-type #:tests? #$tests? #:test-exclude #$test-exclude + #:test-repeat-until-pass? #$test-repeat-until-pass? + #:test-repeat-until-pass-count #$test-repeat-until-pass-count #:parallel-build? #$parallel-build? #:parallel-tests? #$parallel-tests? #:validate-runpath? #$validate-runpath? @@ -206,6 +210,8 @@ provides a 'CMakeLists.txt' file as its build system." (build-type "RelWithDebInfo") (tests? #f) ; nothing can be done (test-exclude "") + (test-repeat-until-pass? #t) + (test-repeat-until-pass-count 5) (parallel-build? #t) (parallel-tests? #f) (validate-runpath? #t) (patch-shebangs? #t) @@ -260,6 +266,8 @@ build system." #:build-type #$build-type #:tests? #$tests? #:test-exclude #$test-exclude + #:test-repeat-until-pass? #$test-repeat-until-pass? + #:test-repeat-until-pass-count #$test-repeat-until-pass-count #:parallel-build? #$parallel-build? #:parallel-tests? #$parallel-tests? #:validate-runpath? #$validate-runpath? diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-system.scm index 0115881931..6d62b870ed 100644 --- a/guix/build/cmake-build-system.scm +++ b/guix/build/cmake-build-system.scm @@ -110,6 +110,8 @@ (define* (check #:key (tests? #t) (test-exclude "") (parallel-tests? #t) + (test-repeat-until-pass? #t) + (test-repeat-until-pass-count 5) (test-suite-log-regexp %test-suite-log-regexp) #:allow-other-keys) (if tests? @@ -128,7 +130,12 @@ "--test-load" ,(number->string (total-processor-count))) ;; When unset CMake defers to the build system. - '("-j" "1"))))) + '("-j" "1")) + ,@(if test-repeat-until-pass? + `("--repeat" + ,(string-append "until-pass:" + (number->string test-repeat-until-pass-count))) + '())))) (format #t "test suite not run~%"))) (define* (install #:rest args)