2022-11-30 08:17:29 +00:00
|
|
|
{ fetchurl, fetchpatch, lib, stdenv, cmake }:
|
2023-02-21 07:44:53 +00:00
|
|
|
|
2016-02-03 04:34:50 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-03-25 19:54:28 +00:00
|
|
|
pname = "cmocka";
|
2017-11-15 20:33:19 +00:00
|
|
|
majorVersion = "1.1";
|
2023-05-31 21:57:34 +00:00
|
|
|
version = "${majorVersion}.7";
|
2016-02-03 04:34:50 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2017-11-15 20:33:19 +00:00
|
|
|
url = "https://cmocka.org/files/${majorVersion}/cmocka-${version}.tar.xz";
|
2023-05-31 21:57:34 +00:00
|
|
|
sha256 = "sha256-gQVw6wuNZIBDMfgrKf9Hx5DOnNaxY+mNR6SAcEfsrYI=";
|
2016-02-03 04:34:50 +00:00
|
|
|
};
|
|
|
|
|
2023-02-21 07:44:53 +00:00
|
|
|
patches = [
|
|
|
|
./uintptr_t.patch
|
2022-11-30 08:17:29 +00:00
|
|
|
];
|
|
|
|
|
2016-08-03 06:16:01 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
2016-02-03 04:34:50 +00:00
|
|
|
|
2023-01-30 18:46:14 +00:00
|
|
|
cmakeFlags = lib.optional doCheck "-DUNIT_TESTING=ON"
|
|
|
|
++ lib.optional stdenv.hostPlatform.isStatic "-DBUILD_SHARED_LIBS=OFF";
|
2016-02-03 04:34:50 +00:00
|
|
|
|
2023-01-30 18:46:14 +00:00
|
|
|
doCheck = true;
|
2016-02-03 04:34:50 +00:00
|
|
|
|
2023-01-30 18:46:14 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Lightweight library to simplify and generalize unit tests for C";
|
|
|
|
longDescription = ''
|
|
|
|
There are a variety of C unit testing frameworks available however
|
|
|
|
many of them are fairly complex and require the latest compiler
|
|
|
|
technology. Some development requires the use of old compilers which
|
|
|
|
makes it difficult to use some unit testing frameworks. In addition
|
|
|
|
many unit testing frameworks assume the code being tested is an
|
|
|
|
application or module that is targeted to the same platform that will
|
|
|
|
ultimately execute the test. Because of this assumption many
|
|
|
|
frameworks require the inclusion of standard C library headers in the
|
|
|
|
code module being tested which may collide with the custom or
|
|
|
|
incomplete implementation of the C library utilized by the code under
|
|
|
|
test.
|
|
|
|
|
|
|
|
Cmocka only requires a test application is linked with the standard C
|
|
|
|
library which minimizes conflicts with standard C library headers.
|
|
|
|
Also, CMocka tries to avoid the use of some of the newer features of
|
|
|
|
C compilers.
|
|
|
|
|
|
|
|
This results in CMocka being a relatively small library that can be
|
|
|
|
used to test a variety of exotic code. If a developer wishes to
|
|
|
|
simply test an application with the latest compiler then other unit
|
|
|
|
testing frameworks may be preferable.
|
|
|
|
|
|
|
|
This is the successor of Google's Cmockery.
|
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://cmocka.org/";
|
2016-02-03 04:34:50 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.all;
|
2016-09-09 08:14:10 +00:00
|
|
|
maintainers = with maintainers; [ kragniz rasendubi ];
|
2016-02-03 04:34:50 +00:00
|
|
|
};
|
|
|
|
}
|