1 { fetchurl, lib, stdenv, cmake }:
3 stdenv.mkDerivation rec {
6 version = "${majorVersion}.7";
9 url = "https://cmocka.org/files/${majorVersion}/cmocka-${version}.tar.xz";
10 sha256 = "sha256-gQVw6wuNZIBDMfgrKf9Hx5DOnNaxY+mNR6SAcEfsrYI=";
17 nativeBuildInputs = [ cmake ];
19 cmakeFlags = lib.optional doCheck "-DUNIT_TESTING=ON"
20 ++ lib.optional stdenv.hostPlatform.isStatic "-DBUILD_SHARED_LIBS=OFF";
25 description = "Lightweight library to simplify and generalize unit tests for C";
27 There are a variety of C unit testing frameworks available however
28 many of them are fairly complex and require the latest compiler
29 technology. Some development requires the use of old compilers which
30 makes it difficult to use some unit testing frameworks. In addition
31 many unit testing frameworks assume the code being tested is an
32 application or module that is targeted to the same platform that will
33 ultimately execute the test. Because of this assumption many
34 frameworks require the inclusion of standard C library headers in the
35 code module being tested which may collide with the custom or
36 incomplete implementation of the C library utilized by the code under
39 Cmocka only requires a test application is linked with the standard C
40 library which minimizes conflicts with standard C library headers.
41 Also, CMocka tries to avoid the use of some of the newer features of
44 This results in CMocka being a relatively small library that can be
45 used to test a variety of exotic code. If a developer wishes to
46 simply test an application with the latest compiler then other unit
47 testing frameworks may be preferable.
49 This is the successor of Google's Cmockery.
51 homepage = "https://cmocka.org/";
52 license = licenses.asl20;
53 platforms = platforms.all;
54 maintainers = with maintainers; [ kragniz rasendubi ];