[libc] Add a convenience CMake rule to add testsuites.
authorSiva Chandra Reddy <sivachandra@google.com>
Tue, 7 Jan 2020 19:09:40 +0000 (11:09 -0800)
committerSiva Chandra Reddy <sivachandra@google.com>
Wed, 8 Jan 2020 07:04:52 +0000 (23:04 -0800)
Summary:
This rule helps avoid repeated setting of check-libc's dependency on the
various testsuites.

Reviewers: abrachet

Subscribers: mgorny, MaskRay, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D72353

libc/cmake/modules/LLVMLibCRules.cmake
libc/test/CMakeLists.txt
libc/test/config/CMakeLists.txt
libc/test/config/linux/CMakeLists.txt
libc/test/config/linux/x86_64/CMakeLists.txt
libc/test/src/errno/CMakeLists.txt
libc/test/src/string/CMakeLists.txt
libc/test/src/sys/mman/CMakeLists.txt

index ae186c5..c7aac7a 100644 (file)
@@ -371,3 +371,8 @@ function(add_libc_unittest target_name)
     )
   endif()
 endfunction(add_libc_unittest)
+
+function(add_libc_testsuite suite_name)
+  add_custom_target(${suite_name})
+  add_dependencies(check-libc ${suite_name})
+endfunction(add_libc_testsuite)
index fa7f29e..8f5f0bb 100644 (file)
@@ -1,4 +1,4 @@
-add_custom_target(check_libc)
+add_custom_target(check-libc)
 
 add_subdirectory(config)
 add_subdirectory(src)
index a1034f9..52824d2 100644 (file)
@@ -1 +1 @@
-add_subdirectory(linux)
+add_subdirectory(${LIBC_TARGET_OS})
index 5a20f90..7dc887c 100644 (file)
@@ -1,4 +1,3 @@
-add_custom_target(libc_linux_tests)
-add_dependencies(check_libc libc_linux_tests)
+add_libc_testsuite(libc_linux_tests)
 
-add_subdirectory(x86_64)
+add_subdirectory(${LIBC_TARGET_MACHINE})
index 370073c..9f9d212 100644 (file)
@@ -1,9 +1,6 @@
-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
+  SUITE libc_linux_tests
   SRCS syscall_test.cpp
   DEPENDS
    syscall_impl_h
index 6c21da5..1e36179 100644 (file)
@@ -1,5 +1,4 @@
-add_custom_target(libc_errno_unittests)
-add_dependencies(check_libc libc_errno_unittests)
+add_libc_testsuite(libc_errno_unittests)
 
 add_libc_unittest(
   errno_test
index bc5c088..152bcbb 100644 (file)
@@ -1,5 +1,4 @@
-add_custom_target(libc_string_unittests)
-add_dependencies(check_libc libc_string_unittests)
+add_libc_testsuite(libc_string_unittests)
 
 add_libc_unittest(
   strcat_test
index 3e153eb..b2f3783 100644 (file)
@@ -1,5 +1,4 @@
-add_custom_target(libc_sys_mman_unittests)
-add_dependencies(check_libc libc_sys_mman_unittests)
+add_libc_testsuite(libc_sys_mman_unittests)
 
 add_libc_unittest(
   mmap_test