aboutsummaryrefslogtreecommitdiff
path: root/etc/system-tests.scm
blob: 1085deed24b91a4587e848f5cb9b7403745c9b74 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; 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 (gnu tests)
             (gnu packages package-management)
             ((gnu ci) #:select (channel-source->package))
             ((guix git-download) #:select (git-predicate))
             ((guix utils) #:select (current-source-directory))
             (git)
             (ice-9 match))

(define (source-commit directory)
  "Return the commit of the head of DIRECTORY or #f if it could not be
determined."
  (let ((repository #f))
    (catch 'git-error
      (lambda ()
        (set! repository (repository-open directory))
        (let* ((head   (repository-head repository))
               (target (reference-target head))
               (commit (oid->string target)))
          (repository-close! repository)
          commit))
      (lambda _
        (when repository
          (repository-close! repository))
        #f))))

(define (tests-for-current-guix source commit)
  "Return a list of tests for perform, using Guix built from SOURCE, a channel
instance."
  ;; Honor the 'TESTS' environment variable so that one can select a subset
  ;; of tests to run in the usual way:
  ;;
  ;;   make check-system TESTS=installed-os
  (parameterize ((current-guix-package
                  (channel-source->package source #:commit commit)))
    (match (getenv "TESTS")
      (#f
       (all-system-tests))
      ((= string-tokenize (tests ...))
       (filter (lambda (test)
                 (member (system-test-name test) tests))
               (all-system-tests))))))

(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 (system-test-manifest)
  "Return a manifest containing all the system tests, or all those selected by
the 'TESTS' environment variable."
  (define source
    (string-append (current-source-directory) "/.."))

  (define commit
    ;; Fetch the current commit ID so we can potentially build the same
    ;; derivation as ci.guix.gnu.org.
    (source-commit source))

  ;; Intern SOURCE so that 'build-from-source' in (guix channels) sees
  ;; "fresh" file names and thus doesn't find itself loading .go files
  ;; from ~/.cache/guile when it loads 'build-aux/build-self.scm'.
  (let* ((source (local-file source
                             (if commit
                                 (string-append "guix-"
                                                (string-take commit 7))
                                 "guix-source")
                             #:recursive? #t
                             #:select?
                             (or (git-predicate source)
                                 (const #t))))
         (tests  (tests-for-current-guix source commit)))
    (format (current-error-port) "Selected ~a system tests...~%"
            (length tests))

    (manifest (map system-test->manifest-entry tests))))

;; Return the manifest.
(system-test-manifest)
/packages/grub.scm: Likewise. * gnu/packages/gtk.scm: Likewise. * gnu/packages/guile.scm: Likewise. * gnu/packages/ibus.scm: Likewise. * gnu/packages/irc.scm: Likewise. * gnu/packages/iso-codes.scm: Likewise. * gnu/packages/kde-frameworks.scm: Likewise. * gnu/packages/kodi.scm: Likewise. * gnu/packages/linux.scm: Likewise. * gnu/packages/man.scm: Likewise. * gnu/packages/maths.scm: Likewise. * gnu/packages/mono.scm: Likewise. * gnu/packages/mp3.scm: Likewise. * gnu/packages/music.scm: Likewise. * gnu/packages/nano.scm: Likewise. * gnu/packages/networking.scm: Likewise. * gnu/packages/package-management.scm: Likewise. * gnu/packages/pdf.scm: Likewise. * gnu/packages/sawfish.scm: Likewise. * gnu/packages/statistics.scm: Likewise. * gnu/packages/terminals.scm: Likewise. * gnu/packages/version-control.scm: Likewise. * gnu/packages/vpn.scm: Likewise. * gnu/packages/w3m.scm: Likewise. * gnu/packages/webkit.scm: Likewise. * gnu/packages/wicd.scm: Likewise. * gnu/packages/wine.scm: Likewise. * gnu/packages/xdisorg.scm: Likewise. * gnu/packages/xorg.scm: Likewise. Alex Kost 2016-06-21gnu: Adjust to yasm change of module....This is a followup to 15a3fffc593a2385bbac60913909833babc1625f. * gnu/packages/gnuzilla.scm, gnu/packages/gstreamer.scm, gnu/packages/kodi.scm, gnu/packages/video.scm: Adjust import list to yasm move. Ludovic Courtès 2016-05-12gnu: Update module imports for asciidoc and doxygen....This is a followup to commit 0573a923def01e54bf104e0015ade44ab42f694f. * gnu/packages/algebra.scm, gnu/packages/bioinformatics.scm, gnu/packages/fcitx.scm, gnu/packages/fish.scm, gnu/packages/freedesktop.scm, gnu/packages/game-development.scm, gnu/packages/gcc.scm, gnu/packages/graphics.scm, gnu/packages/image.scm, gnu/packages/kodi.scm, gnu/packages/libreoffice.scm, gnu/packages/linux.scm, gnu/packages/messaging.scm, gnu/packages/mpd.scm, gnu/packages/music.scm, gnu/packages/rdf.scm, gnu/packages/serialization.scm, gnu/packages/version-control.scm, gnu/packages/web.scm, gnu/packages/wm.scm, gnu/packages/xdisorg.scm, gnu/packages/xiph.scm: Change imports of (gnu packages asciidoc) or (gnu packages doxygen) to (gnu packages documentation). Mark H Weaver 2016-03-26gnu: crossguid: Set explicit file name for source checkout....* gnu/packages/kodi.scm (crossguid)[source]: Set explicit file-name to satisfy linter. David Thompson 2016-03-19gnu: kodi: Remove @acronym from description....This works around <http://bugs.gnu.org/21772>. * gnu/packages/kodi.scm (crossguid): Remove @acronym. Ludovic Courtès 2016-03-14gnu: kodi: Update to 16.0....* gnu/packages/kodi.scm (kodi): Update to 16.0. [inputs]: Add crossguid, dcadec, and util-linux. David Thompson 2016-03-14gnu: Add crossguid....* gnu/packages/kodi.scm (crossguid): New variable. David Thompson 2016-01-06gnu: Add and use default IcedTea....* gnu/packages/java.scm (icedtea): New variable. (swt)[native-inputs]: Replace "icedtea6" with "icedtea". * gnu/packages/bioinformatics.scm (htsjdk)[native-inputs]: Likewise. (ngs-java)[inputs]: Likewise. * gnu/packages/kodi.scm (kodi)[native-inputs]: Replace "icedtea7" with "icedtea". * gnu/packages/ruby.scm (ruby-rjb)[native-inputs]: Replace "icedtea7" with "icedtea". Ricardo Wurmus 2015-11-25gnu: Add kodi....* gnu/packages/kodi.scm: New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it. David Thompson