Skip to content

Commit 6a68d28

Browse files
covanambrauner
authored andcommitted
selftests/coredump: Fix "socket_detect_userspace_client" test failure
The coredump.socket_detect_userspace_client test occasionally fails: # RUN coredump.socket_detect_userspace_client ... # stackdump_test.c:500:socket_detect_userspace_client:Expected 0 (0) != WIFEXITED(status) (0) # socket_detect_userspace_client: Test terminated by assertion # FAIL coredump.socket_detect_userspace_client not ok 3 coredump.socket_detect_userspace_client because there is no guarantee that client's write() happens before server's close(). The client gets terminated SIGPIPE, and thus the test fails. Add a read() to server to make sure server's close() doesn't happen before client's write(). Fixes: 7b6724f ("selftests/coredump: add tests for AF_UNIX coredumps") Signed-off-by: Nam Cao <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent e04c78d commit 6a68d28

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/testing/selftests/coredump/stackdump_test.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,15 @@ TEST_F(coredump, socket_detect_userspace_client)
461461
_exit(EXIT_FAILURE);
462462
}
463463

464+
ret = read(fd_coredump, &c, 1);
465+
464466
close(fd_coredump);
465467
close(fd_server);
466468
close(fd_peer_pidfd);
467469
close(fd_core_file);
470+
471+
if (ret < 1)
472+
_exit(EXIT_FAILURE);
468473
_exit(EXIT_SUCCESS);
469474
}
470475
self->pid_coredump_server = pid_coredump_server;

0 commit comments

Comments
 (0)