API-SANITY-CHECKER(1)
π bestie. wake UP. API-SANITY-CHECKER(1) is here and it lives in User Commands (section 1) and it's literally about to hand you free unit tests for your C/C++ library API. no cap. let's go β¨
π NAME π
api-sanity-checker β an automatic generator of basic unit tests for a C/C++ library API. that's the whole vibe. π¦
β¨ DESCRIPTION β¨
π NAME:
API Sanity Checker (api-sanity-checker) β Generate basic unit tests for a C/C++ library API. iconic behaviour, honestly.
πΈ DESCRIPTION:
okay so, API Sanity Checker is an automatic generator of basic unit tests for a C/C++ library. it helps you quickly generate simple ("sanity" or "shallow" quality) tests for every function in an API, using their signatures, data type definitions, and the relationships between functions β pulled straight from the library header files ("Header-Driven Generation"). main character energy fr. π
each test case contains a function call with reasonable input parameters (in most, but unfortunately not all, cases β it said what it said π). the quality of the generated tests lets you check for the absence of critical errors in simple use cases, and it can be greatly improved by bringing in highly reusable specialized types for the library. π
the tool can execute the generated tests and detect crashes, aborts, all kinds of emitted signals, non-zero program return code, program hanging, and requirement failures (if specified). so it's giving "out-of-box low-cost sanity checking of a library API" and "test development framework for the initial generation of templates for advanced tests." it also supports the universal Template2Code format of tests, splint specifications, random test generation mode, and other useful features. obsessed. π«Ά
this tool is free software: you can redistribute it and/or modify it under the terms of the GNU LGPL or GNU GPL. periodt. π
π§ USAGE:
api-sanity-checker [options]
π EXAMPLE:
api-sanity-checker -lib NAME -d VER.xml -gen -build -run
and VERSION.xml is the XML-descriptor:
<version>
1.0
</version>
<headers>
/path1/to/header(s)/ /path2/to/header(s)/
...
</headers>
<libs>
/path1/to/library(ies)/ /path2/to/library(ies)/
...
</libs>
π INFORMATION OPTIONS π
-h,-helpβ Print this help. the "bestie explain" button π«Ά-infoβ Print complete info. all of it. the whole lore dump.-v,-versionβ Print version information.-dumpversionβ Print the tool version (1.98.7) and don't do anything else. just the number, nothing more, she said π
πΈ GENERAL OPTIONS πΈ
-l,-lib,-libraryNAME β Library name (without version). keep it bare, no version attached.-d,-descriptorPATH β Path to the library descriptor (theVER.xmlfile):
<version>
1.0
</version>
<headers>
/path1/to/header(s)/ /path2/to/header(s)/ ...
</headers>
<libs>
/path1/to/library(ies)/ /path2/to/library(ies)/ ...
</libs>
for more information, please see: http://lvc.github.com/api-sanity-checker/Xml-Descriptor.html
-gen,-generateβ Generate test(s). Options-land-dshould be specified. To generate a test for a particular function, use it together with the-foption. Exit code: number of test cases failed to build.-build,-makeβ Build test(s). Options-land-dshould be specified. To build a test for a particular function, use it together with the-foption. Exit code: number of test cases failed to generate.-runβ Run test(s), create test report. Options-land-dshould be specified. To run a test for a particular function, use it together with the-foption. Exit code: number of failed test cases.-cleanβ Clean test(s). Options-land-dshould be specified. To clean a test for a particular function, use it together with the-foption.
π₯ EXTRA OPTIONS π₯
-vnumNUM β Specify library version outside the descriptor.-s,-symbolNAME β Generate/Build/Run test for the specified function (mangled name in C++). yes bestie, mangled. that's the rule π-symbols-listPATH β This option allows you to specify a file with a list of functions (one per line, mangled name in C++) that should be tested; other library functions will not be tested.-headerNAME β This option allows you to restrict the list of functions that should be tested by providing a header file name in which they are declared. This option is intended for step-by-step tests development. little by little, we love a slow burn β¨-allβ Generate tests for all symbols recursively included in header file(s).-xvfbβ Use Xvfb-server instead of the current X-server (default) for running tests.-t2c,-template2codeβ Generate tests in the universal Template2Code format. For more information, please see: http://sourceforge.net/projects/template2code/-strict-genβ Terminate the process of generating tests and return error code'1'if it cannot generate at least one test case. she is NOT playing π«-strict-buildβ Terminate the process of building tests and return error code'1'if it cannot build at least one test case.-strict-runβ Terminate the process of running tests and return error code'1'if at least one test case failed.-strictβ This option enables all-strict-*options. the whole squad, activated π-r,-randomβ Random test generation mode. chaos mode, love that for us.-minβ Generate minimun code, call functions with the minimum number of parameters to initialize parameters of other functions.-maxβ Generate maximum code, call functions with the maximum number of parameters to initialize parameters of other functions.-show-retvalβ Show the function return type in the report.-check-retvalβ Insert requirements on return values (retval!=NULL) for each called function.-st,-specialized-typesPATH β Path to the file with the collection of specialized types. For more information, please see: http://lvc.github.com/api-sanity-checker/Specialized-Type.html-td,-test-dataPATH β Path to the directory with the test data files. For more information, please see: http://lvc.github.com/api-sanity-checker/Specialized-Type.html-headers-onlyβ If the library consists of inline functions only and has no shared objects, then you should specify this option.-no-inlineβ Don't generate tests for inline functions.-keep-internalβ Generate tests for internal symbols (functions with a'__'prefix and methods of classes declared inside other classes).-isolatedβ Allow one to restrict functions usage by the lists specified by the-functions-listoption or by the group devision in the descriptor.-view-onlyβ Remove all files from the test suite except*.htmlfiles. This option allows one to create a lightweight html-index for all tests. declutter queen π§Ή-disable-default-valuesβ Disable usage of default values for function parameters.-optimize-includesLEVEL β Enable optimization of the list of included headers in each test case. Available levels:- High (default)
- Medium
- Low
- None - disable
-p,-paramsPATH β Path to a file with the function parameter names. It can be used for improving generated tests if the library header files don't contain parameter names. File format:
func1;param1;param2;param3 ...
func2;param1;param2;param3 ...
...
-titleNAME β The name of the library in the report title.-relpath,-reldirPATH β Replace{RELPATH}in the library descriptor by PATH.-langLANG β Set library language (C or C++). You can use this option if the tool cannot auto-detect a language.-targetCOMPILER β The compiler that should be used to build generated tests under Windows. Supported:gcc- GNU compilercl- MS compiler (default)
-debugβ Write extended log for debugging. for when you need the receipts π-cacheβ Cache the ABI dump and use it on the next run. work smarter not harder π
π¦ OTHER OPTIONS π¦
-testβ Run internal tests. Create a simple library and run the tool on it. This option allows one to check if the tool works correctly on the system. a little vibe check for your machine β¨-disable-variable-reuseβ Disable reusing of previously created variables in the test.-long-variable-namesβ Enable long (complex) variable names instead of short names.
β EXIT CODES: β
0- Successful tests. The tool has run without any errors.non-zero- Tests failed or the tool has run with errors.
heads up bestie: if you see a non-zero walking out the door, something either failed or straight up went wrong. no in-between. π
π MORE INFORMATION: π
http://lvc.github.com/api-sanity-checker/ β go read, iykyk π
π AUTHOR π
This manual page was written by Mathieu Malaterre <malat@debian.org> for the Debian GNU/Linux system (but may be used by others). give her her flowers π
Written by Andrey Ponomarenko.
π COPYRIGHT π
Copyright Β© 2015 Andrey Ponomarenko's ABI Laboratory License: LGPL or GPL http://www.gnu.org/licenses/ This program is free software: you can redistribute it and/or modify it. absolute slay, go forth and redistribute π«Ά
okay that's the whole page, bestie β this was the API Sanity Checker, version 1.98.7, dated December 2025 πβ¨ ily, go build something and let the checker carry the sanity for you ππ¦π
π¦ where this page comes from
- ubuntu resolute: api-sanity-checker 1.98.7-2.2build1 Β· GPL-2.0-only
- ubuntu stonking: api-sanity-checker 1.98.7-2.2build1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms