[libc-commits] [libc] 3bfbb68 - [libc] Rename libc-integration-test to libc-api-test.
Siva Chandra Reddy via libc-commits
libc-commits at lists.llvm.org
Wed Mar 23 13:25:54 PDT 2022
Author: Siva Chandra Reddy
Date: 2022-03-23T20:25:34Z
New Revision: 3bfbb68e1e7948b2042fae3734641ded992d2409
URL: https://github.com/llvm/llvm-project/commit/3bfbb68e1e7948b2042fae3734641ded992d2409
DIFF: https://github.com/llvm/llvm-project/commit/3bfbb68e1e7948b2042fae3734641ded992d2409.diff
LOG: [libc] Rename libc-integration-test to libc-api-test.
Reviewed By: jeffbailey, michaelrj
Differential Revision: https://reviews.llvm.org/D122272
Added:
libc/docs/api_test.rst
Modified:
libc/docs/index.rst
libc/test/src/CMakeLists.txt
Removed:
libc/docs/integration_test.rst
################################################################################
diff --git a/libc/docs/api_test.rst b/libc/docs/api_test.rst
new file mode 100644
index 0000000000000..b63adb3e64574
--- /dev/null
+++ b/libc/docs/api_test.rst
@@ -0,0 +1,17 @@
+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``
diff --git a/libc/docs/index.rst b/libc/docs/index.rst
index d51a1a6bdbb01..9c2dea043a48a 100644
--- a/libc/docs/index.rst
+++ b/libc/docs/index.rst
@@ -77,7 +77,7 @@ Other Interesting Documentation
ground_truth_specification
header_generation
implementation_standard
- integration_test
+ api_test
layering
mechanics_of_public_api
redirectors
diff --git a/libc/docs/integration_test.rst b/libc/docs/integration_test.rst
deleted file mode 100644
index dd3962bdeae6e..0000000000000
--- a/libc/docs/integration_test.rst
+++ /dev/null
@@ -1,19 +0,0 @@
-Integration Tests
-=====================
-The implementation of libc-project is unique because our public C header files
-are generated using information from TableGen. Unit tests only exercise the
-internal C++ implementations and don't ensure the headers were generated by the
-build system. End to end testing ensures that, after building, the produced
-library and headers are usable in the C runtime. 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 integration tests by modeling it from our
-generated headers. These integration tests ensure that public facing symbols are
-visible, that header files are generated as expected, and that each libc
-function has the correct function prototype.
-
-The integration test cmake rules are located in ``test/src/CMakeLists.txt`` and
-the generated integration test lives in
-``llvm/build/projects/libc/test/src/public_integration_test.cpp``
diff --git a/libc/test/src/CMakeLists.txt b/libc/test/src/CMakeLists.txt
index e10b9ec306469..db0742f417d84 100644
--- a/libc/test/src/CMakeLists.txt
+++ b/libc/test/src/CMakeLists.txt
@@ -52,7 +52,7 @@ add_subdirectory(stdio)
add_subdirectory(threads)
add_subdirectory(time)
-set(public_test ${CMAKE_CURRENT_BINARY_DIR}/public_integration_test.cpp)
+set(public_test ${CMAKE_CURRENT_BINARY_DIR}/public_api_test.cpp)
set(entrypoints_name_list "")
foreach(entry IN LISTS TARGET_LLVMLIBC_ENTRYPOINTS)
@@ -66,7 +66,7 @@ list(TRANSFORM entrypoints_name_list PREPEND "-e=")
file(GLOB spec_files ${LIBC_SOURCE_DIR}/spec/*.td)
-# Generate integration test souce code.
+# Generate api test souce code.
add_custom_command(
OUTPUT ${public_test}
COMMAND $<TARGET_FILE:libc-prototype-testgen> -o ${public_test}
@@ -80,32 +80,32 @@ add_custom_command(
)
add_executable(
- libc-integration-test
+ libc-api-test
EXCLUDE_FROM_ALL
${public_test}
)
# Blank out default include directories to prevent accidentally including
# system headers or our own internal headers.
set_target_properties(
- libc-integration-test
+ libc-api-test
PROPERTIES
INCLUDE_DIRECTORIES ""
)
# Only include we need is the include for cpp::IsSame and our generated
# public headers.
target_include_directories(
- libc-integration-test BEFORE
+ libc-api-test BEFORE
PRIVATE
"${LIBC_SOURCE_DIR}/src/__support/CPP"
"${LIBC_BUILD_DIR}/include"
)
target_compile_options(
- libc-integration-test
+ libc-api-test
PRIVATE
-ffreestanding
)
target_link_options(
- libc-integration-test
+ libc-api-test
PRIVATE "-nostdlib"
)
set(library_files)
@@ -116,7 +116,7 @@ endforeach()
if(COMPILER_RESOURCE_DIR AND LLVM_LIBC_ENABLE_LINTING)
add_custom_target(
- libc-integration-test-tidy
+ libc-api-test-tidy
VERBATIM
COMMAND $<TARGET_FILE:clang-tidy> --system-headers
--checks=-*,llvmlibc-restrict-system-libc-headers
@@ -130,10 +130,10 @@ if(COMPILER_RESOURCE_DIR AND LLVM_LIBC_ENABLE_LINTING)
DEPENDS
clang-tidy ${public_test}
)
- add_dependencies(libc-integration-test libc-integration-test-tidy)
+ add_dependencies(libc-api-test libc-api-test-tidy)
endif()
-target_link_libraries(libc-integration-test
+target_link_libraries(libc-api-test
PRIVATE
${library_files}
)
More information about the libc-commits
mailing list