Skip to content

Commit

Permalink
testprocess: Improve debug logging
Browse files Browse the repository at this point in the history
Helps: libsdl-org#11006
Signed-off-by: Simon McVittie <[email protected]>
  • Loading branch information
smcv committed Sep 30, 2024
1 parent d44e805 commit f53f9e9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/testprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,10 @@ static int process_testStdinToStdout(void *arg)
}
amount_written = SDL_WriteIO(process_stdin, text_in + total_written, text_in_size - total_written);
if (log_this_iteration) {
SDLTest_Log("SDL_WriteIO() -> %u (%dth time)", (unsigned)amount_written, iteration_count);
SDLTest_Log("SDL_WriteIO() -> %u (%dth time), total written %u",
(unsigned)amount_written,
iteration_count,
(unsigned)(total_written + amount_written));
}
if (amount_written == 0) {
io_status = SDL_GetIOStatus(process_stdin);
Expand All @@ -480,6 +483,9 @@ static int process_testStdinToStdout(void *arg)
if (total_written == text_in_size) {
SDLTest_Log("All data written to stdin");
}
else if (total_written > text_in_size) {
SDLTest_Log("Too much data written?!");
}
}

/* FIXME: this needs a rate limit */
Expand All @@ -488,7 +494,10 @@ static int process_testStdinToStdout(void *arg)
}
amount_read = SDL_ReadIO(process_stdout, local_buffer, sizeof(local_buffer));
if (log_this_iteration) {
SDLTest_Log("SDL_ReadIO() -> %u (%dth time)", (unsigned)amount_read, iteration_count);
SDLTest_Log("SDL_ReadIO() -> %u (%dth time), total read %u",
(unsigned)amount_read,
iteration_count,
(unsigned)(total_read + amount_read));
}
if (amount_read == 0) {
io_status = SDL_GetIOStatus(process_stdout);
Expand Down

0 comments on commit f53f9e9

Please sign in to comment.