diff options
| author | Nick Desaulniers <nickdesaulniers@users.noreply.github.com> | 2023-12-13 09:55:29 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-13 09:55:29 -0800 |
| commit | c0ad6e2fa6353d06aa62b4874f48d5ba2159de56 (patch) | |
| tree | d2d3c83e6500c2f41752f7ece960ff00f773e9bd /libc | |
| parent | 2c5fe1486c36203e78daee6be571145a5d6084e2 (diff) | |
[libc] fix unit tests (#75361)
Fixes #75261
Diffstat (limited to 'libc')
| -rw-r--r-- | libc/test/src/fcntl/creat_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp | 1 | ||||
| -rw-r--r-- | libc/test/src/unistd/access_test.cpp | 1 | ||||
| -rw-r--r-- | libc/test/src/unistd/dup2_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/unistd/dup3_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/unistd/dup_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/unistd/ftruncate_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/unistd/isatty_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/unistd/link_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/unistd/linkat_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/unistd/pread_pwrite_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/unistd/read_write_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/unistd/symlink_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/unistd/symlinkat_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/unistd/syscall_test.cpp | 1 | ||||
| -rw-r--r-- | libc/test/src/unistd/truncate_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/unistd/unlink_test.cpp | 2 | ||||
| -rw-r--r-- | libc/test/src/unistd/unlinkat_test.cpp | 2 |
18 files changed, 33 insertions, 0 deletions
diff --git a/libc/test/src/fcntl/creat_test.cpp b/libc/test/src/fcntl/creat_test.cpp index ca926b30e62f..ef30d8862c45 100644 --- a/libc/test/src/fcntl/creat_test.cpp +++ b/libc/test/src/fcntl/creat_test.cpp @@ -13,6 +13,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + TEST(LlvmLibcCreatTest, CreatAndOpen) { using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_FILE = "testdata/creat.test"; diff --git a/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp b/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp index 7e6bb0aaca92..0870deeeb5d8 100644 --- a/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp +++ b/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp @@ -17,6 +17,7 @@ #include "test/UnitTest/Test.h" #include <sys/resource.h> +#include <sys/stat.h> TEST(LlvmLibcResourceLimitsTest, SetNoFileLimit) { using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; diff --git a/libc/test/src/unistd/access_test.cpp b/libc/test/src/unistd/access_test.cpp index ed1fe96f4f4a..7d4b3be443fe 100644 --- a/libc/test/src/unistd/access_test.cpp +++ b/libc/test/src/unistd/access_test.cpp @@ -14,6 +14,7 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> #include <unistd.h> TEST(LlvmLibcAccessTest, CreateAndTest) { diff --git a/libc/test/src/unistd/dup2_test.cpp b/libc/test/src/unistd/dup2_test.cpp index ff870db0334c..d46c4b919ce7 100644 --- a/libc/test/src/unistd/dup2_test.cpp +++ b/libc/test/src/unistd/dup2_test.cpp @@ -16,6 +16,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + TEST(LlvmLibcdupTest, ReadAndWriteViaDup) { constexpr int DUPFD = 0xD0; libc_errno = 0; diff --git a/libc/test/src/unistd/dup3_test.cpp b/libc/test/src/unistd/dup3_test.cpp index 279cfbfea1b1..d2d544d5d9a1 100644 --- a/libc/test/src/unistd/dup3_test.cpp +++ b/libc/test/src/unistd/dup3_test.cpp @@ -16,6 +16,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + // The tests here are exactly the same as those of dup2. We only test the // plumbing of the dup3 syscall and not the dup3 functionality itself as it is // a simple syscall wrapper. Testing dup3 functionality is beyond the scope of diff --git a/libc/test/src/unistd/dup_test.cpp b/libc/test/src/unistd/dup_test.cpp index 38c439125db3..856b004fbe65 100644 --- a/libc/test/src/unistd/dup_test.cpp +++ b/libc/test/src/unistd/dup_test.cpp @@ -16,6 +16,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + TEST(LlvmLibcdupTest, ReadAndWriteViaDup) { libc_errno = 0; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; diff --git a/libc/test/src/unistd/ftruncate_test.cpp b/libc/test/src/unistd/ftruncate_test.cpp index ae743b385e22..fc68348e32ec 100644 --- a/libc/test/src/unistd/ftruncate_test.cpp +++ b/libc/test/src/unistd/ftruncate_test.cpp @@ -17,6 +17,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + namespace cpp = LIBC_NAMESPACE::cpp; TEST(LlvmLibcFtruncateTest, CreateAndTruncate) { diff --git a/libc/test/src/unistd/isatty_test.cpp b/libc/test/src/unistd/isatty_test.cpp index fce4a3e5f506..7bf8dd708bfa 100644 --- a/libc/test/src/unistd/isatty_test.cpp +++ b/libc/test/src/unistd/isatty_test.cpp @@ -13,6 +13,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; diff --git a/libc/test/src/unistd/link_test.cpp b/libc/test/src/unistd/link_test.cpp index b1b9383cb62e..2d5aa7588b08 100644 --- a/libc/test/src/unistd/link_test.cpp +++ b/libc/test/src/unistd/link_test.cpp @@ -14,6 +14,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + TEST(LlvmLibcLinkTest, CreateAndUnlink) { using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_FILE = "testdata/link.test"; diff --git a/libc/test/src/unistd/linkat_test.cpp b/libc/test/src/unistd/linkat_test.cpp index 2ef41cd4e75f..d1ffe37d63b4 100644 --- a/libc/test/src/unistd/linkat_test.cpp +++ b/libc/test/src/unistd/linkat_test.cpp @@ -14,6 +14,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + TEST(LlvmLibcLinkatTest, CreateAndUnlink) { using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_DIR = "testdata"; diff --git a/libc/test/src/unistd/pread_pwrite_test.cpp b/libc/test/src/unistd/pread_pwrite_test.cpp index 6819f559424f..f90d1341c201 100644 --- a/libc/test/src/unistd/pread_pwrite_test.cpp +++ b/libc/test/src/unistd/pread_pwrite_test.cpp @@ -17,6 +17,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + TEST(LlvmLibcUniStd, PWriteAndPReadBackTest) { // The strategy here is that we first create a file and write to it. Next, // we open that file again and write at an offset. Finally, we open the diff --git a/libc/test/src/unistd/read_write_test.cpp b/libc/test/src/unistd/read_write_test.cpp index 20b51bb8082b..3007d4c38711 100644 --- a/libc/test/src/unistd/read_write_test.cpp +++ b/libc/test/src/unistd/read_write_test.cpp @@ -15,6 +15,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + TEST(LlvmLibcUniStd, WriteAndReadBackTest) { using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_FILE = "__unistd_read_write.test"; diff --git a/libc/test/src/unistd/symlink_test.cpp b/libc/test/src/unistd/symlink_test.cpp index 84d963b7a207..b25cfa4f8576 100644 --- a/libc/test/src/unistd/symlink_test.cpp +++ b/libc/test/src/unistd/symlink_test.cpp @@ -14,6 +14,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + TEST(LlvmLibcSymlinkTest, CreateAndUnlink) { using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_FILE_BASE = "symlink.test"; diff --git a/libc/test/src/unistd/symlinkat_test.cpp b/libc/test/src/unistd/symlinkat_test.cpp index b0308787f205..8aba2daee8cf 100644 --- a/libc/test/src/unistd/symlinkat_test.cpp +++ b/libc/test/src/unistd/symlinkat_test.cpp @@ -14,6 +14,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + TEST(LlvmLibcSymlinkatTest, CreateAndUnlink) { using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_DIR = "testdata"; diff --git a/libc/test/src/unistd/syscall_test.cpp b/libc/test/src/unistd/syscall_test.cpp index 211b27c3188c..6a5ca47f8d49 100644 --- a/libc/test/src/unistd/syscall_test.cpp +++ b/libc/test/src/unistd/syscall_test.cpp @@ -12,6 +12,7 @@ #include "test/UnitTest/Test.h" #include <fcntl.h> +#include <sys/stat.h> // For S_* flags. #include <sys/syscall.h> // For syscall numbers. #include <unistd.h> diff --git a/libc/test/src/unistd/truncate_test.cpp b/libc/test/src/unistd/truncate_test.cpp index 15940321e5ad..6d8a3b8e53f7 100644 --- a/libc/test/src/unistd/truncate_test.cpp +++ b/libc/test/src/unistd/truncate_test.cpp @@ -17,6 +17,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + namespace cpp = LIBC_NAMESPACE::cpp; TEST(LlvmLibcTruncateTest, CreateAndTruncate) { diff --git a/libc/test/src/unistd/unlink_test.cpp b/libc/test/src/unistd/unlink_test.cpp index 8a64f88ee6f2..77f65b5ecc6a 100644 --- a/libc/test/src/unistd/unlink_test.cpp +++ b/libc/test/src/unistd/unlink_test.cpp @@ -13,6 +13,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + TEST(LlvmLibcUnlinkTest, CreateAndUnlink) { using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_FILE = "testdata/unlink.test"; diff --git a/libc/test/src/unistd/unlinkat_test.cpp b/libc/test/src/unistd/unlinkat_test.cpp index 5953085bf12b..22a20bc6ad07 100644 --- a/libc/test/src/unistd/unlinkat_test.cpp +++ b/libc/test/src/unistd/unlinkat_test.cpp @@ -14,6 +14,8 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" +#include <sys/stat.h> + TEST(LlvmLibcUnlinkatTest, CreateAndDeleteTest) { using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_DIR = "testdata"; |
