diff options
author | Siva Chandra Reddy <sivachandra@google.com> | 2020-01-03 12:00:45 -0800 |
---|---|---|
committer | Siva Chandra Reddy <sivachandra@google.com> | 2020-01-06 10:14:43 -0800 |
commit | 5b24c088171d3bd7a8ff559c82926e5d4b04f032 (patch) | |
tree | 54ac5d666fef87a0e6337e388f6f5087c18e9ef9 /libc | |
parent | 0239526cccf8aa708e29eeb7e49de8f6dc6c1a5f (diff) | |
download | bcm5719-llvm-5b24c088171d3bd7a8ff559c82926e5d4b04f032.tar.gz bcm5719-llvm-5b24c088171d3bd7a8ff559c82926e5d4b04f032.zip |
[libc] Move all tests to a top level `test` directory.
A toplevel target, `check-libc` has also been added.
Reviewers: abrachet, phosek
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D72177
Diffstat (limited to 'libc')
22 files changed, 89 insertions, 60 deletions
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt index d07646d7701..ee57e5d313c 100644 --- a/libc/CMakeLists.txt +++ b/libc/CMakeLists.txt @@ -22,5 +22,10 @@ include(LLVMLibCRules) add_subdirectory(src) add_subdirectory(config) add_subdirectory(include) -add_subdirectory(lib) add_subdirectory(utils) + +# The lib and test directories are added at the very end as tests +# and libraries potentially draw from the components present in all +# of the other directories. +add_subdirectory(lib) +add_subdirectory(test) diff --git a/libc/config/linux/x86_64/CMakeLists.txt b/libc/config/linux/x86_64/CMakeLists.txt index 8ed89823261..e69de29bb2d 100644 --- a/libc/config/linux/x86_64/CMakeLists.txt +++ b/libc/config/linux/x86_64/CMakeLists.txt @@ -1,10 +0,0 @@ -add_custom_target(libc_linux_x86_64_unittests) - -add_libc_unittest( - libc_linux_x86_64_syscall_unittest - SUITE libc_linux_x86_64_unittests - SRCS syscall_test.cpp - DEPENDS - syscall_impl_h - support_common_h -) diff --git a/libc/docs/source_layout.rst b/libc/docs/source_layout.rst index b06ad96e1b8..685798c1957 100644 --- a/libc/docs/source_layout.rst +++ b/libc/docs/source_layout.rst @@ -11,6 +11,7 @@ directories:: - lib - loader - src + - test + utils - build_scripts - testing @@ -69,6 +70,15 @@ further organized as follows: implementation standard document explains more about the *header* directories. +The ``test`` directory +---------------------- + +This directory contains tests for the various components of llvm-libc. The +directory structure within this directory mirrors the directory structure of the +toplevel ``libc`` directory itself. A test for, say the ``mmap`` function, lives +in the directory ``test/src/sys/mman/`` as implementation of ``mmap`` lives in +``src/sys/mman``. + The ``www`` directory --------------------- diff --git a/libc/src/errno/CMakeLists.txt b/libc/src/errno/CMakeLists.txt index 32d7262044b..9f244908d70 100644 --- a/libc/src/errno/CMakeLists.txt +++ b/libc/src/errno/CMakeLists.txt @@ -5,15 +5,3 @@ add_entrypoint_object( HDRS llvmlibc_errno.h ) - -add_custom_target(libc_errno_unittests) - -add_libc_unittest( - errno_test - SUITE - libc_errno_unittests - SRCS - errno_test.cpp - DEPENDS - __errno_location -) diff --git a/libc/src/string/CMakeLists.txt b/libc/src/string/CMakeLists.txt index a8984f6ee9f..459d9489e3a 100644 --- a/libc/src/string/CMakeLists.txt +++ b/libc/src/string/CMakeLists.txt @@ -1,4 +1,2 @@ -add_custom_target(libc_string_unittests) - add_subdirectory(strcpy) add_subdirectory(strcat) diff --git a/libc/src/string/strcat/CMakeLists.txt b/libc/src/string/strcat/CMakeLists.txt index 790d77bbb1a..e37e4262b3e 100644 --- a/libc/src/string/strcat/CMakeLists.txt +++ b/libc/src/string/strcat/CMakeLists.txt @@ -8,14 +8,3 @@ add_entrypoint_object( strcpy string_h ) - -add_libc_unittest( - strcat_test - SUITE - libc_string_unittests - SRCS - strcat_test.cpp - DEPENDS - strcat - strcpy -) diff --git a/libc/src/string/strcpy/CMakeLists.txt b/libc/src/string/strcpy/CMakeLists.txt index 9f2791139ee..411333a73a8 100644 --- a/libc/src/string/strcpy/CMakeLists.txt +++ b/libc/src/string/strcpy/CMakeLists.txt @@ -7,13 +7,3 @@ add_entrypoint_object( DEPENDS string_h ) - -add_libc_unittest( - strcpy_test - SUITE - libc_string_unittests - SRCS - strcpy_test.cpp - DEPENDS - strcpy -) diff --git a/libc/src/sys/mman/CMakeLists.txt b/libc/src/sys/mman/CMakeLists.txt index f2d98a45518..9b8cc66299a 100644 --- a/libc/src/sys/mman/CMakeLists.txt +++ b/libc/src/sys/mman/CMakeLists.txt @@ -25,17 +25,3 @@ add_entrypoint_object( syscall_impl_h __errno_location ) - -add_custom_target(libc_sys_mman_unittests) - -add_libc_unittest( - mmap_test - SUITE - libc_sys_mman_unittests - SRCS - mmap_test.cpp - DEPENDS - mmap - munmap - __errno_location -) diff --git a/libc/test/CMakeLists.txt b/libc/test/CMakeLists.txt new file mode 100644 index 00000000000..fa7f29e1d2a --- /dev/null +++ b/libc/test/CMakeLists.txt @@ -0,0 +1,4 @@ +add_custom_target(check_libc) + +add_subdirectory(config) +add_subdirectory(src) diff --git a/libc/test/config/CMakeLists.txt b/libc/test/config/CMakeLists.txt new file mode 100644 index 00000000000..a1034f99547 --- /dev/null +++ b/libc/test/config/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(linux) diff --git a/libc/test/config/linux/CMakeLists.txt b/libc/test/config/linux/CMakeLists.txt new file mode 100644 index 00000000000..5a20f90881f --- /dev/null +++ b/libc/test/config/linux/CMakeLists.txt @@ -0,0 +1,4 @@ +add_custom_target(libc_linux_tests) +add_dependencies(check_libc libc_linux_tests) + +add_subdirectory(x86_64) diff --git a/libc/test/config/linux/x86_64/CMakeLists.txt b/libc/test/config/linux/x86_64/CMakeLists.txt new file mode 100644 index 00000000000..370073cd1cf --- /dev/null +++ b/libc/test/config/linux/x86_64/CMakeLists.txt @@ -0,0 +1,11 @@ +add_custom_target(libc_linux_x86_64_tests) +add_dependencies(libc_linux_tests libc_linux_x86_64_tests) + +add_libc_unittest( + libc_linux_x86_64_syscall_unittest + SUITE libc_linux_x86_64_tests + SRCS syscall_test.cpp + DEPENDS + syscall_impl_h + support_common_h +) diff --git a/libc/config/linux/x86_64/syscall_test.cpp b/libc/test/config/linux/x86_64/syscall_test.cpp index 6a92142625c..6a92142625c 100644 --- a/libc/config/linux/x86_64/syscall_test.cpp +++ b/libc/test/config/linux/x86_64/syscall_test.cpp diff --git a/libc/test/src/CMakeLists.txt b/libc/test/src/CMakeLists.txt new file mode 100644 index 00000000000..daf0f1ce57c --- /dev/null +++ b/libc/test/src/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(errno) +add_subdirectory(string) +add_subdirectory(sys) diff --git a/libc/test/src/errno/CMakeLists.txt b/libc/test/src/errno/CMakeLists.txt new file mode 100644 index 00000000000..6c21da5701b --- /dev/null +++ b/libc/test/src/errno/CMakeLists.txt @@ -0,0 +1,12 @@ +add_custom_target(libc_errno_unittests) +add_dependencies(check_libc libc_errno_unittests) + +add_libc_unittest( + errno_test + SUITE + libc_errno_unittests + SRCS + errno_test.cpp + DEPENDS + __errno_location +) diff --git a/libc/src/errno/errno_test.cpp b/libc/test/src/errno/errno_test.cpp index 1ca61d5c625..1ca61d5c625 100644 --- a/libc/src/errno/errno_test.cpp +++ b/libc/test/src/errno/errno_test.cpp diff --git a/libc/test/src/string/CMakeLists.txt b/libc/test/src/string/CMakeLists.txt new file mode 100644 index 00000000000..bc5c088d169 --- /dev/null +++ b/libc/test/src/string/CMakeLists.txt @@ -0,0 +1,23 @@ +add_custom_target(libc_string_unittests) +add_dependencies(check_libc libc_string_unittests) + +add_libc_unittest( + strcat_test + SUITE + libc_string_unittests + SRCS + strcat_test.cpp + DEPENDS + strcat + strcpy +) + +add_libc_unittest( + strcpy_test + SUITE + libc_string_unittests + SRCS + strcpy_test.cpp + DEPENDS + strcpy +) diff --git a/libc/src/string/strcat/strcat_test.cpp b/libc/test/src/string/strcat_test.cpp index 3b8a7a7e447..3b8a7a7e447 100644 --- a/libc/src/string/strcat/strcat_test.cpp +++ b/libc/test/src/string/strcat_test.cpp diff --git a/libc/src/string/strcpy/strcpy_test.cpp b/libc/test/src/string/strcpy_test.cpp index e68ea5103db..e68ea5103db 100644 --- a/libc/src/string/strcpy/strcpy_test.cpp +++ b/libc/test/src/string/strcpy_test.cpp diff --git a/libc/test/src/sys/CMakeLists.txt b/libc/test/src/sys/CMakeLists.txt new file mode 100644 index 00000000000..03c59bfc4a0 --- /dev/null +++ b/libc/test/src/sys/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(mman) diff --git a/libc/test/src/sys/mman/CMakeLists.txt b/libc/test/src/sys/mman/CMakeLists.txt new file mode 100644 index 00000000000..3e153eb1134 --- /dev/null +++ b/libc/test/src/sys/mman/CMakeLists.txt @@ -0,0 +1,14 @@ +add_custom_target(libc_sys_mman_unittests) +add_dependencies(check_libc libc_sys_mman_unittests) + +add_libc_unittest( + mmap_test + SUITE + libc_sys_mman_unittests + SRCS + mmap_test.cpp + DEPENDS + mmap + munmap + __errno_location +) diff --git a/libc/src/sys/mman/mmap_test.cpp b/libc/test/src/sys/mman/mmap_test.cpp index ab2e6ceb4a9..ab2e6ceb4a9 100644 --- a/libc/src/sys/mman/mmap_test.cpp +++ b/libc/test/src/sys/mman/mmap_test.cpp |