Skip to content

Commit

Permalink
zdtm: socket_udp_shutdown: Make the test fail instead of timing out.
Browse files Browse the repository at this point in the history
When -- after restore -- sockets can't communicate, the test times out
while waiting on recvfrom(). Since the communication is local, send()
works instantaneously - so mark sockets with SOCK_NONBLOCK and report
failure if the message is not received immediately.

Signed-off-by: Michał Mirosław <[email protected]>
  • Loading branch information
osctobe committed Jun 15, 2023
1 parent e35f2ee commit 0399e98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/zdtm/static/socket_udp_shutdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ int main(int argc, char **argv)

test_init(argc, argv);

sk1 = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
sk2 = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
sk1 = socket(PF_INET, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP);
sk2 = socket(PF_INET, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP);
if (sk1 < 0 || sk2 < 0) {
pr_perror("Can't create socket");
exit(1);
Expand Down

0 comments on commit 0399e98

Please sign in to comment.