[libc-commits] [libc] acca298 - [libc][obvious] Move ErrnoSetterMatcher to test/ErrnoSetterMetcher.h.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Tue Jul 28 11:06:08 PDT 2020


Author: Siva Chandra Reddy
Date: 2020-07-28T11:05:52-07:00
New Revision: acca2980a33e182dd6f4c71554ff2130f260463e

URL: https://github.com/llvm/llvm-project/commit/acca2980a33e182dd6f4c71554ff2130f260463e
DIFF: https://github.com/llvm/llvm-project/commit/acca2980a33e182dd6f4c71554ff2130f260463e.diff

LOG: [libc][obvious] Move ErrnoSetterMatcher to test/ErrnoSetterMetcher.h.

Added: 
    libc/test/ErrnoSetterMatcher.h

Modified: 
    libc/test/CMakeLists.txt
    libc/test/src/signal/CMakeLists.txt
    libc/test/src/signal/sigaction_test.cpp
    libc/test/src/signal/sigaddset_test.cpp
    libc/test/src/signal/sigdelset_test.cpp
    libc/test/src/signal/sigfillset_test.cpp
    libc/test/src/signal/signal_test.cpp
    libc/test/src/signal/sigprocmask_test.cpp
    libc/test/src/sys/mman/linux/CMakeLists.txt
    libc/test/src/sys/mman/linux/mmap_test.cpp
    libc/test/src/unistd/CMakeLists.txt
    libc/test/src/unistd/write_test.cpp
    libc/utils/UnitTest/CMakeLists.txt

Removed: 
    libc/utils/UnitTest/ErrnoSetterMatcher.h


################################################################################
diff  --git a/libc/test/CMakeLists.txt b/libc/test/CMakeLists.txt
index 500b294ad386..edce4bbf78cc 100644
--- a/libc/test/CMakeLists.txt
+++ b/libc/test/CMakeLists.txt
@@ -1,3 +1,9 @@
+add_header_library(
+  errno_setter_matcher
+  HDRS
+    ErrnoSetterMatcher.h
+)
+
 add_custom_target(check-libc)
 
 add_subdirectory(config)

diff  --git a/libc/utils/UnitTest/ErrnoSetterMatcher.h b/libc/test/ErrnoSetterMatcher.h
similarity index 84%
rename from libc/utils/UnitTest/ErrnoSetterMatcher.h
rename to libc/test/ErrnoSetterMatcher.h
index d676ee9cbc91..7f8311bfd5e6 100644
--- a/libc/utils/UnitTest/ErrnoSetterMatcher.h
+++ b/libc/test/ErrnoSetterMatcher.h
@@ -6,15 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_LIBC_UTILS_UNITTEST_ERRNOSETTERMATCHER_H
-#define LLVM_LIBC_UTILS_UNITTEST_ERRNOSETTERMATCHER_H
+#ifndef LLVM_LIBC_TEST_ERRNOSETTERMATCHER_H
+#define LLVM_LIBC_TEST_ERRNOSETTERMATCHER_H
 
-#include "Test.h"
-
-// Using LLVM libc headers in UnitTest is not ideal however we also want the
-// test/ directory to have the same layout as libc/ so there is no clean place
-// to put this file except for in utils/UnitTest/.
 #include "src/errno/llvmlibc_errno.h"
