How To Install libcmocka on Fedora 34

libcmocka is Lightweight library to simplify and generalize unit tests for C Lightweight library to simplify and generalize unit tests for C

Introduction

In this tutorial we learn how to install libcmocka on Fedora 34.

What is libcmocka

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. libcmocka 1.1.5 8.fc34 x86_64 36 k cmocka-1.1.5-8.fc34.src.rpm fedora Lightweight library to simplify and generalize unit tests for C https ASL 2.0 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.

We can use yum or dnf to install libcmocka on Fedora 34. In this tutorial we discuss both methods but you only need to choose one of method to install libcmocka.

Install libcmocka on Fedora 34 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install libcmocka using dnf by running the following command:

sudo dnf -y install libcmocka

Install libcmocka on Fedora 34 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install libcmocka using yum by running the following command:

sudo yum -y install libcmocka

How To Uninstall libcmocka on Fedora 34

To uninstall only the libcmocka package we can use the following command:

sudo dnf remove libcmocka

libcmocka Package Contents on Fedora 34

/usr/lib/.build-id
/usr/lib/.build-id/88
/usr/lib/.build-id/88/255bccefcb640aded7679d61fcc9db17e3ecde
/usr/lib/libcmocka.so.0
/usr/lib/libcmocka.so.0.7.0
/usr/share/doc/libcmocka
/usr/share/doc/libcmocka/AUTHORS
/usr/share/doc/libcmocka/ChangeLog
/usr/share/doc/libcmocka/README.md
/usr/share/licenses/libcmocka
/usr/share/licenses/libcmocka/COPYING
/usr/lib/.build-id
/usr/lib/.build-id/c9
/usr/lib/.build-id/c9/75ac07e1bb6a8d847fd6f5901664aac6fff885
/usr/lib64/libcmocka.so.0
/usr/lib64/libcmocka.so.0.7.0
/usr/share/doc/libcmocka
/usr/share/doc/libcmocka/AUTHORS
/usr/share/doc/libcmocka/ChangeLog
/usr/share/doc/libcmocka/README.md
/usr/share/licenses/libcmocka
/usr/share/licenses/libcmocka/COPYING

References

Summary

In this tutorial we learn how to install libcmocka on Fedora 34 using yum and dnf.