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

Marcell Leleszi via libc-commits libc-commits at lists.llvm.org
Tue Sep 30 11:09:48 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) {
----------------
mleleszi wrote:

I think these still test whether we are passing the correct params, whether we have the macros correctly defined, but I'm happy to remove these and just have simple ok and fail case if you think these are unnecessary

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


More information about the libc-commits mailing list