]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/coredump: ignore ENOSPC errors
authorChristian Brauner <brauner@kernel.org>
Tue, 28 Oct 2025 08:46:05 +0000 (09:46 +0100)
committerChristian Brauner <brauner@kernel.org>
Tue, 4 Nov 2025 21:04:57 +0000 (22:04 +0100)
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 <aleksandr.mikhalitsyn@canonical.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
tools/testing/selftests/coredump/coredump_socket_protocol_test.c
tools/testing/selftests/coredump/coredump_socket_test.c
tools/testing/selftests/coredump/coredump_test_helpers.c

index 566545e96d7f8278d3e7377ad4fd1df68057085c..d19b6717c53ef100608b6c9ac24eebb9f812b2bf 100644 (file)
@@ -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;
                                }
index 0a37d0456672084f6a64d9ec143996940ddc0fd2..da558a0e37aaae6c7c92ee465c1c73e74cb1c613 100644 (file)
@@ -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;
                        }
                }
index 65deb3cfbe1ba5a440d5eb47277fe3a43ae0c7f8..a6f6d5f2ae07a7cf71c098086db1f96dc4bf6bbd 100644 (file)
@@ -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;