mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
build-system/r: Add build phase to skip tests.
* guix/build-system/r.scm (r-build): Pass TEST-DIRECTORY and SKIPPED-TESTS. * guix/build/r-build-system.scm (patch-tests): New procedure. (%standard-phases): Add it. Change-Id: I7abcd25260f5f55a342899371f4276306c911abe
This commit is contained in:
committed by
Andreas Enge
parent
c87d544fab
commit
b89d732d11
@@ -1,5 +1,5 @@
|
||||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2015-2024 Ricardo Wurmus <rekado@elephly.net>
|
||||
;;; Copyright © 2015-2026 Ricardo Wurmus <rekado@elephly.net>
|
||||
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
@@ -110,6 +110,8 @@ release corresponding to NAME and VERSION."
|
||||
(tests? #t)
|
||||
(test-target "tests")
|
||||
(test-types #f)
|
||||
test-directory
|
||||
skipped-tests
|
||||
(configure-flags ''())
|
||||
(phases '%standard-phases)
|
||||
(outputs '("out"))
|
||||
@@ -132,6 +134,8 @@ release corresponding to NAME and VERSION."
|
||||
#:tests? #$tests?
|
||||
#:test-target #$test-target
|
||||
#:test-types #$test-types
|
||||
#:test-directory #$test-directory
|
||||
#:skipped-tests '#$skipped-tests
|
||||
#:phases #$phases
|
||||
#:outputs #$(outputs->gexp outputs)
|
||||
#:search-paths '#$(sexp->gexp
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2015, 2017, 2018, 2024 Ricardo Wurmus <rekado@elephly.net>
|
||||
;;; Copyright © 2015, 2017, 2018, 2024, 2026 Ricardo Wurmus <rekado@elephly.net>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
@@ -23,6 +23,7 @@
|
||||
#:use-module (ice-9 format)
|
||||
#:use-module (ice-9 ftw)
|
||||
#:use-module (ice-9 popen)
|
||||
#:use-module (ice-9 regex)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (srfi srfi-34)
|
||||
@@ -63,6 +64,36 @@
|
||||
inputs))
|
||||
":"))
|
||||
|
||||
(define* (patch-tests #:key
|
||||
(skipped-tests #false)
|
||||
(test-directory "tests/testthat")
|
||||
#:allow-other-keys)
|
||||
"Patch sources to skip tests according to SKIPPED-TESTS, a list of pairs
|
||||
each consisting of a file name under TEST-DIRECTORY and one or more names of
|
||||
tests to be skipped. If the entry is just a file name, delete the test file."
|
||||
(when skipped-tests
|
||||
(with-directory-excursion "tests/testthat/"
|
||||
(for-each (match-lambda
|
||||
((file test-names ...)
|
||||
(substitute file
|
||||
(map (lambda (test-name)
|
||||
(let ((pattern (make-regexp
|
||||
(string-append "^ *(testthat::)?test_that\\([\"']"
|
||||
test-name "[\"'].*")
|
||||
regexp/extended)))
|
||||
(cons pattern
|
||||
(lambda (line matches)
|
||||
(match matches
|
||||
((fst . rest)
|
||||
(string-append (match:string fst) "skip('Guix');\n"))
|
||||
(else
|
||||
(error (format #false
|
||||
"no matching test `~a' in file `~a'" test-name file))))))))
|
||||
test-names)))
|
||||
((? string? file)
|
||||
(delete-file file)))
|
||||
skipped-tests))))
|
||||
|
||||
(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/"))
|
||||
@@ -124,6 +155,7 @@
|
||||
(define %standard-phases
|
||||
(modify-phases gnu:%standard-phases
|
||||
(delete 'bootstrap)
|
||||
(add-after 'unpack 'patch-tests patch-tests)
|
||||
(delete 'configure)
|
||||
(delete 'build)
|
||||
(delete 'check) ; tests must be run after installation
|
||||
|
||||
Reference in New Issue
Block a user