API Test


This page is severely out of date. Much of the information it contains may be incorrect. Please only remove this warning once the page has been updated.

The implementation of libc-project is unique because our public C header files are generated using information from ground truth captured in TableGen files. Unit tests only exercise the internal C++ implementations and don’t ensure the headers were generated by the build system and that the generated header files contain the expected declarations and definitions. A simple solution is to have contributors write an integration test for each individual function as a C program; however, this would place a large burden on contributors and duplicates some effort from the unit tests.

Instead we automate the generation of what we call as an API test. This API test ensures that public facing symbols are visible, that the header files are generated as expected, and that each libc function has the correct function prototype as specified by the standards. The API test cmake rules are located in test/src/CMakeLists.txt. The source file for the API test is generated in <build directory>/projects/libc/test/src/public_api_test.cpp