projects/guix·blob python-team · refs

97 lines · 4.3 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Ludovic Courtès <[email protected]>
3;;; Copyright © 2016, 2017, 2022 Efraim Flashner <[email protected]>
4;;; Copyright © 2018 Mark H Weaver <[email protected]>
5;;; Copyright © 2022 Marius Bakke <[email protected]>
6;;; Copyright © 2022 Maxime Devos <[email protected]>
7;;;
8;;; This file is part of GNU Guix.
9;;;
10;;; GNU Guix is free software; you can redistribute it and/or modify it
11;;; under the terms of the GNU General Public License as published by
12;;; the Free Software Foundation; either version 3 of the License, or (at
13;;; your option) any later version.
14;;;
15;;; GNU Guix is distributed in the hope that it will be useful, but
16;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;;; GNU General Public License for more details.
19;;;
20;;; You should have received a copy of the GNU General Public License
21;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23(define-module (gnu packages dejagnu)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix gexp)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix licenses)
29 #:use-module (gnu packages bash)
30 #:use-module (gnu packages tcl))
31
32(define-public dejagnu
33 (package
34 (name "dejagnu")
35 (version "1.6.3")
36 (source
37 (origin
38 (method url-fetch)
39 (uri (string-append "mirror://gnu/dejagnu/dejagnu-"
40 version ".tar.gz"))
41 (sha256
42 (base32
43 "1qx2cv6qkxbiqg87jh217jb62hk3s7dmcs4cz1llm2wmsynfznl7"))))
44 (build-system gnu-build-system)
45 (inputs (list bash-minimal expect))
46 (arguments
47 (list
48 ;; Do an out-of-source build to work-around a non-deterministic bug in Expect:
49 ;; <https://lists.gnu.org/archive/html/bug-dejagnu/2021-06/msg00013.html>.
50 #:out-of-source? #true
51 #:phases
52 #~(modify-phases %standard-phases
53 (add-after 'unpack 'patch-/bin/sh
54 (lambda* (#:key inputs #:allow-other-keys)
55 ;; Patch embedded /bin/sh references.
56 (let ((/bin/sh (search-input-file inputs "/bin/sh")))
57 (substitute* "dejagnu"
58 (("exec /bin/sh")
59 (string-append "exec " /bin/sh)))
60 (substitute* (find-files "testsuite/report-card.all")
61 (("/bin/sh") /bin/sh)))))
62 (replace 'check
63 (lambda* (#:key tests? #:allow-other-keys)
64 ;; Note: The test-suite *requires* /dev/pts among the
65 ;; `build-chroot-dirs' of the build daemon when
66 ;; building in a chroot. See
67 ;; <http://thread.gmane.org/gmane.linux.distributions.nixos/1036>
68 ;; for details.
69 (when tests?
70 (if (and (directory-exists? "/dev/pts")
71 (directory-exists? "/proc"))
72 (begin
73 ;; Provide `runtest' with a log name, otherwise it
74 ;; tries to run `whoami', which fails when in a chroot.
75 (setenv "LOGNAME" "guix-builder")
76
77 ;; The test-suite needs to have a non-empty stdin:
78 ;; <http://lists.gnu.org/archive/html/bug-dejagnu/2003-06/msg00002.html>.
79 (unless (zero? (system "make check < /dev/zero"))
80 (error "make check failed")))
81 (display "test suite cannot be run, skipping\n")))))
82 (add-after 'install 'post-install
83 (lambda* (#:key inputs outputs #:allow-other-keys)
84 ;; Use the right `expect' binary.
85 (let ((expect (search-input-file inputs "/bin/expect")))
86 (substitute* (string-append #$output "/bin/runtest")
87 (("^mypath.*$" all)
88 (string-append all
89 "export PATH="
90 (dirname expect) ":$PATH\n")))))))))
91 (home-page "https://www.gnu.org/software/dejagnu/")
92 (synopsis "GNU software testing framework")
93 (description
94 "DejaGnu is a framework for testing software. In effect, it serves as
95a front-end for all tests written for a program. Thus, each program can have
96multiple test suites, which are then all managed by a single harness.")
97 (license gpl3+)))