mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-30 21:35:16 +00:00
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: 7b6724fe9a
("selftests/coredump: add tests for AF_UNIX coredumps")
Signed-off-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/20250620110252.1640391-1-namcao@linutronix.de
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
e04c78d86a
commit
6a68d28066
@ -461,10 +461,15 @@ TEST_F(coredump, socket_detect_userspace_client)
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ret = read(fd_coredump, &c, 1);
|
||||
|
||||
close(fd_coredump);
|
||||
close(fd_server);
|
||||
close(fd_peer_pidfd);
|
||||
close(fd_core_file);
|
||||
|
||||
if (ret < 1)
|
||||
_exit(EXIT_FAILURE);
|
||||
_exit(EXIT_SUCCESS);
|
||||
}
|
||||
self->pid_coredump_server = pid_coredump_server;
|
||||
|
Loading…
Reference in New Issue
Block a user