All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH vz10] selftests: connector: make proc_filter terminate on its own
Date: Tue,  1 Sep 2026 03:40:02 +0300	[thread overview]
Message-ID: <20260901004003.1654339-1-eva.kurchatova@virtuozzo.com> (raw)

proc_filter listens for process events until a signal interrupts it,
so a caller that waits for it to finish waits forever. Generate one
event, stop after five seconds, and fail if nothing was received.

https://virtuozzo.atlassian.net/browse/VSTOR-142450
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 tools/testing/selftests/connector/proc_filter.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/connector/proc_filter.c b/tools/testing/selftests/connector/proc_filter.c
index 4a825b997666..f269b0b67db6 100644
--- a/tools/testing/selftests/connector/proc_filter.c
+++ b/tools/testing/selftests/connector/proc_filter.c
@@ -14,6 +14,7 @@
 #include <strings.h>
 #include <errno.h>
 #include <signal.h>
+#include <sys/wait.h>
 #include <string.h>
 
 #include "../kselftest.h"
@@ -279,6 +280,16 @@ int main(int argc, char *argv[])
 		exit(1);
 	}
 
+	/*
+	 * Generate one event to observe and stop listening shortly after,
+	 * so that the test terminates on its own.
+	 */
+	signal(SIGALRM, sigint);
+	alarm(5);
+	if (fork() == 0)
+		_exit(0);
+	wait(NULL);
+
 	while (!interrupted) {
 		err = handle_events(epoll_fd, &proc_ev);
 		if (err < 0) {
@@ -306,5 +317,5 @@ int main(int argc, char *argv[])
 	close(nl_sock);
 
 	printf("Done total count: %d\n", tcount);
-	exit(0);
+	exit(tcount > 0 ? KSFT_PASS : KSFT_FAIL);
 }
-- 
2.55.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

             reply	other threads:[~2026-09-01  0:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  0:40 Eva Kurchatova [this message]
2026-09-02 13:46 ` Konstantin Khorenko

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=20260901004003.1654339-1-eva.kurchatova@virtuozzo.com \
    --to=eva.kurchatova@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.