diff --git a/tools/testing/selftests/coredump/coredump_socket_protocol_test.c b/tools/testing/selftests/coredump/coredump_socket_protocol_test.c index 566545e96d7f..d19b6717c53e 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 0a37d0456672..da558a0e37aa 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 65deb3cfbe1b..a6f6d5f2ae07 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;