]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: test-base64 - Abort random test at first error and print parameters.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Wed, 4 Sep 2019 21:37:11 +0000 (23:37 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 10 Sep 2019 07:02:41 +0000 (10:02 +0300)
src/lib/test-base64.c

index f546cf6d0ed2a07d51a3b533e11e41cc13af067c..4db27c939b7705ad60c80d0d6117e3b27114131c 100644 (file)
@@ -1010,6 +1010,15 @@ test_base64_random_lowlevel_case(const struct base64_scheme *b64,
                                                      max_line_len, i,
                                                      in_buf, in_buf_size,
                                                      buf1, buf2);
+
+               if (test_has_failed()) {
+                       i_info("One block test failed ("
+                              "enc_flags=%02x dec_flags=%02x "
+                              "max_line_len=%"PRIuSIZE_T" size=%"PRIuSIZE_T")",
+                               enc_flags, dec_flags, max_line_len,
+                               in_buf_size);
+                       return;
+               }
        }
 
        /* streaming; single-byte trickle */
@@ -1022,6 +1031,15 @@ test_base64_random_lowlevel_case(const struct base64_scheme *b64,
                                                   max_line_len, i,
                                                   in_buf, in_buf_size,
                                                   buf1, buf2, 1);
+
+               if (test_has_failed()) {
+                       i_info("Streaming single-byte trickle test failed ("
+                              "enc_flags=%02x dec_flags=%02x "
+                              "max_line_len=%"PRIuSIZE_T" size=%"PRIuSIZE_T")",
+                               enc_flags, dec_flags, max_line_len,
+                               in_buf_size);
+                       return;
+               }
        }
 
        /* streaming; random chunks */
@@ -1034,6 +1052,14 @@ test_base64_random_lowlevel_case(const struct base64_scheme *b64,
                                                   max_line_len, i,
                                                   in_buf, in_buf_size,
                                                   buf1, buf2, 0);
+               if (test_has_failed()) {
+                       i_info("Streaming random chunks test failed ("
+                              "enc_flags=%02x dec_flags=%02x "
+                              "max_line_len=%"PRIuSIZE_T" size=%"PRIuSIZE_T")",
+                               enc_flags, dec_flags, max_line_len,
+                               in_buf_size);
+                       return;
+               }
        }
 }