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>
15 ;;; This file is part of GNU Guix.
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.
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.
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))
51 (uri (string-append "https://github.com/libcheck/check/files/71408/"
52 "/check-" version ".tar.gz"))
55 "0lhhywf5nxl3dd0hdakra3aasl590756c9kmvyifb3vgm9k0gxgm"))))
56 (build-system gnu-build-system)
57 (home-page "https://libcheck.github.io/check/")
58 (synopsis "Unit test framework for C")
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.")
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
76 (uri (string-append "https://github.com/libcheck/check/releases"
77 "/download/" version "/check-" version ".tar.gz"))
80 "05jn1pgb7hqb937xky2147nnq3r4qy5wwr79rddpax3bms5a9xr4"))))))
89 (uri (string-append "mirror://sourceforge/cunit/CUnit/"
90 version "/CUnit-" version ".tar.bz2"))
93 "057j82da9vv4li4z5ri3227ybd18nzyq81f6gsvhifs5z0vr3cpm"))))
94 (build-system gnu-build-system)
96 (modify-phases %standard-phases
97 (add-before 'configure 'autoconf
99 (zero? (system* "autoreconf" "-vfi")))))))
101 `(("automake" ,automake)
102 ("autoconf" ,autoconf)
103 ("libtool" ,libtool)))
104 (home-page "http://cunit.sourceforge.net/")
105 (synopsis "Automated testing framework for C")
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.")
112 (define-public cppunit
118 (uri (string-append "http://dev-www.libreoffice.org/src/"
119 name "-" version ".tar.gz"))
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.
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
135 (license lgpl2.1))) ; no copyright notices. LGPL2.1 is in the tarball
137 (define-public catch-framework
140 (version "1.3.5") ;Sub-minor is the build number
144 (url "https://github.com/philsquared/Catch")
146 (commit "ae5ee2cf63d6d67bd1369b512d2a7b60b571c907")))
147 (file-name (string-append name "-" version))
150 "1yfb3lxv929szqy1nw9xw3d45wzkppziqshkjxvrb1fdmf46x564"))))
151 (build-system trivial-build-system)
153 `(#:modules ((guix build utils))
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-"
162 (for-each mkdir-p (list incdir docdir))
163 (install-file (string-append source
164 "/single_include/catch.hpp")
166 (copy-recursively (string-append source "/docs")
168 (home-page "http://catch-lib.net/")
169 (synopsis "Automated test framework for C++ and Objective-C")
171 "Catch stands for C++ Automated Test Cases in Headers and is a
172 multi-paradigm automated test framework for C++ and Objective-C.")
175 (define-public cmdtest
181 (uri (string-append "http://git.liw.fi/cmdtest/snapshot/"
182 name "-" version ".tar.gz"))
185 "1i6gi4yp4qqx1liax098c7nwdb24pghh11xqlrcs7lnhh079rqhb"))))
186 (build-system python-build-system)
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,
195 (add-before 'build 'check
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")))))))
206 `(("python2-coverage-test-runner" ,python2-coverage-test-runner)))
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")
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.")
220 (define-public cmocka
226 (uri (string-append "https://cmocka.org/files/"
227 (version-major+minor version) "/cmocka-"
231 "1283zi9qf5613g8iadm1fxmjh4rzxqd5np2j3lcpgairf25g8bph"))))
232 (build-system cmake-build-system)
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
244 (define-public cppcheck
250 (uri (string-append "https://github.com/danmar/cppcheck/archive/"
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).")
265 (define-public googletest
272 (uri (string-append "https://github.com/google/googletest/archive/"
273 "release-" version ".tar.gz"))
274 (file-name (string-append name "-" version ".tar.gz"))
277 "1n5p1m2m3fjrjdj752lf92f9wq3pl5cbsfrb49jqbg52ghkz99jq"))))
278 (build-system cmake-build-system)
280 `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
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
290 (define-public cpputest
297 (uri (string-append "https://github.com/cpputest/cpputest/releases/download/v"
298 version "/cpputest-" version ".tar.gz"))
301 "0mk48xd3klyqi7wf3f4wn4zqxxzmvrhhl32r25jzrixzl72wq7f8"))))
302 (build-system gnu-build-system)
304 `(("googletest" ,googletest)))
305 (home-page "https://cpputest.github.io/")
306 (synopsis "Unit testing and mocking framework for C/C++")
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.")
313 (define-public python-parameterized
315 (name "python-parameterized")
320 (uri (pypi-uri "parameterized" version))
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")
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.")
333 (define-public python2-parameterized
334 (package-with-python2 python-parameterized))