[libc-commits] [libc] 880734a - [libc] Add a convenience CMake rule to add testsuites.
Siva Chandra Reddy via libc-commits
libc-commits at lists.llvm.org
Tue Jan 7 23:08:59 PST 2020
Author: Siva Chandra Reddy
Date: 2020-01-07T23:04:52-08:00
New Revision: 880734aebb396891d8e6596ae85d597ca43359b1
URL: https://github.com/llvm/llvm-project/commit/880734aebb396891d8e6596ae85d597ca43359b1
DIFF: https://github.com/llvm/llvm-project/commit/880734aebb396891d8e6596ae85d597ca43359b1.diff
LOG: [libc] Add a convenience CMake rule to add testsuites.
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
Added:
Modified:
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
Removed:
################################################################################
diff --git a/libc/cmake/modules/LLVMLibCRules.cmake b/libc/cmake/modules/LLVMLibCRules.cmake
index ae186c59bde1..c7aac7a92965 100644
--- a/libc/cmake/modules/LLVMLibCRules.cmake
+++ b/libc/cmake/modules/LLVMLibCRules.cmake
@@ -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)
diff --git a/libc/test/CMakeLists.txt b/libc/test/CMakeLists.txt
index fa7f29e1d2ac..8f5f0bb6d7e6 100644
--- a/libc/test/CMakeLists.txt
+++ b/libc/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_custom_target(check_libc)
+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
index a1034f995474..52824d270583 100644
--- a/libc/test/config/CMakeLists.txt
+++ b/libc/test/config/CMakeLists.txt
@@ -1 +1 @@
-add_subdirectory(linux)
+add_subdirectory(${LIBC_TARGET_OS})
diff --git a/libc/test/config/linux/CMakeLists.txt b/libc/test/config/linux/CMakeLists.txt
index 5a20f90881f0..7dc887c8c2aa 100644
--- a/libc/test/config/linux/CMakeLists.txt
+++ b/libc/test/config/linux/CMakeLists.txt
@@ -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})
diff --git a/libc/test/config/linux/x86_64/CMakeLists.txt b/libc/test/config/linux/x86_64/CMakeLists.txt
index 370073cd1cf7..9f9d21251c6f 100644
--- a/libc/test/config/linux/x86_64/CMakeLists.txt
+++ b/libc/test/config/linux/x86_64/CMakeLists.txt
@@ -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
diff --git a/libc/test/src/errno/CMakeLists.txt b/libc/test/src/errno/CMakeLists.txt
index 6c21da5701b4..1e361790e20a 100644
--- a/libc/test/src/errno/CMakeLists.txt
+++ b/libc/test/src/errno/CMakeLists.txt
@@ -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
diff --git a/libc/test/src/string/CMakeLists.txt b/libc/test/src/string/CMakeLists.txt
index bc5c088d169f..152bcbbc2aed 100644
--- a/libc/test/src/string/CMakeLists.txt
+++ b/libc/test/src/string/CMakeLists.txt
@@ -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
diff --git a/libc/test/src/sys/mman/CMakeLists.txt b/libc/test/src/sys/mman/CMakeLists.txt
index 3e153eb11344..b2f378387a6a 100644
--- a/libc/test/src/sys/mman/CMakeLists.txt
+++ b/libc/test/src/sys/mman/CMakeLists.txt
@@ -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
More information about the libc-commits
mailing list