diff options
| author | Nam Cao <[email protected]> | 2025-06-20 11:02:52 +0000 |
|---|---|---|
| committer | Christian Brauner <[email protected]> | 2025-06-23 10:41:13 +0000 |
| commit | 6a68d28066b6257b8d09b1daa91db43d56dbb6ad (patch) | |
| tree | cb547a1483690bdb5c778fa8a794e1219d36d6a2 | |
| parent | Linux 6.16-rc2 (diff) | |
| download | kernel-6a68d28066b6257b8d09b1daa91db43d56dbb6ad.tar.gz kernel-6a68d28066b6257b8d09b1daa91db43d56dbb6ad.zip | |
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: 7b6724fe9a6b ("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]>
| -rw-r--r-- | tools/testing/selftests/coredump/stackdump_test.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/coredump/stackdump_test.c b/tools/testing/selftests/coredump/stackdump_test.c index 9984413be9f0..68f8e479ac36 100644 --- a/tools/testing/selftests/coredump/stackdump_test.c +++ b/tools/testing/selftests/coredump/stackdump_test.c @@ -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; |
