• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- Unittests for epoll_create ----------------------------------------===//
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 "src/errno/libc_errno.h"
9 #include "src/sys/epoll/epoll_create.h"
10 #include "src/unistd/close.h"
11 #include "test/UnitTest/ErrnoSetterMatcher.h"
12 #include "test/UnitTest/Test.h"
13 
14 using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;
15 
TEST(LlvmLibcEpollCreateTest,Basic)16 TEST(LlvmLibcEpollCreateTest, Basic) {
17   int fd = LIBC_NAMESPACE::epoll_create(1);
18   ASSERT_GT(fd, 0);
19   ASSERT_ERRNO_SUCCESS();
20 
21   ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds());
22 }
23 
TEST(LlvmLibcEpollCreateTest,Fails)24 TEST(LlvmLibcEpollCreateTest, Fails) {
25   ASSERT_THAT(LIBC_NAMESPACE::epoll_create(0), Fails(EINVAL));
26 }
27