Author: Mikhail R. Gadelha Date: 2024-07-05T15:30:24-03:00 New Revision: 07b53c66ac726d979d2640b7882082d6e053ccab
URL: https://github.com/llvm/llvm-project/commit/07b53c66ac726d979d2640b7882082d6e053ccab DIFF: https://github.com/llvm/llvm-project/commit/07b53c66ac726d979d2640b7882082d6e053ccab.diff LOG: Revert "[libc] Fix readlink tests on 32-bit systems (#97850)" This reverts commit 0f1da49b4d854ce7c6572000da3fb6cb0a1245d2. Added: Modified: libc/test/src/unistd/CMakeLists.txt libc/test/src/unistd/readlink_test.cpp libc/test/src/unistd/readlinkat_test.cpp Removed: ################################################################################ diff --git a/libc/test/src/unistd/CMakeLists.txt b/libc/test/src/unistd/CMakeLists.txt index f4f78b800987d..de3e8d9ccbb62 100644 --- a/libc/test/src/unistd/CMakeLists.txt +++ b/libc/test/src/unistd/CMakeLists.txt @@ -262,7 +262,6 @@ add_libc_unittest( libc.include.unistd libc.src.errno.errno libc.src.unistd.readlink - libc.src.string.string_utils libc.src.unistd.symlink libc.src.unistd.unlink libc.src.__support.CPP.string_view @@ -279,7 +278,6 @@ add_libc_unittest( libc.include.fcntl libc.include.unistd libc.src.errno.errno - libc.src.string.string_utils libc.src.unistd.readlinkat libc.src.unistd.symlink libc.src.unistd.unlink diff --git a/libc/test/src/unistd/readlink_test.cpp b/libc/test/src/unistd/readlink_test.cpp index 0760850d9bae1..20f3951349118 100644 --- a/libc/test/src/unistd/readlink_test.cpp +++ b/libc/test/src/unistd/readlink_test.cpp @@ -9,7 +9,6 @@ #include "src/__support/CPP/string_view.h" #include "src/errno/libc_errno.h" #include "src/unistd/readlink.h" -#include "src/string/string_utils.h" #include "src/unistd/symlink.h" #include "src/unistd/unlink.h" #include "test/UnitTest/ErrnoSetterMatcher.h" @@ -31,9 +30,8 @@ TEST(LlvmLibcReadlinkTest, CreateAndUnlink) { // 3. Cleanup the symlink created in step #1. ASSERT_THAT(LIBC_NAMESPACE::symlink(LINK_VAL, LINK), Succeeds(0)); - char buf[sizeof(FILENAME)]; - ssize_t len = LIBC_NAMESPACE::readlink( - LINK, buf, LIBC_NAMESPACE::internal::string_length(FILENAME)); + char buf[sizeof(LINK_VAL)]; + ssize_t len = LIBC_NAMESPACE::readlink(LINK, buf, sizeof(buf)); ASSERT_ERRNO_SUCCESS(); ASSERT_EQ(cpp::string_view(buf, len), cpp::string_view(LINK_VAL)); @@ -42,8 +40,7 @@ TEST(LlvmLibcReadlinkTest, CreateAndUnlink) { TEST(LlvmLibcReadlinkTest, ReadlinkInNonExistentPath) { using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; - constexpr auto len = 8; - char buf[len]; - ASSERT_THAT(LIBC_NAMESPACE::readlink("non-existent-link", buf, len), + char buf[8]; + ASSERT_THAT(LIBC_NAMESPACE::readlink("non-existent-link", buf, sizeof(buf)), Fails(ENOENT)); } diff --git a/libc/test/src/unistd/readlinkat_test.cpp b/libc/test/src/unistd/readlinkat_test.cpp index 61e87731c9b9d..39d81d9ba544a 100644 --- a/libc/test/src/unistd/readlinkat_test.cpp +++ b/libc/test/src/unistd/readlinkat_test.cpp @@ -9,7 +9,6 @@ #include "src/__support/CPP/string_view.h" #include "src/errno/libc_errno.h" #include "src/unistd/readlinkat.h" -#include "src/string/string_utils.h" #include "src/unistd/symlink.h" #include "src/unistd/unlink.h" #include "test/UnitTest/ErrnoSetterMatcher.h" @@ -33,9 +32,8 @@ TEST(LlvmLibcReadlinkatTest, CreateAndUnlink) { // 3. Cleanup the symlink created in step #1. ASSERT_THAT(LIBC_NAMESPACE::symlink(LINK_VAL, LINK), Succeeds(0)); - char buf[sizeof(FILENAME)]; - ssize_t len = LIBC_NAMESPACE::readlinkat( - AT_FDCWD, LINK, buf, LIBC_NAMESPACE::internal::string_length(FILENAME)); + char buf[sizeof(LINK_VAL)]; + ssize_t len = LIBC_NAMESPACE::readlinkat(AT_FDCWD, LINK, buf, sizeof(buf)); ASSERT_ERRNO_SUCCESS(); ASSERT_EQ(cpp::string_view(buf, len), cpp::string_view(LINK_VAL)); @@ -44,9 +42,8 @@ TEST(LlvmLibcReadlinkatTest, CreateAndUnlink) { TEST(LlvmLibcReadlinkatTest, ReadlinkInNonExistentPath) { using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; - constexpr auto len = 8; - char buf[len]; - ASSERT_THAT( - LIBC_NAMESPACE::readlinkat(AT_FDCWD, "non-existent-link", buf, len), - Fails(ENOENT)); + char buf[8]; + ASSERT_THAT(LIBC_NAMESPACE::readlinkat(AT_FDCWD, "non-existent-link", buf, + sizeof(buf)), + Fails(ENOENT)); } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits