summaryrefslogtreecommitdiff
path: root/libc/test/src/sys/sendfile
diff options
context:
space:
mode:
authorSiva Chandra Reddy <sivachandra@google.com>2023-03-13 23:43:31 +0000
committerSiva Chandra Reddy <sivachandra@google.com>2023-03-13 23:44:52 +0000
commitaf783db7fd3b01b4c7dc880d5df13f8d78f6cf92 (patch)
tree7a434cf75bb5246b91ee06850576141326824883 /libc/test/src/sys/sendfile
parent2aaaed3527de891062e9503d09d42075049e05fa (diff)
[libc][NFC] Switch sys/*.h tests over to libc_errno.
Diffstat (limited to 'libc/test/src/sys/sendfile')
-rw-r--r--libc/test/src/sys/sendfile/sendfile_test.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/libc/test/src/sys/sendfile/sendfile_test.cpp b/libc/test/src/sys/sendfile/sendfile_test.cpp
index 95103aac7c10..c77965ea9640 100644
--- a/libc/test/src/sys/sendfile/sendfile_test.cpp
+++ b/libc/test/src/sys/sendfile/sendfile_test.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "src/__support/CPP/string_view.h"
+#include "src/errno/libc_errno.h"
#include "src/fcntl/open.h"
#include "src/sys/sendfile/sendfile.h"
#include "src/unistd/close.h"
@@ -17,7 +18,6 @@
#include "test/UnitTest/Test.h"
#include "utils/testutils/FDReader.h"
-#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
@@ -36,20 +36,20 @@ TEST(LlvmLibcSendfileTest, CreateAndTransfer) {
constexpr const char *OUT_FILE = "testdata/sendfile_out.test";
const char IN_DATA[] = "sendfile test";
constexpr ssize_t IN_SIZE = ssize_t(sizeof(IN_DATA));
- errno = 0;
+ libc_errno = 0;
int in_fd = __llvm_libc::open(IN_FILE, O_CREAT | O_WRONLY, S_IRWXU);
ASSERT_GT(in_fd, 0);
- ASSERT_EQ(errno, 0);
+ ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(__llvm_libc::write(in_fd, IN_DATA, IN_SIZE), IN_SIZE);
ASSERT_THAT(__llvm_libc::close(in_fd), Succeeds(0));
in_fd = __llvm_libc::open(IN_FILE, O_RDONLY);
ASSERT_GT(in_fd, 0);
- ASSERT_EQ(errno, 0);
+ ASSERT_EQ(libc_errno, 0);
int out_fd = __llvm_libc::open(OUT_FILE, O_CREAT | O_WRONLY, S_IRWXU);
ASSERT_GT(out_fd, 0);
- ASSERT_EQ(errno, 0);
+ ASSERT_EQ(libc_errno, 0);
ssize_t size = __llvm_libc::sendfile(in_fd, out_fd, nullptr, IN_SIZE);
ASSERT_EQ(size, IN_SIZE);
ASSERT_THAT(__llvm_libc::close(in_fd), Succeeds(0));
@@ -57,7 +57,7 @@ TEST(LlvmLibcSendfileTest, CreateAndTransfer) {
out_fd = __llvm_libc::open(OUT_FILE, O_RDONLY);
ASSERT_GT(out_fd, 0);
- ASSERT_EQ(errno, 0);
+ ASSERT_EQ(libc_errno, 0);
char buf[IN_SIZE];
ASSERT_EQ(IN_SIZE, __llvm_libc::read(out_fd, buf, IN_SIZE));
ASSERT_EQ(cpp::string_view(buf), cpp::string_view(IN_DATA));