[libc-commits] [libc] [libc] Implement faccessat (PR #161065)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Tue Sep 30 10:26:55 PDT 2025
================
@@ -0,0 +1,172 @@
+//===-- Unittests for faccessat -------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/__support/CPP/string.h"
+#include "src/fcntl/open.h"
+#include "src/sys/stat/mkdir.h"
+#include "src/unistd/close.h"
+#include "src/unistd/faccessat.h"
+#include "src/unistd/rmdir.h"
+#include "src/unistd/symlink.h"
+#include "src/unistd/unlink.h"
+#include "src/unistd/unlinkat.h"
+#include "test/UnitTest/ErrnoCheckingTest.h"
+#include "test/UnitTest/ErrnoSetterMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+namespace {
+
+namespace cpp = LIBC_NAMESPACE::cpp;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
+
+using LlvmLibcFaccessatTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
+
+TEST_F(LlvmLibcFaccessatTest, WithAtFdcwd) {
----------------
michaelrj-google wrote:
since this is just a syscall wrapper it doesn't actually need to be very thorough. We're testing our implementation not the kernel, so it just needs one test that succeeds and one test that fails to check both of our branches.
https://github.com/llvm/llvm-project/pull/161065
More information about the libc-commits
mailing list