How To Install cmockery2 on CentOS 7

In this tutorial we learn how to install cmockery2 on CentOS 7. cmockery2 is Lightweight C unit testing framework

Introduction

In this tutorial we learn how to install cmockery2 on CentOS 7.

What is cmockery2

Cmockery tests are compiled into a stand-alone executable and linked with the cmockery library, the standard C library and module being tested. Any symbols external to the module being tested should be mocked - replaced with functions that return values determined by the test - within the test application. Even though significant differences may exist between the target execution environment of a code module and the environment used to test the code the unit testing is still valid since its goal is to test the logic of a code modules at a functional level and not necessarily all of its interactions with the target execution environment. Other features * Lightweight C Unit test with mocking support * JUnit XML report output which can be used with Jenkins * Provides design-by-contract support This project is a successor of http Google’s http

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

Install cmockery2 on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

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

sudo yum -y install cmockery2

Install cmockery2 on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

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

sudo dnf -y install cmockery2

How To Uninstall cmockery2 on CentOS 7

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

sudo dnf remove cmockery2

References

Summary

In this tutorial we learn how to install cmockery2 on CentOS 7 using yum and dnf.