dovecot-2.2: lib: test-istream-concat - test only concat, not si...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jul 10 13:01:59 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/9280679be21e
changeset: 17615:9280679be21e
user:      Phil Carmody <phil at dovecot.fi>
date:      Thu Jul 10 15:59:53 2014 +0300
description:
lib: test-istream-concat - test only concat, not simultanious limit streams
Test just concat functionality in this unit test. Simultanious access of
limit streams can be tested elsewhere.

Without the fix in:
  31efe2d04793 lib: istream-concat read() returned -2 too early.
The failure previously seen in test-istream-concat would be still reproducable:
test-istream-concat.c:84: Assert failed: size >= TEST_MAX_BUFFER_SIZE
istream concat random ................................................ : FAILED
test: random seed #1 was 1403118493

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

diffstat:

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

diffs (35 lines):

diff -r 2fada3a76d10 -r 9280679be21e src/lib/test-istream-concat.c
--- a/src/lib/test-istream-concat.c	Thu Jul 10 15:40:08 2014 +0300
+++ b/src/lib/test-istream-concat.c	Thu Jul 10 15:59:53 2014 +0300
@@ -51,7 +51,7 @@
 
 static bool test_istream_concat_random(void)
 {
-	struct istream **streams, *input, *input1, *input2;
+	struct istream **streams, *input;
 	const unsigned char *data;
 	unsigned char *w_data;
 	size_t size = 0;
@@ -72,12 +72,8 @@
 
 	input = i_stream_create_concat(streams);
 	i_stream_set_max_buffer_size(input, TEST_MAX_BUFFER_SIZE);
-	input1 = i_stream_create_limit(input, (uoff_t)-1);
-	input2 = i_stream_create_limit(input, (uoff_t)-1);
-	i_stream_unref(&input);
 
 	for (i = 0; i < 1000; i++) {
-		input = i % 2 == 0 ? input1 : input2;
 		if (rand() % 3 == 0) {
 			i_stream_seek(input, rand() % offset);
 		} else {
@@ -101,8 +97,7 @@
 	}
 	for (i = 0; i < stream_count; i++)
 		i_stream_unref(&streams[i]);
-	i_stream_unref(&input1);
-	i_stream_unref(&input2);
+	i_stream_unref(&input);
 	return !test_has_failed();
 }
 


More information about the dovecot-cvs mailing list