From: Christian Brauner Date: Tue, 28 Oct 2025 08:46:05 +0000 (+0100) Subject: selftests/coredump: ignore ENOSPC errors X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=32ae33f796cbff57a4a6ce848360e5539b92ec2a;p=thirdparty%2Flinux.git selftests/coredump: ignore ENOSPC errors If we crash multiple processes at the same time we may run out of space. Just ignore those errors. They're not actually all that relevant for the test. Link: https://patch.msgid.link/20251028-work-coredump-signal-v1-20-ca449b7b7aa0@kernel.org Reviewed-by: Alexander Mikhalitsyn Signed-off-by: Christian Brauner --- diff --git a/tools/testing/selftests/coredump/coredump_socket_protocol_test.c b/tools/testing/selftests/coredump/coredump_socket_protocol_test.c index 566545e96d7f8..d19b6717c53ef 100644 --- a/tools/testing/selftests/coredump/coredump_socket_protocol_test.c +++ b/tools/testing/selftests/coredump/coredump_socket_protocol_test.c @@ -184,6 +184,8 @@ TEST_F(coredump, socket_request_kernel) bytes_write = write(fd_core_file, buffer, bytes_read); if (bytes_read != bytes_write) { + if (bytes_write < 0 && errno == ENOSPC) + continue; fprintf(stderr, "socket_request_kernel: write to core file failed (read=%zd, write=%zd): %m\n", bytes_read, bytes_write); goto out; @@ -1366,6 +1368,8 @@ TEST_F_TIMEOUT(coredump, socket_multiple_crashing_coredumps, 500) bytes_write = write(fd_core_file, buffer, bytes_read); if (bytes_read != bytes_write) { + if (bytes_write < 0 && errno == ENOSPC) + continue; fprintf(stderr, "write failed for fd %d: %m\n", fd_core_file); goto out; } diff --git a/tools/testing/selftests/coredump/coredump_socket_test.c b/tools/testing/selftests/coredump/coredump_socket_test.c index 0a37d04566720..da558a0e37aaa 100644 --- a/tools/testing/selftests/coredump/coredump_socket_test.c +++ b/tools/testing/selftests/coredump/coredump_socket_test.c @@ -158,8 +158,9 @@ TEST_F(coredump, socket) bytes_write = write(fd_core_file, buffer, bytes_read); if (bytes_read != bytes_write) { - fprintf(stderr, "socket test: write to core file failed (read=%zd, write=%zd): %m\n", - bytes_read, bytes_write); + if (bytes_write < 0 && errno == ENOSPC) + continue; + fprintf(stderr, "socket test: write to core file failed (read=%zd, write=%zd): %m\n", bytes_read, bytes_write); goto out; } } diff --git a/tools/testing/selftests/coredump/coredump_test_helpers.c b/tools/testing/selftests/coredump/coredump_test_helpers.c index 65deb3cfbe1ba..a6f6d5f2ae07a 100644 --- a/tools/testing/selftests/coredump/coredump_test_helpers.c +++ b/tools/testing/selftests/coredump/coredump_test_helpers.c @@ -357,6 +357,8 @@ void process_coredump_worker(int fd_coredump, int fd_peer_pidfd, int fd_core_fil goto done; ssize_t bytes_write = write(fd_core_file, buffer, bytes_read); if (bytes_write != bytes_read) { + if (bytes_write < 0 && errno == ENOSPC) + continue; fprintf(stderr, "Worker: write() failed (read=%zd, write=%zd): %m\n", bytes_read, bytes_write); goto out;