1*5fb82156SMichael Jones //===-- Unittests for epoll_create1 ---------------------------------------===// 2*5fb82156SMichael Jones // 3*5fb82156SMichael Jones // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*5fb82156SMichael Jones // See https://llvm.org/LICENSE.txt for license information. 5*5fb82156SMichael Jones // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*5fb82156SMichael Jones // 7*5fb82156SMichael Jones //===----------------------------------------------------------------------===// 8*5fb82156SMichael Jones #include "hdr/sys_epoll_macros.h" 9*5fb82156SMichael Jones #include "src/errno/libc_errno.h" 10*5fb82156SMichael Jones #include "src/sys/epoll/epoll_create1.h" 11*5fb82156SMichael Jones #include "src/unistd/close.h" 12*5fb82156SMichael Jones #include "test/UnitTest/ErrnoSetterMatcher.h" 13*5fb82156SMichael Jones #include "test/UnitTest/Test.h" 14*5fb82156SMichael Jones 15*5fb82156SMichael Jones using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher; 16*5fb82156SMichael Jones TEST(LlvmLibcEpollCreate1Test,Basic)17*5fb82156SMichael JonesTEST(LlvmLibcEpollCreate1Test, Basic) { 18*5fb82156SMichael Jones int fd = LIBC_NAMESPACE::epoll_create1(0); 19*5fb82156SMichael Jones ASSERT_GT(fd, 0); 20*5fb82156SMichael Jones ASSERT_ERRNO_SUCCESS(); 21*5fb82156SMichael Jones 22*5fb82156SMichael Jones ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds()); 23*5fb82156SMichael Jones } 24*5fb82156SMichael Jones TEST(LlvmLibcEpollCreate1Test,CloseOnExecute)25*5fb82156SMichael JonesTEST(LlvmLibcEpollCreate1Test, CloseOnExecute) { 26*5fb82156SMichael Jones int fd = LIBC_NAMESPACE::epoll_create1(EPOLL_CLOEXEC); 27*5fb82156SMichael Jones ASSERT_GT(fd, 0); 28*5fb82156SMichael Jones ASSERT_ERRNO_SUCCESS(); 29*5fb82156SMichael Jones 30*5fb82156SMichael Jones ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds()); 31*5fb82156SMichael Jones } 32