[libc-commits] [libc] [libc] Implement faccessat (PR #161065)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Tue Sep 30 15:53:04 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:

You don't need to remove everything, but definitely I'd recommend removing some of these tests. Specifically I'd recommend removing the symlink and directory tests, since if the test fails those might end up in an inconsistent state.

https://github.com/llvm/llvm-project/pull/161065


More information about the libc-commits mailing list