Skip to content

Commit 32ae33f

Browse files
committed
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 <aleksandr.mikhalitsyn@canonical.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 408a0ed commit 32ae33f

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

tools/testing/selftests/coredump/coredump_socket_protocol_test.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ TEST_F(coredump, socket_request_kernel)
184184

185185
bytes_write = write(fd_core_file, buffer, bytes_read);
186186
if (bytes_read != bytes_write) {
187+
if (bytes_write < 0 && errno == ENOSPC)
188+
continue;
187189
fprintf(stderr, "socket_request_kernel: write to core file failed (read=%zd, write=%zd): %m\n",
188190
bytes_read, bytes_write);
189191
goto out;
@@ -1366,6 +1368,8 @@ TEST_F_TIMEOUT(coredump, socket_multiple_crashing_coredumps, 500)
13661368

13671369
bytes_write = write(fd_core_file, buffer, bytes_read);
13681370
if (bytes_read != bytes_write) {
1371+
if (bytes_write < 0 && errno == ENOSPC)
1372+
continue;
13691373
fprintf(stderr, "write failed for fd %d: %m\n", fd_core_file);
13701374
goto out;
13711375
}

tools/testing/selftests/coredump/coredump_socket_test.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,9 @@ TEST_F(coredump, socket)
158158

159159
bytes_write = write(fd_core_file, buffer, bytes_read);
160160
if (bytes_read != bytes_write) {
161-
fprintf(stderr, "socket test: write to core file failed (read=%zd, write=%zd): %m\n",
162-
bytes_read, bytes_write);
161+
if (bytes_write < 0 && errno == ENOSPC)
162+
continue;
163+
fprintf(stderr, "socket test: write to core file failed (read=%zd, write=%zd): %m\n", bytes_read, bytes_write);
163164
goto out;
164165
}
165166
}

tools/testing/selftests/coredump/coredump_test_helpers.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ void process_coredump_worker(int fd_coredump, int fd_peer_pidfd, int fd_core_fil
357357
goto done;
358358
ssize_t bytes_write = write(fd_core_file, buffer, bytes_read);
359359
if (bytes_write != bytes_read) {
360+
if (bytes_write < 0 && errno == ENOSPC)
361+
continue;
360362
fprintf(stderr, "Worker: write() failed (read=%zd, write=%zd): %m\n",
361363
bytes_read, bytes_write);
362364
goto out;

0 commit comments

Comments
 (0)