dovecot-2.2: lib: remove unwanted srand()s from unit tests

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


details:   http://hg.dovecot.org/dovecot-2.2/rev/9fd5c57fa49b
changeset: 17533:9fd5c57fa49b
user:      Phil Carmody <phil at dovecot.fi>
date:      Fri Jun 27 16:17:50 2014 +0300
description:
lib: remove unwanted srand()s from unit tests
We'll get better coverage without them.

Note: this change causes the following test case failure occasionally:
test-istream-concat.c:88: Assert failed: size >= TEST_MAX_BUFFER_SIZE
istream concat random ................................................ : FAILED
test: random seed #1 was 1403027537

(The seed may vary, obviously.)

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

diffstat:

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

diffs (22 lines):

diff -r 06f29889af37 -r 9fd5c57fa49b src/lib/test-buffer.c
--- a/src/lib/test-buffer.c	Fri Jun 27 16:17:07 2014 +0300
+++ b/src/lib/test-buffer.c	Fri Jun 27 16:17:50 2014 +0300
@@ -21,7 +21,6 @@
 		testdata[i] = rand();
 	memset(shadowbuf, 0, sizeof(shadowbuf));
 
-	srand(1);
 	shadowbuf_size = 0;
 	for (i = 0; i < BUF_TEST_COUNT; i++) {
 		if (buf->used == BUF_TEST_SIZE) {
diff -r 06f29889af37 -r 9fd5c57fa49b src/lib/test-istream-concat.c
--- a/src/lib/test-istream-concat.c	Fri Jun 27 16:17:07 2014 +0300
+++ b/src/lib/test-istream-concat.c	Fri Jun 27 16:17:50 2014 +0300
@@ -57,7 +57,6 @@
 	size_t size = 0;
 	unsigned int i, j, offset, stream_count, data_len;
 
-	srand(3);
 	stream_count = (rand() % TEST_MAX_ISTREAM_COUNT) + 2;
 	streams = t_new(struct istream *, stream_count + 1);
 	for (i = 0, offset = 0; i < stream_count; i++) {


More information about the dovecot-cvs mailing list