How To Install api-sanity-checker on Ubuntu 18.04

In this tutorial we learn how to install api-sanity-checker on Ubuntu 18.04. api-sanity-checker is automatic generator of basic unit tests for a C/C++ library API

Introduction

In this tutorial we learn how to install api-sanity-checker on Ubuntu 18.04.

What is api-sanity-checker

api-sanity-checker is:

API Sanity Checker is an automatic generator of basic unit tests for a C/C++ library. It helps to quickly generate simple (“sanity” or “shallow” quality) tests for every function in an API using their signatures, data type definitions and relationships between functions straight from the library header files (“Header-Driven Generation”). Each test case contains a function call with reasonable (in most, but unfortunately not all, cases) input parameters. The quality of generated tests allows one to check absence of critical errors in simple use cases and can be greatly improved by involving of highly reusable specialized types for the library.

The tool can execute generated tests and detect crashes, aborts, all kinds of emitted signals, non-zero program return code, program hang‐ ing and requirement failures (if specified). The tool can be considered as a tool for out-of-box low-cost sanity checking of library API or as a test development framework for initial generation of templates for advanced tests. Also it supports universal Template2Code format of tests, splint specifications, random test generation mode and other useful features.

There are three methods to install api-sanity-checker on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install api-sanity-checker Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install api-sanity-checker using apt-get by running the following command:

sudo apt-get -y install api-sanity-checker

Install api-sanity-checker Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install api-sanity-checker using apt by running the following command:

sudo apt -y install api-sanity-checker

Install api-sanity-checker Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install api-sanity-checker using aptitude by running the following command:

sudo aptitude -y install api-sanity-checker

How To Uninstall api-sanity-checker on Ubuntu 18.04

To uninstall only the api-sanity-checker package we can use the following command:

sudo apt-get remove api-sanity-checker

Uninstall api-sanity-checker And Its Dependencies

To uninstall api-sanity-checker and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove api-sanity-checker

Remove api-sanity-checker Configurations and Data

To remove api-sanity-checker configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge api-sanity-checker

Remove api-sanity-checker configuration, data, and all of its dependencies

We can use the following command to remove api-sanity-checker configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge api-sanity-checker

References

Summary

In this tutorial we learn how to install api-sanity-checker package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.