gnu: Add nxbelld.
[guix.git] / gnu / packages / check.scm
blob1d2ac2032613556af87fc0b8591db2615256dfdf
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
4 ;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
5 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
6 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
8 ;;; Copyright © 2016 Lukas Gradl <lgradl@openmailbox.org>
9 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
10 ;;; Copyright © 2017 Kei Kebreau <kkebreau@posteo.net>
11 ;;; Copyright © 2017 ng0 <ng0@infotropique.org>
12 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
13 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
14 ;;;
15 ;;; This file is part of GNU Guix.
16 ;;;
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
21 ;;;
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 ;;; GNU General Public License for more details.
26 ;;;
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
30 (define-module (gnu packages check)
31   #:use-module (gnu packages)
32   #:use-module (gnu packages autotools)
33   #:use-module (gnu packages python)
34   #:use-module (guix utils)
35   #:use-module (guix licenses)
36   #:use-module (guix packages)
37   #:use-module (guix download)
38   #:use-module (guix git-download)
39   #:use-module (guix build-system cmake)
40   #:use-module (guix build-system gnu)
41   #:use-module (guix build-system python)
42   #:use-module (guix build-system trivial))
44 (define-public check
45   (package
46     (name "check")
47     (version "0.10.0")
48     (source
49      (origin
50       (method url-fetch)
51       (uri (string-append "https://github.com/libcheck/check/files/71408/"
52                           "/check-" version ".tar.gz"))
53       (sha256
54        (base32
55         "0lhhywf5nxl3dd0hdakra3aasl590756c9kmvyifb3vgm9k0gxgm"))))
56     (build-system gnu-build-system)
57     (home-page "https://libcheck.github.io/check/")
58     (synopsis "Unit test framework for C")
59     (description
60      "Check is a unit testing framework for C.  It features a simple
61 interface for defining unit tests, putting little in the way of the
62 developer.  Tests are run in a separate address space, so Check can
63 catch both assertion failures and code errors that cause segmentation
64 faults or other signals.  The output from unit tests can be used within
65 source code editors and IDEs.")
66     (license lgpl2.1+)))
68 ;; XXX: Some packages require this newer version.  Incorporate this
69 ;; into the main 'check' package during the next rebuild cycle.
70 (define-public check-0.11.0
71   (package
72     (inherit check)
73     (version "0.11.0")
74     (source (origin
75               (method url-fetch)
76               (uri (string-append "https://github.com/libcheck/check/releases"
77                                   "/download/" version "/check-" version ".tar.gz"))
78               (sha256
79                (base32
80                 "05jn1pgb7hqb937xky2147nnq3r4qy5wwr79rddpax3bms5a9xr4"))))))
82 (define-public cunit
83   (package
84     (name "cunit")
85     (version "2.1-3")
86     (source
87      (origin
88        (method url-fetch)
89        (uri (string-append "mirror://sourceforge/cunit/CUnit/"
90                            version "/CUnit-" version ".tar.bz2"))
91        (sha256
92         (base32
93          "057j82da9vv4li4z5ri3227ybd18nzyq81f6gsvhifs5z0vr3cpm"))))
94     (build-system gnu-build-system)
95     (arguments '(#:phases
96                  (modify-phases %standard-phases
97                    (add-before 'configure 'autoconf
98                      (lambda _
99                        (zero? (system* "autoreconf" "-vfi")))))))
100     (native-inputs
101      `(("automake" ,automake)
102        ("autoconf" ,autoconf)
103        ("libtool" ,libtool)))
104     (home-page "http://cunit.sourceforge.net/")
105     (synopsis "Automated testing framework for C")
106     (description
107      "CUnit is a lightweight system for writing, administering, and running
108 unit tests in C.  It provides C programmers with basic testing functionality
109 with a flexible variety of user interfaces.")
110     (license gpl2+)))
112 (define-public cppunit
113   (package
114     (name "cppunit")
115     (version "1.13.2")
116     (source (origin
117              (method url-fetch)
118               (uri (string-append "http://dev-www.libreoffice.org/src/"
119                                   name "-" version ".tar.gz"))
120              (sha256
121               (base32
122                "17s2kzmkw3kfjhpp72rfppyd7syr7bdq5s69syj2nvrlwd3d4irz"))))
123     ;; Explicitly link with libdl. This is expected to be done by packages
124     ;; relying on cppunit for their tests. However, not all of them do.
125     ;; If we added the linker flag to such packages, we would pollute all
126     ;; binaries, not only those used for testing.
127     (arguments
128      `(#:make-flags '("LDFLAGS=-ldl")))
129     (build-system gnu-build-system)
130     (home-page "https://wiki.freedesktop.org/www/Software/cppunit/")
131     (synopsis "Unit testing framework for C++")
132     (description "CppUnit is the C++ port of the famous JUnit framework for
133 unit testing.  Test output is in XML for automatic testing and GUI based for
134 supervised tests.")
135     (license lgpl2.1))) ; no copyright notices. LGPL2.1 is in the tarball
137 (define-public catch-framework
138   (package
139     (name "catch")
140     (version "1.3.5")                  ;Sub-minor is the build number
141     (source (origin
142               (method git-fetch)
143               (uri (git-reference
144                     (url "https://github.com/philsquared/Catch")
145                     ;; Semi-arbitrary.
146                     (commit "ae5ee2cf63d6d67bd1369b512d2a7b60b571c907")))
147               (file-name (string-append name "-" version))
148               (sha256
149                (base32
150                 "1yfb3lxv929szqy1nw9xw3d45wzkppziqshkjxvrb1fdmf46x564"))))
151     (build-system trivial-build-system)
152     (arguments
153      `(#:modules ((guix build utils))
154        #:builder (begin
155                    (use-modules (guix build utils))
156                    (let* ((source (assoc-ref %build-inputs "source"))
157                           (output (assoc-ref %outputs "out"))
158                           (incdir (string-append output "/include"))
159                           (docdir (string-append output "/share/doc/catch-"
160                                                  ,version)))
161                      (begin
162                        (for-each mkdir-p (list incdir docdir))
163                        (install-file (string-append source
164                                                  "/single_include/catch.hpp")
165                                      incdir)
166                        (copy-recursively (string-append source "/docs")
167                                          docdir))))))
168     (home-page "http://catch-lib.net/")
169     (synopsis "Automated test framework for C++ and Objective-C")
170     (description
171      "Catch stands for C++ Automated Test Cases in Headers and is a
172 multi-paradigm automated test framework for C++ and Objective-C.")
173     (license boost1.0)))
175 (define-public cmdtest
176   (package
177     (name "cmdtest")
178     (version "0.29")
179     (source (origin
180               (method url-fetch)
181               (uri (string-append "http://git.liw.fi/cmdtest/snapshot/"
182                                   name "-" version ".tar.gz"))
183               (sha256
184                (base32
185                 "1i6gi4yp4qqx1liax098c7nwdb24pghh11xqlrcs7lnhh079rqhb"))))
186     (build-system python-build-system)
187     (arguments
188      `(#:python ,python-2
189        #:phases
190        (modify-phases %standard-phases
191          ;; check phase needs to be run before the build phase. If not, the
192          ;; coverage test runner looks for tests for the built source files,
193          ;; and fails.
194          (delete 'check)
195          (add-before 'build 'check
196            (lambda _
197              (substitute* "yarn"
198                (("/bin/sh") (which "sh")))
199              ;; yarn uses python2-ttystatus to print messages.
200              ;; python2-ttystatus requires /dev/tty which is not present in
201              ;; the build environment. Hence assuming-failure test fails.
202              (delete-file "yarn.tests/assuming-failure.script")
203              (delete-file "yarn.tests/assuming-failure.stdout")
204              (zero? (system* "python" "setup.py" "check")))))))
205     (native-inputs
206      `(("python2-coverage-test-runner" ,python2-coverage-test-runner)))
207     (propagated-inputs
208      `(("python2-cliapp" ,python2-cliapp)
209        ("python2-markdown" ,python2-markdown)
210        ("python2-ttystatus" ,python2-ttystatus)))
211     (home-page "https://liw.fi/cmdtest/")
212     (synopsis "Black box Unix program tester")
213     (description
214      "@code{cmdtest} black box tests Unix command line tools.  Roughly, it is
215 given a command line and input files, and the expected output, and it verifies
216 that the command line produces the expected output.  If not, it reports a
217 problem, and shows the differences.")
218     (license gpl3+)))
220 (define-public cmocka
221   (package
222     (name "cmocka")
223     (version "1.1.1")
224     (source (origin
225               (method url-fetch)
226               (uri (string-append "https://cmocka.org/files/"
227                                   (version-major+minor version) "/cmocka-"
228                                   version ".tar.xz"))
229               (sha256
230                (base32
231                 "1283zi9qf5613g8iadm1fxmjh4rzxqd5np2j3lcpgairf25g8bph"))))
232     (build-system cmake-build-system)
233     (arguments
234      `(#:tests? #f)) ; No test target
235     (home-page "https://cmocka.org/")
236     (synopsis "Unit testing framework for C")
237     (description "Cmocka is a unit testing framework for C with support for
238 mock objects.  It only requires the standard C library, and works with
239 different compilers.  Cmocka supports several different message output formats
240 like Test Anything Protocol, Subunit, xUnit XML or the original cmockery output
241 format.")
242     (license asl2.0)))
244 (define-public cppcheck
245   (package
246     (name "cppcheck")
247     (version "1.81")
248     (source (origin
249       (method url-fetch)
250       (uri (string-append "https://github.com/danmar/cppcheck/archive/"
251                           version ".tar.gz"))
252       (sha256
253        (base32 "0miamqk7pa2dzmnmi5wb6hjp2a3zya1x8afnlcxby8jb6gp6wf8j"))
254       (file-name (string-append name "-" version ".tar.gz"))))
255     (build-system cmake-build-system)
256     (home-page "http://cppcheck.sourceforge.net")
257     (synopsis "Static C/C++ code analyzer")
258     (description "Cppcheck is a static code analyzer for C and C++.  Unlike
259 C/C++ compilers and many other analysis tools it does not detect syntax errors
260 in the code.  Cppcheck primarily detects the types of bugs that the compilers
261 normally do not detect.  The goal is to detect only real errors in the code
262 (i.e. have zero false positives).")
263     (license gpl3+)))
265 (define-public googletest
266   (package
267     (name "googletest")
268     (version "1.8.0")
269     (source
270      (origin
271        (method url-fetch)
272        (uri (string-append "https://github.com/google/googletest/archive/"
273                            "release-" version ".tar.gz"))
274        (file-name (string-append name "-" version ".tar.gz"))
275        (sha256
276         (base32
277          "1n5p1m2m3fjrjdj752lf92f9wq3pl5cbsfrb49jqbg52ghkz99jq"))))
278     (build-system cmake-build-system)
279     (arguments
280      `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
281     (native-inputs
282      `(("python-2" ,python-2)))
283     (home-page "https://github.com/google/googletest/")
284     (synopsis "Test discovery and XUnit test framework")
285     (description "Google Test features an XUnit test framework, automated test
286 discovery, death tests, assertions, parameterized tests and XML test report
287 generation.")
288     (license bsd-3)))
290 (define-public cpputest
291   (package
292     (name "cpputest")
293     (version "3.8")
294     (source
295      (origin
296        (method url-fetch)
297        (uri (string-append "https://github.com/cpputest/cpputest/releases/download/v"
298                            version "/cpputest-" version ".tar.gz"))
299        (sha256
300         (base32
301          "0mk48xd3klyqi7wf3f4wn4zqxxzmvrhhl32r25jzrixzl72wq7f8"))))
302     (build-system gnu-build-system)
303     (native-inputs
304      `(("googletest" ,googletest)))
305     (home-page "https://cpputest.github.io/")
306     (synopsis "Unit testing and mocking framework for C/C++")
307     (description
308      "CppUTest is a C/C++ based unit xUnit test framework.  It is written in
309 C++ but is used in C and C++ projects and frequently used in embedded systems
310 but it works for any C/C++ project.")
311     (license bsd-3)))
313 (define-public python-parameterized
314   (package
315     (name "python-parameterized")
316     (version "0.6.1")
317     (source
318      (origin
319        (method url-fetch)
320        (uri (pypi-uri "parameterized" version))
321        (sha256
322         (base32
323          "1qj1939shm48d9ql6fm1nrdy4p7sdyj8clz1szh5swwpf1qqxxfa"))))
324     (build-system python-build-system)
325     (arguments '(#:tests? #f)) ; there are no tests
326     (home-page "https://github.com/wolever/parameterized")
327     (synopsis "Parameterized testing with any Python test framework")
328     (description
329      "Parameterized is a Python library that aims to fix parameterized testing
330 for every Python test framework.  It supports nose, py.test, and unittest.")
331     (license bsd-2)))
333 (define-public python2-parameterized
334   (package-with-python2 python-parameterized))