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