Add epoll_wait05 test
PATCH v4 1/1 Add epoll_wait05 test
From: Andrea Cervesato <[email protected]>
This test verifies that epoll receives EPOLLRDHUP event when we hang a reading half-socket we are polling on.
Implements: https://github.com/linux-test-project/ltp/issues/860
--- runtest/syscalls | 1 + .../kernel/syscalls/epoll_wait/.gitignore | 1 + .../kernel/syscalls/epoll_wait/epoll_wait05.c | 126 ++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 testcases/kernel/syscalls/epoll_wait/epoll_wait05.c
runtest/syscalls +1 -0
@@ -175,6 +175,7 @@ epoll_wait01 epoll_wait01 epoll_wait02 epoll_wait02 epoll_wait03 epoll_wait03 epoll_wait04 epoll_wait04 +epoll_wait05 epoll_wait05 epoll_pwait01 epoll_pwait01 epoll_pwait02 epoll_pwait02 epoll_pwait03 epoll_pwait03
testcases/kernel/syscalls/epoll_wait/.gitignore +1 -0
@@ -2,3 +2,4 @@ epoll_wait01 epoll_wait02 epoll_wait03 epoll_wait04 +epoll_wait05
testcases/kernel/syscalls/epoll_wait/epoll_wait05.c new file +126 -0
126 lines not on this page · raw message
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 5 lines
This test verifies that epoll receives EPOLLRDHUP event when we hang a reading half-socket we are polling on.
Implements: https://github.com/linux-test-project/ltp/issues/860
Signed-off-by Andrea Cervesato <[email protected]>
...
Quoted 7 lines
+/*\
+ * [Description]
+ *
+ * Verify that epoll receives EPOLLRDHUP event when we hang a reading
+ * half-socket we are polling on.
+ *
+ * As reference please check https://lwn.net/Articles/864947/
I'm a bit confused here, the test itself looks good, but it references an article and a kernel commit that changed how polling on _pipe_ works. The kernel change literally changes only pipe_write() in fs/pipe.c and this test actually tests inet sockets.
I guess that the confusion is caused by the fact that the github issue referenced the lwn.net article as a reason why we need more epoll coverage, but these tests are not directly related to that commit at all.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
Quoted 20 lines · Cyril Hrubis
Hi!
Quoted 5 lines
This test verifies that epoll receives EPOLLRDHUP event when we hang a reading half-socket we are polling on.
Implements: https://github.com/linux-test-project/ltp/issues/860
Signed-off-by Andrea Cervesato <[email protected]>...
Quoted 7 lines
+/*\
+ * [Description]
+ *
+ * Verify that epoll receives EPOLLRDHUP event when we hang a reading
+ * half-socket we are polling on.
+ *
+ * As reference please check https://lwn.net/Articles/864947/I'm a bit confused here, the test itself looks good, but it references an article and a kernel commit that changed how polling on _pipe_ works. The kernel change literally changes only
pipe_write()infs/pipe.cand this test actually tests inet sockets.
Quoted 5 lines
I guess that the confusion is caused by the fact that the github issue referenced the lwn.net article as a reason why we need more epoll coverage, but these tests are not directly related to that commit at all.
If patch is fine, is it possible to push it removing the reference?
Thanks,
Andrea
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 1 line
If patch is fine, is it possible to push it removing the reference?
Sure, will do.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 1 line
If patch is fine, is it possible to push it removing the reference?
Pushed with one minor change, thanks.
I've also added check that epoll_wait() returns 1 otherwise the content of the returned event is not valid.
Full diff:
testcases/kernel/mce-test +1 -1
@@ -1 +1 @@ -Subproject commit 95e136a3b0cde818448d5fcff5bf75d58600dc0d +Subproject commit 0b4e7757068381139db1317c07bdb7532196ef76
testcases/kernel/syscalls/epoll_wait/epoll_wait05.c +7 -7
@@ -8,8 +8,6 @@* * Verify that epoll receives EPOLLRDHUP event when we hang a reading * half-socket we are polling on. -* -* As reference please check https://lwn.net/Articles/864947/ */ #include "tst_test.h"
@@ -52,6 +50,7 @@ static void run(void)struct sockaddr_in client_addr;struct epoll_event evt_req;struct epoll_event evt_rec; +int ret;if (!SAFE_FORK ()) {create_server ();
@@ -79,13 +78,18 @@ static void run(void)tst_res (TINFO ,"Hang socket" );TST_EXP_PASS_SILENT (shutdown (sockfd_client,SHUT_RD )); -SAFE_EPOLL_WAIT (epfd, &evt_rec,1 ,2000 ); + ret =SAFE_EPOLL_WAIT (epfd, &evt_rec,1 ,2000 ); +if (ret !=1 ) { +tst_res (TFAIL ,"Wrong number of events reported %i" , ret); + goto exit; + }if (evt_rec.events &EPOLLRDHUP )tst_res (TPASS ,"Received EPOLLRDHUP" );else tst_res (TFAIL ,"EPOLLRDHUP has not been received" ); +exit:SAFE_CLOSE (epfd);SAFE_CLOSE (sockfd_client);
@@ -119,8 +123,4 @@ static struct tst_test test = { .test_all = run, .forks_child = 1, .needs_checkpoints = 1, - .tags = (const struct tst_tag []) { - {"linux-git" ,"3a34b13a88ca" }, - {}, - } };
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp