# # spec file for package cmocka # # Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %if 0%{?suse_version} >= 1500 || 0%{?sle_version} >= 150000 %bcond_without docs %else # We need cmake >= 3.9 to build docs %bcond_with docs %endif Name: cmocka Version: 1.1.7 Release: 4.4 Summary: Lightweight library to simplify and generalize unit tests for C License: Apache-2.0 Group: Productivity/Networking/Other URL: https://cmocka.org Source0: https://cmocka.org/files/1.1/%{name}-%{version}.tar.xz Source1: https://cmocka.org/files/1.1/%{name}-%{version}.tar.xz.asc Source2: %{name}.keyring Source3: baselibs.conf BuildRequires: cmake BuildRequires: doxygen BuildRequires: glibc-devel BuildRequires: pkg-config Obsoletes: libcmocka-devel-static < %{version} %description cmocka is an elegant unit testing framework for C with support for mock objects. It only requires the standard C library, works on a range of computing platforms (including embedded) and with different compilers. Features: * Support for mock objects * Only requires the C library * Several supported output formats (Subunit, TAP, jUnit XML) * Fully documented API * Test fixtures * Exception handling for signals (SIGSEGV, SIGILL, ...) * No fork() used * Very well tested * Testing of memory leaks, buffer overflows and underflows. Also, CMocka tries to avoid the use of some of the newer features of C compilers. %package -n libcmocka0 Summary: Lightweight library to simplify and generalize unit tests for C Group: System/Libraries %description -n libcmocka0 cmocka is an elegant unit testing framework for C with support for mock objects. It only requires the standard C library, works on a range of computing platforms (including embedded) and with different compilers. Features: * Support for mock objects * Only requires the C library * Several supported output formats (Subunit, TAP, jUnit XML) * Fully documented API * Test fixtures * Exception handling for signals (SIGSEGV, SIGILL, ...) * No fork() used * Very well tested * Testing of memory leaks, buffer overflows and underflows. Also, CMocka tries to avoid the use of some of the newer features of C compilers. %package -n libcmocka-devel Summary: Development headers for the cmocka library Group: Development/Libraries/C and C++ Requires: libcmocka0 = %{version} Requires: pkg-config Requires: (libcmocka-cmake if cmake) %description -n libcmocka-devel Development headers for the cmocka unit testing library. %package -n libcmocka-doc Summary: Documentation for the cmocka library Group: Development/Libraries/C and C++ Enhances: libcmocka-devel Provides: libcmocka-devel:%{_defaultdocdir}/libcmocka-devel %description -n libcmocka-doc Documentation for the cmocka unit testing library. %package -n libcmocka-cmake Summary: cmake support for the cmocka library Group: Development/Libraries/C and C++ Requires: cmake Requires: libcmocka-devel = %{version} Provides: libcmocka-devel:%{_libdir}/cmake/cmocka %description -n libcmocka-cmake cmake support for developing with the cmocka unit testing library. %prep %autosetup -p1 %build %define _lto_cflags %{nil} %cmake \ -DCMAKE_SKIP_RPATH=OFF \ -DWITH_STATIC_LIB=ON \ -DWITH_CMOCKERY_SUPPORT=ON \ -DUNIT_TESTING=ON make %{?_smp_mflags} %if %{with docs} make docs #endif with docs %endif %install %cmake_install %check pushd build ctest --output-on-failure popd %post -n libcmocka0 -p /sbin/ldconfig %postun -n libcmocka0 -p /sbin/ldconfig %files -n libcmocka0 %doc AUTHORS README.md ChangeLog %license COPYING %{_libdir}/libcmocka.so.* %files -n libcmocka-devel %{_includedir}/cmocka.h %{_includedir}/cmocka_pbc.h %{_includedir}/cmockery %{_libdir}/libcmocka.so %{_libdir}/pkgconfig/cmocka.pc %if %{with docs} %files -n libcmocka-doc %doc build/doc/html %endif %files -n libcmocka-cmake %{_libdir}/cmake/cmocka %changelog * Fri Jun 7 2024 Andreas Schneider - Fix baselibs.conf for libcmocka-cmake subpackage * Wed Aug 23 2023 Martin Wilck - split off -doc and -cmake subpackages, which aren't necessary for basic development with cmocka, to avoid pulling in the entire cmake-full package (38MB) with libcmocka-devel - minor simplifications in spec file * Fri May 5 2023 Andreas Schneider - Add missing cmake config files for 32bit packages * Mon Feb 27 2023 Andreas Schneider - Update to version 1.1.7 * Fixed tarball generation * Fri Feb 17 2023 Andreas Schneider - Update to version 1.1.6 * Added new assert macros to compare 2 double given an epsilon * Added meson build system * Added header with version to TAP13 output * Fixed issues with MSVC * Fixed TAP output for skipped tests * Fixed issue with fail_msg * CMake generated configs for find_package(cmocka) * Documentation improvements * Wed Apr 24 2019 Martin Liška - Disable LTO (boo#1133122). * Thu Mar 28 2019 Andreas Schneider - Update to version 1.1.5 * Added cmocka_set_skip_filter() * cmocka version 1.1.4 * Added assert_float(_not)_equal() * Added expect_any_always() * Small bug fixes * Thu Sep 27 2018 Andreas Schneider - Update to version 1.1.3 * Fixed subunit output on failures * Do not abort if a test is skipped * Switched to Modern CMake - Removed 0001-cmake-Only-support-building-docs-the-on-cmake-3.9.patch * Thu Aug 30 2018 Andreas Schneider - Fix packaging the documentation - Added 0001-cmake-Only-support-building-docs-the-on-cmake-3.9.patch * Wed Aug 29 2018 Andreas Schneider - Update to version 1.1.2 * Added function to filter tests (cmocka_set_test_filter) * Added new mocking example (uptime) * Fixed fixture error reporting * Fixed compiler flags detection * Some improvement for API documentation - Added HTML documentation * Fri Apr 7 2017 asn@cryptomilk.org - Update to version 1.1.1 * Fixed TAP output * Fixed cmocka on Windows x64 * Fixed xUnit output durations * Tue Oct 25 2016 asn@cryptomilk.org - Fix url for Source0 * Wed Sep 21 2016 asn@cryptomilk.org - Update to version 1.1.0 * Added support to catch multiple exceptions * Added support to verify call ordering * Added support to pass initial data to test cases * Added will_return_maybe() for ignoring mock returns * Added subtests for groups using TAP output * Added support to write multiple XML files for groups * Improved documentation * Fixed XML output generataion * Fixed Windows builds with VS2015 * Wed Jul 15 2015 asn@cryptomilk.org - Do not turn of rpath support * Tue Jul 14 2015 tchvatal@suse.com - Use properly %%cmake macro to build nicely with all the linker/cflags - Use proper Url and Source - Properly fails on crashing tests instead of finishing build - Enable cmockery support * Thu Mar 12 2015 asn@cryptomilk.org - Update to version 1.0.1 * Added a macro for assert_ptr_equal(). * Fixed test_realloc() if 0 size is passed. * Fixed objects packaging bug. * Fixed building with newer gcc versions. * Tue Feb 17 2015 asn@cryptomilk.org - Add missing requires for cmake and pkg-config * Tue Feb 17 2015 asn@cryptomilk.org - Turn on unit tests * Mon Feb 16 2015 asn@cryptomilk.org - Update to version 1.0.0 * Added new test runner with group fixtures. The old runner is deprecated * Added an extensible message output formatter * Added jUnit XML message output * Added subunit message output * Added Test Anything Protocol message output * Added skip() command * Added test_realloc() * Added a cmockery compat header * Fixed a lot of bugs on Windows * Thu Sep 11 2014 asn@cryptomilk.org - Update to version 0.4.1 * Added CMOCKA_TEST_ABORT env variable to leave threading apps. * Fixed count parameter of expect_check() macro. * Fixed reporting the number of tests. * Fixed cmake config files. * Mon Sep 1 2014 asn@cryptomilk.org - Add baselibs.conf as Source. * Tue Aug 26 2014 asn@cryptomilk.org - Add BuildRequire for pkg-config. * Tue Aug 26 2014 asn@cryptomilk.org - Add BuildRequire for pkg-config. * Fri Apr 11 2014 asn@cryptomilk.org - Update to version 0.4.0 * Added support for group testing. * Added assert_return_code(). * Added better messages for errors. * Added cmake config mode support. * Fixed bug with unit_test_setup and unit_test_teardown. * Fixed a lot of small bugs. * Mon Nov 11 2013 asn@cryptomilk.org - Update to version 0.3.2 * Fixed FindNSIS detection. * Fixed unit_test_setup() and unit_test_teardown(). * Fixed GTest and GCC message style conformance * Fixed stringification in will_return_always(). * Wed Jul 10 2013 asn@cryptomilk.org - Update to version 0.3.1 * Fixed pointer conversion on s390 and ppc (32bit big endian). * Fixed the customer_database test on big endian. * Wed Jun 5 2013 asn@cryptomilk.org - Update to version 0.3.0 * Added a better mock object example. * Added pkgconfig file. * Added new macros mock_type() and mock_ptr_type(). * Added more documentation. * Fixed installation problems on some platforms. * Tue Feb 5 2013 asn@cryptomilk.org - Add a libcmocka-devel-static package for the static library. * Mon Jan 14 2013 asn@cryptomilk.org - Uploaded release tarball. * Wed Oct 10 2012 asn@cryptomilk.org - Fix building i686 on a x86_64 platform. * Tue Jun 26 2012 asn@cryptomilk.org - Initial version 0.2.0