Skip to content

Commit 0e115c4

Browse files
Arseny Krasnovmstsirkin
authored andcommitted
vsock_test: update message bounds test for MSG_EOR
Set 'MSG_EOR' in one of message sent, check that 'MSG_EOR' is visible in corresponding message at receiver. Signed-off-by: Arseny Krasnov <[email protected]> Reviewed-by: Stefano Garzarella <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 8fc92b7 commit 0e115c4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/testing/vsock/vsock_test.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ static void test_stream_msg_peek_server(const struct test_opts *opts)
282282
}
283283

284284
#define MESSAGES_CNT 7
285+
#define MSG_EOR_IDX (MESSAGES_CNT / 2)
285286
static void test_seqpacket_msg_bounds_client(const struct test_opts *opts)
286287
{
287288
int fd;
@@ -294,7 +295,7 @@ static void test_seqpacket_msg_bounds_client(const struct test_opts *opts)
294295

295296
/* Send several messages, one with MSG_EOR flag */
296297
for (int i = 0; i < MESSAGES_CNT; i++)
297-
send_byte(fd, 1, 0);
298+
send_byte(fd, 1, (i == MSG_EOR_IDX) ? MSG_EOR : 0);
298299

299300
control_writeln("SENDDONE");
300301
close(fd);
@@ -324,6 +325,11 @@ static void test_seqpacket_msg_bounds_server(const struct test_opts *opts)
324325
perror("message bound violated");
325326
exit(EXIT_FAILURE);
326327
}
328+
329+
if ((i == MSG_EOR_IDX) ^ !!(msg.msg_flags & MSG_EOR)) {
330+
perror("MSG_EOR");
331+
exit(EXIT_FAILURE);
332+
}
327333
}
328334

329335
close(fd);

0 commit comments

Comments
 (0)