From a9e5583c0bb37446661bf40b459386e32e727d41 Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Thu, 5 Sep 2019 01:11:53 +0200 Subject: [PATCH] lib: test-istream-base64-decoder - Abort random test at first error and print parameters. --- src/lib/test-istream-base64-decoder.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/lib/test-istream-base64-decoder.c b/src/lib/test-istream-base64-decoder.c index 6b8e3262c3..2110669721 100644 --- a/src/lib/test-istream-base64-decoder.c +++ b/src/lib/test-istream-base64-decoder.c @@ -137,7 +137,7 @@ test_istream_base64_io_random(void) test_begin("istream base64 random I/O"); - for (i = 0; i < 4000; i++) { + for (i = 0; !test_has_failed() && i < 4000; i++) { struct istream *input1, *input2, *input3, *input4, *input5; struct istream *sinput1, *sinput2, *sinput3, *sinput4; struct istream *top_input; @@ -264,6 +264,25 @@ test_istream_base64_io_random(void) memcmp(in_buf, out_buf->data, in_buf_size) == 0, i); + if (top_input->stream_errno != 0) { + i_error("%s: %s", i_stream_get_name(input1), + i_stream_get_error(input1)); + i_error("%s: %s", i_stream_get_name(input2), + i_stream_get_error(input2)); + i_error("%s: %s", i_stream_get_name(input3), + i_stream_get_error(input3)); + i_error("%s: %s", i_stream_get_name(input4), + i_stream_get_error(input4)); + i_error("%s: %s", i_stream_get_name(input5), + i_stream_get_error(input5)); + } + + if (test_has_failed()) { + i_info("Test parameters: size=%"PRIuSIZE_T" " + "line_length_1=%u line_length_2=%u", + in_buf_size, chpl1, chpl2); + } + /* Clean up */ i_stream_unref(&input1); i_stream_unref(&input2); -- 2.47.3