public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v4] Add epoll_wait05 test
Date: Tue, 29 Aug 2023 12:41:22 +0200	[thread overview]
Message-ID: <ZO3LUpPOJs1Qn0H7@rei> (raw)
In-Reply-To: <1717e228-1556-4ba0-8f91-4cb7160c3908@suse.com>

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      parent reply	other threads:[~2023-08-29 10:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23 13:09 [LTP] [PATCH v4] Add epoll_wait05 test Andrea Cervesato
2023-08-29  7:25 ` Cyril Hrubis
2023-08-29  7:52   ` Andrea Cervesato via ltp
2023-08-29 10:07     ` Cyril Hrubis
2023-08-29 10:41     ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZO3LUpPOJs1Qn0H7@rei \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox