Skip to content

Conversation

@mikhailramalho
Copy link
Member

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.

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.
@llvmbot
Copy link
Member

llvmbot commented Jul 20, 2024

@llvm/pr-subscribers-libc

Author: Mikhail R. Gadelha (mikhailramalho)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/99785.diff

1 Files Affected:

  • (modified) libc/test/src/sys/epoll/linux/epoll_create_test.cpp (+3)
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

@mikhailramalho mikhailramalho merged commit ae2012d into llvm:main Jul 20, 2024
@mikhailramalho mikhailramalho deleted the fix-epoll-create-test branch July 20, 2024 22:30
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
…internally (#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.
mikhailramalho added a commit to mikhailramalho/llvm-project that referenced this pull request Jul 20, 2025
In PR llvm#99785 I disabled a epoll_create test that should fail for systems
where only epoll_create1 was available, because epoll_create1 couldn't
fail the same way epoll_create did.

Calling epoll_create(0) should fail with an EINVAL error, so when only
epoll_create1 is available, we should just check if the arg is zero and
return the error accordingly.
mikhailramalho added a commit that referenced this pull request Jul 20, 2025
…#149713)

In PR #99785, I disabled a test for `epoll_create` that was intended to
fail on systems where only `epoll_create1` is available. This is because
`epoll_create1` cannot fail in the same way that `epoll_create` does.

Specifically, calling `epoll_create(0)` should result in an EINVAL
error. So, when only `epoll_create1` is available, we should simply
check if the argument is zero and return the error accordingly.
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jul 28, 2025
…llvm#149713)

In PR llvm#99785, I disabled a test for `epoll_create` that was intended to
fail on systems where only `epoll_create1` is available. This is because
`epoll_create1` cannot fail in the same way that `epoll_create` does.

Specifically, calling `epoll_create(0)` should result in an EINVAL
error. So, when only `epoll_create1` is available, we should simply
check if the argument is zero and return the error accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants