view libc/docs/api_test.rst @ 252:1f2b6ac9f198 llvm-original

LLVM16-1
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 18 Aug 2023 09:04:13 +0900
parents c4bab56944e8
children
line wrap: on
line source

API Test
=====================
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 extpected 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``