1 //===-- Unittests for pathconf --------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 #include "hdr/fcntl_macros.h" 9 #include "hdr/limits_macros.h" 10 #include "hdr/sys_stat_macros.h" 11 #include "hdr/unistd_macros.h" 12 #include "src/fcntl/open.h" 13 #include "src/unistd/close.h" 14 #include "src/unistd/pathconf.h" 15 #include "test/UnitTest/ErrnoSetterMatcher.h" 16 #include "test/UnitTest/Test.h" 17 18 using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher; 19 TEST(LlvmLibcPipeTest,SmokeTest)20TEST(LlvmLibcPipeTest, SmokeTest) { 21 constexpr const char *FILENAME = "pathconf.test"; 22 auto TEST_FILE = libc_make_test_file_path(FILENAME); 23 int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); 24 EXPECT_EQ(LIBC_NAMESPACE::pathconf(FILENAME, _PC_SYNC_IO), -1l); 25 EXPECT_EQ(LIBC_NAMESPACE::pathconf(FILENAME, _PC_PATH_MAX), 26 static_cast<long>(_POSIX_PATH_MAX)); 27 LIBC_NAMESPACE::close(fd); 28 } 29 30 // TODO: Functionality tests 31