Mercurial > dovecot > core-2.2
changeset 17615:9280679be21e
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@dovecot.fi>
author | Phil Carmody <phil@dovecot.fi> |
---|---|
date | Thu, 10 Jul 2014 15:59:53 +0300 |
parents | 2fada3a76d10 |
children | 4583a0c2e368 |
files | src/lib/test-istream-concat.c |
diffstat | 1 files changed, 2 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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(); }