[libc-commits] [libc] [libc] Disable epoll_create fail test when SYS_epoll_create1 is used internally (PR #99785)

Mikhail R. Gadelha via libc-commits libc-commits at lists.llvm.org
Sat Jul 20 14:40:46 PDT 2024


https://github.com/mikhailramalho created https://github.com/llvm/llvm-project/pull/99785

The fail test case only makes sense if SYS_epoll_create is used internally to implement epoll_create, since the only argument to epoll_create (size) is dropped if SYS_epoll_create1 is used.

>From 8a9911db079c1b6c0c98aa6d544359e971d041dd Mon Sep 17 00:00:00 2001
From: "Mikhail R. Gadelha" <mikhail at igalia.com>
Date: Sat, 20 Jul 2024 18:28:56 -0300
Subject: [PATCH] [libc] Fix epoll_create test when SYS_epoll_create1 is used
 internally

The fail test case only makes sense if SYS_epoll_create is used internally to
implement epoll_create, since the only argument to epoll_create (size)
is dropped if SYS_epoll_create1 is used.
---
 libc/test/src/sys/epoll/linux/epoll_create_test.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libc/test/src/sys/epoll/linux/epoll_create_test.cpp b/libc/test/src/sys/epoll/linux/epoll_create_test.cpp
index fdcdcf8eb4271..9c4bad10c8384 100644
--- a/libc/test/src/sys/epoll/linux/epoll_create_test.cpp
+++ b/libc/test/src/sys/epoll/linux/epoll_create_test.cpp
@@ -10,6 +10,7 @@
 #include "src/unistd/close.h"
 #include "test/UnitTest/ErrnoSetterMatcher.h"
 #include "test/UnitTest/Test.h"
+#include <sys/syscall.h> // For syscall numbers.
 
 using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;
 
@@ -21,6 +22,8 @@ TEST(LlvmLibcEpollCreateTest, Basic) {
   ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds());
 }
 
+#ifdef SYS_epoll_create
 TEST(LlvmLibcEpollCreateTest, Fails) {
   ASSERT_THAT(LIBC_NAMESPACE::epoll_create(0), Fails(EINVAL));
 }
+#endif



More information about the libc-commits mailing list