summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Garzarella <sgarzare@redhat.com>2025-05-14 17:19:27 +0300
committerJakub Kicinski <kuba@kernel.org>2025-05-17 04:01:32 +0300
commit3c6abbe85bccd8efb5d9147a022b1d4012cb1809 (patch)
tree0ca72c6f0749fdf9076dc0b04825f975ce6f67ce
parent135a8a4d25a2937b2727e3857471f305d78496da (diff)
downloadlinux-3c6abbe85bccd8efb5d9147a022b1d4012cb1809.tar.xz
vsock/test: check also expected errno on sigpipe test
In the sigpipe test, we expect send() to fail, but we do not check if send() fails with the errno we expect (EPIPE). Add this check and repeat the send() in case of EINTR as we do in other tests. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://patch.msgid.link/20250514141927.159456-4-sgarzare@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--tools/testing/vsock/vsock_test.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c
index 920867b17965..9ea33b78b9fc 100644
--- a/tools/testing/vsock/vsock_test.c
+++ b/tools/testing/vsock/vsock_test.c
@@ -1075,7 +1075,7 @@ static void test_stream_check_sigpipe(int fd)
timeout_begin(TIMEOUT);
while(1) {
res = send(fd, "A", 1, 0);
- if (res == -1)
+ if (res == -1 && errno != EINTR)
break;
/* Sleep a little before trying again to avoid flooding the
@@ -1087,6 +1087,10 @@ static void test_stream_check_sigpipe(int fd)
}
timeout_end();
+ if (errno != EPIPE) {
+ fprintf(stderr, "unexpected send(2) errno %d\n", errno);
+ exit(EXIT_FAILURE);
+ }
if (!have_sigpipe) {
fprintf(stderr, "SIGPIPE expected\n");
exit(EXIT_FAILURE);
@@ -1097,7 +1101,7 @@ static void test_stream_check_sigpipe(int fd)
timeout_begin(TIMEOUT);
while(1) {
res = send(fd, "A", 1, MSG_NOSIGNAL);
- if (res == -1)
+ if (res == -1 && errno != EINTR)
break;
timeout_usleep(SEND_SLEEP_USEC);
@@ -1105,6 +1109,10 @@ static void test_stream_check_sigpipe(int fd)
}
timeout_end();
+ if (errno != EPIPE) {
+ fprintf(stderr, "unexpected send(2) errno %d\n", errno);
+ exit(EXIT_FAILURE);
+ }
if (have_sigpipe) {
fprintf(stderr, "SIGPIPE not expected\n");
exit(EXIT_FAILURE);