[LTP] [PATCH v4] Add epoll_wait05 test
Cyril Hrubis
chrubis@suse.cz
Tue Aug 29 12:41:22 CEST 2023
Hi!
> 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:
diff --git a/testcases/kernel/mce-test b/testcases/kernel/mce-test
index 95e136a3b..0b4e77570 160000
--- a/testcases/kernel/mce-test
+++ b/testcases/kernel/mce-test
@@ -1 +1 @@
-Subproject commit 95e136a3b0cde818448d5fcff5bf75d58600dc0d
+Subproject commit 0b4e7757068381139db1317c07bdb7532196ef76
diff --git a/testcases/kernel/syscalls/epoll_wait/epoll_wait05.c b/testcases/kernel/syscalls/epoll_wait/epoll_wait05.c
index a055a5885..d06a024ff 100644
--- a/testcases/kernel/syscalls/epoll_wait/epoll_wait05.c
+++ b/testcases/kernel/syscalls/epoll_wait/epoll_wait05.c
@@ -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"},
- {},
- }
};
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list