How To Install gtest on CentOS 8

gtest is Google C++ testing framework Google C++ testing framework

Introduction

In this tutorial we learn how to install gtest on CentOS 8.

What is gtest

Framework for writing C++ tests on a variety of platforms (GNU/Linux, Mac OS X, Windows, Windows CE, and Symbian). Based on the xUnit architecture. Supports automatic test discovery, a rich set of assertions, user-defined assertions, death tests, fatal and non-fatal failures, various options for running the tests, and XML test report generation. gtest 1.8.0 5.el8 x86_64 132 k gtest-1.8.0-5.el8.src.rpm powertools Google C++ testing framework https BSD and ASL2.0 Framework for writing C++ tests on a variety of platforms (GNU/Linux, Mac OS X, Windows, Windows CE, and Symbian). Based on the xUnit architecture. Supports automatic test discovery, a rich set of assertions, user-defined assertions, death tests, fatal and non-fatal failures, various options for running the tests, and XML test report generation.

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

Install gtest on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

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

sudo dnf -y install gtest

Install gtest on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

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

sudo yum -y install gtest

How To Uninstall gtest on CentOS 8

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

sudo dnf remove gtest

gtest Package Contents on CentOS 8

/usr/lib/.build-id
/usr/lib/.build-id/6c
/usr/lib/.build-id/6c/c0cc05cb6eeaf04d4717f162e91d8fb3b473a4
/usr/lib/.build-id/be
/usr/lib/.build-id/be/9835edbdc32e7bf96dc9fcd199898403d5004b
/usr/lib/libgtest.so.1.8.0
/usr/lib/libgtest_main.so.1.8.0
/usr/share/licenses/gtest
/usr/share/licenses/gtest/LICENSE
/usr/lib/.build-id
/usr/lib/.build-id/b9
/usr/lib/.build-id/b9/52ca0b68a2e0e603aca47ad6104c89cc2e28ba
/usr/lib/.build-id/d2
/usr/lib/.build-id/d2/962325ddd629200b94318a231f5833ce27dc34
/usr/lib64/libgtest.so.1.8.0
/usr/lib64/libgtest_main.so.1.8.0
/usr/share/licenses/gtest
/usr/share/licenses/gtest/LICENSE

References

Summary

In this tutorial we learn how to install gtest on CentOS 8 using yum and dnf.