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, -library NAME β€” Library name (without version). keep it bare, no version attached.
  • -d, -descriptor PATH β€” Path to the library descriptor (the VER.xml file):
<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 -l and -d should be specified. To generate a test for a particular function, use it together with the -f option. Exit code: number of test cases failed to build.
  • -build, -make β€” Build test(s). Options -l and -d should be specified. To build a test for a particular function, use it together with the -f option. Exit code: number of test cases failed to generate.
  • -run β€” Run test(s), create test report. Options -l and -d should be specified. To run a test for a particular function, use it together with the -f option. Exit code: number of failed test cases.
  • -clean β€” Clean test(s). Options -l and -d should be specified. To clean a test for a particular function, use it together with the -f option.

πŸ”₯ EXTRA OPTIONS πŸ”₯

  • -vnum NUM β€” Specify library version outside the descriptor.
  • -s, -symbol NAME β€” Generate/Build/Run test for the specified function (mangled name in C++). yes bestie, mangled. that's the rule 😌
  • -symbols-list PATH β€” 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.
  • -header NAME β€” 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-types PATH β€” 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-data PATH β€” 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-list option or by the group devision in the descriptor.
  • -view-only β€” Remove all files from the test suite except *.html files. 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-includes LEVEL β€” Enable optimization of the list of included headers in each test case. Available levels:
    • High (default)
    • Medium
    • Low
    • None - disable
  • -p, -params PATH β€” 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 ...
...
  • -title NAME β€” The name of the library in the report title.
  • -relpath, -reldir PATH β€” Replace {RELPATH} in the library descriptor by PATH.
  • -lang LANG β€” Set library language (C or C++). You can use this option if the tool cannot auto-detect a language.
  • -target COMPILER β€” The compiler that should be used to build generated tests under Windows. Supported:
    • gcc - GNU compiler
    • cl - 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 © 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