;;; This file has been taken from GNU Guix.
;;; The original copyright header follows.
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016, 2018-2020, 2022 Ludovic Courtès <ludo@gnu.org>
;;;
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(use-modules (ruther tests)
(gnu tests)
(gnu packages package-management)
(guix monads)
(guix store)
((guix git-download) #:select (git-predicate))
((guix utils) #:select (current-source-directory))
(git)
(srfi srfi-1)
(ice-9 match))
(define (system-test->manifest-entry test)
"Return a manifest entry for TEST, a system test."
(manifest-entry
(name (string-append "test." (system-test-name test)))
(version "0")
(item test)))
(define* (filter-tests
#:key
(tests (ruther-system-tests))
(filter-tests (getenv "TESTS")))
(match filter-tests
(#f
tests)
((= string-tokenize (filter-tests ...))
(filter (lambda (test)
(member (system-test-name test) filter-tests))
tests))))
(define (system-test-manifest)
"Return a manifest containing all the system tests, or all those selected by
the 'TESTS' environment variable."
(let* ((tests (filter-tests)))
(format (current-error-port) "Selected ~a system tests...~%"
(length tests))
(manifest (map system-test->manifest-entry tests))))
;; Return the manifest.
(system-test-manifest)