Skip to content

Commit c0ad6e2

Browse files
[libc] fix unit tests (#75361)
Fixes #75261
1 parent 2c5fe14 commit c0ad6e2

18 files changed

+33
-0
lines changed

libc/test/src/fcntl/creat_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "test/UnitTest/ErrnoSetterMatcher.h"
1414
#include "test/UnitTest/Test.h"
1515

16+
#include <sys/stat.h>
17+
1618
TEST(LlvmLibcCreatTest, CreatAndOpen) {
1719
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
1820
constexpr const char *TEST_FILE = "testdata/creat.test";

libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "test/UnitTest/Test.h"
1818

1919
#include <sys/resource.h>
20+
#include <sys/stat.h>
2021

2122
TEST(LlvmLibcResourceLimitsTest, SetNoFileLimit) {
2223
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;

libc/test/src/unistd/access_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "test/UnitTest/ErrnoSetterMatcher.h"
1515
#include "test/UnitTest/Test.h"
1616

17+
#include <sys/stat.h>
1718
#include <unistd.h>
1819

1920
TEST(LlvmLibcAccessTest, CreateAndTest) {

libc/test/src/unistd/dup2_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include "test/UnitTest/ErrnoSetterMatcher.h"
1717
#include "test/UnitTest/Test.h"
1818

19+
#include <sys/stat.h>
20+
1921
TEST(LlvmLibcdupTest, ReadAndWriteViaDup) {
2022
constexpr int DUPFD = 0xD0;
2123
libc_errno = 0;

libc/test/src/unistd/dup3_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include "test/UnitTest/ErrnoSetterMatcher.h"
1717
#include "test/UnitTest/Test.h"
1818

19+
#include <sys/stat.h>
20+
1921
// The tests here are exactly the same as those of dup2. We only test the
2022
// plumbing of the dup3 syscall and not the dup3 functionality itself as it is
2123
// a simple syscall wrapper. Testing dup3 functionality is beyond the scope of

libc/test/src/unistd/dup_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include "test/UnitTest/ErrnoSetterMatcher.h"
1717
#include "test/UnitTest/Test.h"
1818

19+
#include <sys/stat.h>
20+
1921
TEST(LlvmLibcdupTest, ReadAndWriteViaDup) {
2022
libc_errno = 0;
2123
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;

libc/test/src/unistd/ftruncate_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "test/UnitTest/ErrnoSetterMatcher.h"
1818
#include "test/UnitTest/Test.h"
1919

20+
#include <sys/stat.h>
21+
2022
namespace cpp = LIBC_NAMESPACE::cpp;
2123

2224
TEST(LlvmLibcFtruncateTest, CreateAndTruncate) {

libc/test/src/unistd/isatty_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "test/UnitTest/ErrnoSetterMatcher.h"
1414
#include "test/UnitTest/Test.h"
1515

16+
#include <sys/stat.h>
17+
1618
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
1719
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
1820

libc/test/src/unistd/link_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include "test/UnitTest/ErrnoSetterMatcher.h"
1515
#include "test/UnitTest/Test.h"
1616

17+
#include <sys/stat.h>
18+
1719
TEST(LlvmLibcLinkTest, CreateAndUnlink) {
1820
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
1921
constexpr const char *TEST_FILE = "testdata/link.test";

libc/test/src/unistd/linkat_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include "test/UnitTest/ErrnoSetterMatcher.h"
1515
#include "test/UnitTest/Test.h"
1616

17+
#include <sys/stat.h>
18+
1719
TEST(LlvmLibcLinkatTest, CreateAndUnlink) {
1820
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
1921
constexpr const char *TEST_DIR = "testdata";

libc/test/src/unistd/pread_pwrite_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "test/UnitTest/ErrnoSetterMatcher.h"
1818
#include "test/UnitTest/Test.h"
1919

20+
#include <sys/stat.h>
21+
2022
TEST(LlvmLibcUniStd, PWriteAndPReadBackTest) {
2123
// The strategy here is that we first create a file and write to it. Next,
2224
// we open that file again and write at an offset. Finally, we open the

libc/test/src/unistd/read_write_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include "test/UnitTest/ErrnoSetterMatcher.h"
1616
#include "test/UnitTest/Test.h"
1717

18+
#include <sys/stat.h>
19+
1820
TEST(LlvmLibcUniStd, WriteAndReadBackTest) {
1921
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
2022
constexpr const char *TEST_FILE = "__unistd_read_write.test";

libc/test/src/unistd/symlink_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include "test/UnitTest/ErrnoSetterMatcher.h"
1515
#include "test/UnitTest/Test.h"
1616

17+
#include <sys/stat.h>
18+
1719
TEST(LlvmLibcSymlinkTest, CreateAndUnlink) {
1820
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
1921
constexpr const char *TEST_FILE_BASE = "symlink.test";

libc/test/src/unistd/symlinkat_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include "test/UnitTest/ErrnoSetterMatcher.h"
1515
#include "test/UnitTest/Test.h"
1616

17+
#include <sys/stat.h>
18+
1719
TEST(LlvmLibcSymlinkatTest, CreateAndUnlink) {
1820
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
1921
constexpr const char *TEST_DIR = "testdata";

libc/test/src/unistd/syscall_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "test/UnitTest/Test.h"
1313

1414
#include <fcntl.h>
15+
#include <sys/stat.h> // For S_* flags.
1516
#include <sys/syscall.h> // For syscall numbers.
1617
#include <unistd.h>
1718

libc/test/src/unistd/truncate_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "test/UnitTest/ErrnoSetterMatcher.h"
1818
#include "test/UnitTest/Test.h"
1919

20+
#include <sys/stat.h>
21+
2022
namespace cpp = LIBC_NAMESPACE::cpp;
2123

2224
TEST(LlvmLibcTruncateTest, CreateAndTruncate) {

libc/test/src/unistd/unlink_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "test/UnitTest/ErrnoSetterMatcher.h"
1414
#include "test/UnitTest/Test.h"
1515

16+
#include <sys/stat.h>
17+
1618
TEST(LlvmLibcUnlinkTest, CreateAndUnlink) {
1719
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
1820
constexpr const char *TEST_FILE = "testdata/unlink.test";

libc/test/src/unistd/unlinkat_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include "test/UnitTest/ErrnoSetterMatcher.h"
1515
#include "test/UnitTest/Test.h"
1616

17+
#include <sys/stat.h>
18+
1719
TEST(LlvmLibcUnlinkatTest, CreateAndDeleteTest) {
1820
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
1921
constexpr const char *TEST_DIR = "testdata";

0 commit comments

Comments
 (0)