dovecot-2.2: lib: test-istream-tee - randomise which tee stream ...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jul 10 13:02:05 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/4f56f24b5bb2
changeset: 17619:4f56f24b5bb2
user:      Phil Carmody <phil at dovecot.fi>
date:      Thu Jul 10 15:59:53 2014 +0300
description:
lib: test-istream-tee - randomise which tee stream lags behind the others
Just in case there's something special about the start or the end of the
list of children, make each file be the one that lags behind the others.

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

diffstat:

 src/lib/test-istream-tee.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r cba6877471ca -r 4f56f24b5bb2 src/lib/test-istream-tee.c
--- a/src/lib/test-istream-tee.c	Thu Jul 10 15:59:53 2014 +0300
+++ b/src/lib/test-istream-tee.c	Thu Jul 10 15:59:53 2014 +0300
@@ -49,17 +49,20 @@
 
 	delta = 1;
 	while ((len += delta) <= TEST_STR_LEN) {
+		unsigned int lagger = rand() % CHILD_COUNT;
 		test_istream_set_size(test_input, len);
 		for (i = 0; i < CHILD_COUNT; i++) {
 			test_assert(i_stream_read(child_input[i]) == -2);
 			test_assert(!tee_i_stream_child_is_waiting(child_input[i]));
 		}
-		for (i = 0; i < CHILD_COUNT-1; i++) {
+		for (i = 0; i < CHILD_COUNT; i++) {
+			if (i == lagger)
+				continue;
 			i_stream_skip(child_input[i], delta);
 			test_assert(i_stream_read(child_input[i]) == 0);
 			test_assert(tee_i_stream_child_is_waiting(child_input[i]));
 		}
-		i_stream_skip(child_input[i], delta);
+		i_stream_skip(child_input[lagger], delta);
 		for (i = 0; i < CHILD_COUNT; i++) {
 			test_assert(i_stream_read(child_input[i]) == delta);
 			test_assert(i_stream_read(child_input[i]) == -2);


More information about the dovecot-cvs mailing list