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