mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
r-build-system: Fail the build on test errors.
* guix/build-system/r.scm (r-build): Accept optional TEST-TYPES argument and pass it to the build phases. * guix/build/r-build-system.scm (check): Exit R with the return value of tools:::testInstalledPackage; stop the test suite on the first error; respect TEST-TYPES argument; dump logs on test failure. Change-Id: Ia83407ceb2ef2a92cfa02f3a3d661f54cf8c8b40
This commit is contained in:
parent
9fe7e91373
commit
0f18c1e3fa
2 changed files with 19 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2015-2023 Ricardo Wurmus <rekado@elephly.net>
|
||||
;;; Copyright © 2015-2024 Ricardo Wurmus <rekado@elephly.net>
|
||||
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
|
@ -107,6 +107,7 @@ release corresponding to NAME and VERSION."
|
|||
source
|
||||
(tests? #t)
|
||||
(test-target "tests")
|
||||
(test-types #f)
|
||||
(configure-flags ''())
|
||||
(phases '%standard-phases)
|
||||
(outputs '("out"))
|
||||
|
@ -128,6 +129,7 @@ release corresponding to NAME and VERSION."
|
|||
#:system #$system
|
||||
#:tests? #$tests?
|
||||
#:test-target #$test-target
|
||||
#:test-types #$test-types
|
||||
#:phases #$phases
|
||||
#:outputs #$(outputs->gexp outputs)
|
||||
#:search-paths '#$(sexp->gexp
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
|
||||
#:use-module (guix build utils)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 format)
|
||||
#:use-module (ice-9 ftw)
|
||||
#:use-module (ice-9 popen)
|
||||
#:use-module (srfi srfi-1)
|
||||
|
@ -62,7 +63,7 @@
|
|||
inputs))
|
||||
":"))
|
||||
|
||||
(define* (check #:key test-target inputs outputs tests? #:allow-other-keys)
|
||||
(define* (check #:key test-target test-types inputs outputs tests? #:allow-other-keys)
|
||||
"Run the test suite of a given R package."
|
||||
(let* ((libdir (string-append (assoc-ref outputs "out") "/site-library/"))
|
||||
|
||||
|
@ -80,10 +81,20 @@
|
|||
(site-path (string-append libdir ":" (generate-site-path inputs))))
|
||||
(when (and tests? (file-exists? testdir))
|
||||
(setenv "R_LIBS_SITE" site-path)
|
||||
(pipe-to-r (string-append "tools::testInstalledPackage(\"" pkg-name "\", "
|
||||
"lib.loc = \"" libdir "\")")
|
||||
'("--no-save" "--slave")))
|
||||
#t))
|
||||
(guard (c ((invoke-error? c)
|
||||
;; Dump the test suite log to facilitate debugging.
|
||||
(display "\nTests failed, dumping logs.\n"
|
||||
(current-error-port))
|
||||
(gnu:dump-file-contents "." ".*\\.Rout\\.fail$")
|
||||
(raise c)))
|
||||
(pipe-to-r (string-append "quit(status=tools::testInstalledPackage(\"" pkg-name "\", "
|
||||
"lib.loc = \"" libdir "\", "
|
||||
"errorsAreFatal=TRUE, "
|
||||
(if test-types
|
||||
(format #false "types=c(~{\"~a\"~^,~})" test-types)
|
||||
"types=c(\"tests\", \"vignettes\")")
|
||||
"))")
|
||||
'("--no-save" "--slave"))))))
|
||||
|
||||
(define* (install #:key outputs inputs (configure-flags '())
|
||||
#:allow-other-keys)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue