]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: test-istream-base64-decoder - Abort random test at first error and print parameters.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Wed, 4 Sep 2019 23:11:53 +0000 (01:11 +0200)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Thu, 5 Sep 2019 12:22:21 +0000 (14:22 +0200)
src/lib/test-istream-base64-decoder.c

index 6b8e3262c353d71742a79e7302749c3153427ba3..21106697212a14811da01ff8eaa5aabd66082e72 100644 (file)
@@ -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);