API Sanity Checker — an automatic generator of basic unit tests for a C/C++ library API.
The tool is able to generate reasonable (in most, but unfortunately not all, cases) input data for parameters and compose simple ("sanity" or "shallow"-quality) test cases for every function in the API through the analysis of declarations in header files.
The quality of generated tests allows to check absence of critical errors in simple use cases. The tool is able to build and execute generated tests and detect crashes (segfaults), all kinds of emitted signals, non-zero program return code and program hanging.
The tool is developed by Andrey Ponomarenko.
sudo make install prefix=/usr
- ABI Compliance Checker 1.99.24 or newer: https://github.com/lvc/abi-compliance-checker
- Perl 5
- G++
- GNU Binutils
- Ctags
api-sanity-checker -lib NAME -d VERSION.xml -gen -build -run
VERSION.xml
is XML-descriptor:
<version>
1.0
</version>
<headers>
/path/to/headers/
</headers>
<libs>
/path/to/libraries/
</libs>
For advanced usage, see doc/index.html
or output of -help
option.
A small test to check that the tool works properly in your environment:
api-sanity-checker -test