From acca2980a33e182dd6f4c71554ff2130f260463e Mon Sep 17 00:00:00 2001 From: Siva Chandra Reddy Date: Tue, 28 Jul 2020 10:57:00 -0700 Subject: [PATCH] [libc][obvious] Move ErrnoSetterMatcher to test/ErrnoSetterMetcher.h. --- libc/test/CMakeLists.txt | 6 ++++++ libc/{utils/UnitTest => test}/ErrnoSetterMatcher.h | 12 ++++-------- libc/test/src/signal/CMakeLists.txt | 6 ++++++ libc/test/src/signal/sigaction_test.cpp | 2 +- libc/test/src/signal/sigaddset_test.cpp | 2 +- libc/test/src/signal/sigdelset_test.cpp | 2 +- libc/test/src/signal/sigfillset_test.cpp | 2 +- libc/test/src/signal/signal_test.cpp | 2 +- libc/test/src/signal/sigprocmask_test.cpp | 2 +- libc/test/src/sys/mman/linux/CMakeLists.txt | 1 + libc/test/src/sys/mman/linux/mmap_test.cpp | 2 +- libc/test/src/unistd/CMakeLists.txt | 3 ++- libc/test/src/unistd/write_test.cpp | 2 +- libc/utils/UnitTest/CMakeLists.txt | 1 - 14 files changed, 27 insertions(+), 18 deletions(-) rename libc/{utils/UnitTest => test}/ErrnoSetterMatcher.h (84%) diff --git a/libc/test/CMakeLists.txt b/libc/test/CMakeLists.txt index 500b294..edce4bb 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 d676ee9..7f8311b 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 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 b5c1281..c5baaf7 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 726d76b..a473b64 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 f106edb..922110b 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 48e0e6f..42ba933 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 c21bf13..16f87e6 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 8db26e9..03bf22a 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 824415b..90b57e9 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 3c53e4b..c7d3dde 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 38478c7..8f91c2b 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 5eae9c8..54e5135 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 2a91ef6..a2c4cfc 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 0837f3d..9c7b48a 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}) -- 2.7.4