2022-11-04 12:53:24 -07:00
|
|
|
.. _api_test:
|
|
|
|
|
|
|
|
========
|
2022-03-22 23:42:01 +00:00
|
|
|
API Test
|
2022-11-04 12:53:24 -07:00
|
|
|
========
|
2023-11-28 10:14:12 -08:00
|
|
|
|
|
|
|
.. warning::
|
|
|
|
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.
|
|
|
|
|
2022-03-22 23:42:01 +00:00
|
|
|
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
|
2023-04-24 23:31:48 -07:00
|
|
|
contain the expected declarations and definitions. A simple solution is to have
|
2022-03-22 23:42:01 +00:00
|
|
|
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``
|