+#include "utils/UnitTest/Test.h"
 
 namespace __llvm_libc {
 namespace testing {
@@ -73,4 +69,4 @@ static internal::ErrnoSetterMatcher<RetT> Fails(int ExpectedErrno,
 } // namespace testing
 } // namespace __llvm_libc
 
-#endif // LLVM_LIBC_UTILS_UNITTEST_ERRNOSETTERMATCHER_H
+#endif // LLVM_LIBC_TEST_ERRNOSETTERMATCHER_H

diff  --git a/libc/test/src/signal/CMakeLists.txt b/libc/test/src/signal/CMakeLists.txt
index b5c1281b8102..c5baaf7d9d55 100644
--- a/libc/test/src/signal/CMakeLists.txt
+++ b/libc/test/src/signal/CMakeLists.txt
@@ -22,6 +22,7 @@ add_libc_unittest(
     libc.include.signal
     libc.src.signal.raise
     libc.src.signal.sigaction
+    libc.test.errno_setter_matcher
 )
 
 add_libc_unittest(
@@ -37,6 +38,7 @@ add_libc_unittest(
     libc.src.signal.sigaddset
     libc.src.signal.sigemptyset
     libc.src.signal.sigprocmask
+    libc.test.errno_setter_matcher
 )
 
 add_libc_unittest(
@@ -49,6 +51,7 @@ add_libc_unittest(
     libc.include.errno
     libc.include.signal
     libc.src.signal.sigaddset
+    libc.test.errno_setter_matcher
 )
 
 add_libc_unittest(
@@ -63,6 +66,7 @@ add_libc_unittest(
     libc.src.errno.__errno_location
     libc.src.signal.raise
     libc.src.signal.signal
+    libc.test.errno_setter_matcher
 )
 
 add_libc_unittest(
@@ -77,6 +81,7 @@ add_libc_unittest(
     libc.src.signal.raise
     libc.src.signal.sigfillset
     libc.src.signal.sigprocmask
+    libc.test.errno_setter_matcher
 )
 
 add_libc_unittest(
@@ -92,4 +97,5 @@ add_libc_unittest(
     libc.src.signal.sigdelset
     libc.src.signal.sigfillset
     libc.src.signal.sigprocmask
+    libc.test.errno_setter_matcher
 )

diff  --git a/libc/test/src/signal/sigaction_test.cpp b/libc/test/src/signal/sigaction_test.cpp
index 726d76b3795d..a473b646072f 100644
--- a/libc/test/src/signal/sigaction_test.cpp
+++ b/libc/test/src/signal/sigaction_test.cpp
@@ -12,7 +12,7 @@
 #include "src/signal/raise.h"
 #include "src/signal/sigaction.h"
 
-#include "utils/UnitTest/ErrnoSetterMatcher.h"
+#include "test/ErrnoSetterMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 using __llvm_libc::testing::ErrnoSetterMatcher::Fails;

diff  --git a/libc/test/src/signal/sigaddset_test.cpp b/libc/test/src/signal/sigaddset_test.cpp
index f106edb57f90..922110b397b6 100644
--- a/libc/test/src/signal/sigaddset_test.cpp
+++ b/libc/test/src/signal/sigaddset_test.cpp
@@ -10,7 +10,7 @@
 #include "include/signal.h"
 #include "src/signal/sigaddset.h"
 
-#include "utils/UnitTest/ErrnoSetterMatcher.h"
+#include "test/ErrnoSetterMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 // This tests invalid inputs and ensures errno is properly set.

diff  --git a/libc/test/src/signal/sigdelset_test.cpp b/libc/test/src/signal/sigdelset_test.cpp
index 48e0e6f3f5c4..42ba9335e219 100644
--- a/libc/test/src/signal/sigdelset_test.cpp
+++ b/libc/test/src/signal/sigdelset_test.cpp
@@ -13,7 +13,7 @@
 #include "src/signal/sigfillset.h"
 #include "src/signal/sigprocmask.h"
 
-#include "utils/UnitTest/ErrnoSetterMatcher.h"
+#include "test/ErrnoSetterMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 TEST(Sigdelset, Invalid) {

diff  --git a/libc/test/src/signal/sigfillset_test.cpp b/libc/test/src/signal/sigfillset_test.cpp
index c21bf137d283..16f87e641fbe 100644
--- a/libc/test/src/signal/sigfillset_test.cpp
+++ b/libc/test/src/signal/sigfillset_test.cpp
@@ -12,7 +12,7 @@
 #include "src/signal/sigfillset.h"
 #include "src/signal/sigprocmask.h"
 
-#include "utils/UnitTest/ErrnoSetterMatcher.h"
+#include "test/ErrnoSetterMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 TEST(Sigfillset, Invalid) {

diff  --git a/libc/test/src/signal/signal_test.cpp b/libc/test/src/signal/signal_test.cpp
index 8db26e91d670..03bf22a5f3eb 100644
--- a/libc/test/src/signal/signal_test.cpp
+++ b/libc/test/src/signal/signal_test.cpp
@@ -12,7 +12,7 @@
 #include "src/signal/raise.h"
 #include "src/signal/signal.h"
 
-#include "utils/UnitTest/ErrnoSetterMatcher.h"
+#include "test/ErrnoSetterMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 using __llvm_libc::testing::ErrnoSetterMatcher::Fails;

diff  --git a/libc/test/src/signal/sigprocmask_test.cpp b/libc/test/src/signal/sigprocmask_test.cpp
index 824415b7267c..90b57e9e0f2f 100644
--- a/libc/test/src/signal/sigprocmask_test.cpp
+++ b/libc/test/src/signal/sigprocmask_test.cpp
@@ -14,7 +14,7 @@
 #include "src/signal/sigemptyset.h"
 #include "src/signal/sigprocmask.h"
 
-#include "utils/UnitTest/ErrnoSetterMatcher.h"
+#include "test/ErrnoSetterMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 class SignalTest : public __llvm_libc::testing::Test {

diff  --git a/libc/test/src/sys/mman/linux/CMakeLists.txt b/libc/test/src/sys/mman/linux/CMakeLists.txt
index 3c53e4b60107..c7d3dde7d975 100644
--- a/libc/test/src/sys/mman/linux/CMakeLists.txt
+++ b/libc/test/src/sys/mman/linux/CMakeLists.txt
@@ -12,4 +12,5 @@ add_libc_unittest(
     libc.src.errno.__errno_location
     libc.src.sys.mman.mmap
     libc.src.sys.mman.munmap
+    libc.test.errno_setter_matcher
 )

diff  --git a/libc/test/src/sys/mman/linux/mmap_test.cpp b/libc/test/src/sys/mman/linux/mmap_test.cpp
index 38478c77b18b..8f91c2b548e0 100644
--- a/libc/test/src/sys/mman/linux/mmap_test.cpp
+++ b/libc/test/src/sys/mman/linux/mmap_test.cpp
@@ -11,7 +11,7 @@
 #include "src/errno/llvmlibc_errno.h"
 #include "src/sys/mman/mmap.h"
 #include "src/sys/mman/munmap.h"
-#include "utils/UnitTest/ErrnoSetterMatcher.h"
+#include "test/ErrnoSetterMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 using __llvm_libc::testing::ErrnoSetterMatcher::Fails;

diff  --git a/libc/test/src/unistd/CMakeLists.txt b/libc/test/src/unistd/CMakeLists.txt
index 5eae9c8b478c..54e513504b3b 100644
--- a/libc/test/src/unistd/CMakeLists.txt
+++ b/libc/test/src/unistd/CMakeLists.txt
@@ -7,7 +7,8 @@ add_libc_unittest(
   SRCS
     write_test.cpp
   DEPENDS
-    libc.src.unistd.write
     libc.include.errno
     libc.include.unistd
+    libc.src.unistd.write
+    libc.test.errno_setter_matcher
 )

diff  --git a/libc/test/src/unistd/write_test.cpp b/libc/test/src/unistd/write_test.cpp
index 2a91ef6fc277..a2c4cfca05c7 100644
--- a/libc/test/src/unistd/write_test.cpp
+++ b/libc/test/src/unistd/write_test.cpp
@@ -8,7 +8,7 @@
 
 #include "include/errno.h"
 #include "src/unistd/write.h"
-#include "utils/UnitTest/ErrnoSetterMatcher.h"
+#include "test/ErrnoSetterMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include "utils/testutils/FDReader.h"
 

diff  --git a/libc/utils/UnitTest/CMakeLists.txt b/libc/utils/UnitTest/CMakeLists.txt
index 0837f3d8895f..9c7b48aea4f9 100644
--- a/libc/utils/UnitTest/CMakeLists.txt
+++ b/libc/utils/UnitTest/CMakeLists.txt
@@ -2,7 +2,6 @@ add_llvm_library(
   LibcUnitTest
   Test.cpp
   Test.h
-  ErrnoSetterMatcher.h
   LINK_COMPONENTS Support
 )
 target_include_directories(LibcUnitTest PUBLIC ${LIBC_SOURCE_DIR})


        


More information about the libc-commits mailing list