dovecot-2.2: lib: test-istream-concat - early abort test loop on...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 27 13:22:41 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/77f21248d29e
changeset: 17526:77f21248d29e
user:      Phil Carmody <phil at dovecot.fi>
date:      Fri Jun 27 16:11:40 2014 +0300
description:
lib: test-istream-concat - early abort test loop on failure
No point in continuing past the first failure.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib/test-istream-concat.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r e1686f44f2e7 -r 77f21248d29e src/lib/test-istream-concat.c
--- a/src/lib/test-istream-concat.c	Fri Jun 27 16:10:27 2014 +0300
+++ b/src/lib/test-istream-concat.c	Fri Jun 27 16:11:40 2014 +0300
@@ -49,7 +49,7 @@
 	i_stream_unref(&input);
 }
 
-static void test_istream_concat_random(void)
+static bool test_istream_concat_random(void)
 {
 	struct istream **streams, *input, *input1, *input2;
 	const unsigned char *data;
@@ -97,11 +97,14 @@
 				}
 			}
 		}
+		if (test_has_failed())
+			break;
 	}
 	for (i = 0; i < stream_count; i++)
 		i_stream_unref(&streams[i]);
 	i_stream_unref(&input1);
 	i_stream_unref(&input2);
+	return !test_has_failed();
 }
 
 void test_istream_concat(void)
@@ -116,7 +119,8 @@
 
 	test_begin("istream concat random");
 	for (i = 0; i < 100; i++) T_BEGIN {
-		test_istream_concat_random();
+		if(!test_istream_concat_random())
+			i = 101; /* don't break a T_BEGIN */
 	} T_END;
 	test_end();
 }


More information about the dovecot-cvs mailing list