1 //===-- Unittests for epoll_create1 ---------------------------------------===// 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/sys_epoll_macros.h" 9 #include "src/errno/libc_errno.h" 10 #include "src/sys/epoll/epoll_create1.h" 11 #include "src/unistd/close.h" 12 #include "test/UnitTest/ErrnoSetterMatcher.h" 13 #include "test/UnitTest/Test.h" 14 15 using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher; 16 TEST(LlvmLibcEpollCreate1Test,Basic)17TEST(LlvmLibcEpollCreate1Test, Basic) { 18 int fd = LIBC_NAMESPACE::epoll_create1(0); 19 ASSERT_GT(fd, 0); 20 ASSERT_ERRNO_SUCCESS(); 21 22 ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds()); 23 } 24 TEST(LlvmLibcEpollCreate1Test,CloseOnExecute)25TEST(LlvmLibcEpollCreate1Test, CloseOnExecute) { 26 int fd = LIBC_NAMESPACE::epoll_create1(EPOLL_CLOEXEC); 27 ASSERT_GT(fd, 0); 28 ASSERT_ERRNO_SUCCESS(); 29 30 ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds()); 31 } 32