Skip to content

Commit

Permalink
dcrypt: Test for stream prefetch
Browse files Browse the repository at this point in the history
  • Loading branch information
cmouse authored and sirainen committed Sep 6, 2016
1 parent 527d6c5 commit b5d604b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lib-dcrypt/test-stream.c
Expand Up @@ -121,6 +121,7 @@ static
void test_static_v2_input(void)
{
test_begin("test_static_v2_input");

ssize_t amt;
const struct hash_method *hash = hash_method_lookup("sha256");
unsigned char hash_ctx[hash->context_size];
Expand Down Expand Up @@ -322,10 +323,10 @@ static
void test_write_read_v2(void)
{
test_begin("test_write_read_v2");
unsigned char payload[IO_BLOCK_SIZE];
unsigned char payload[IO_BLOCK_SIZE*10];
const unsigned char *ptr;
size_t pos = 0, siz;
random_fill_weak(payload, IO_BLOCK_SIZE);
random_fill_weak(payload, IO_BLOCK_SIZE*10);

buffer_t *buf = buffer_create_dynamic(default_pool, sizeof(payload));
struct ostream *os = o_stream_create_buffer(buf);
Expand All @@ -339,6 +340,10 @@ void test_write_read_v2(void)
o_stream_unref(&os_2);

struct istream *is = test_istream_create_data(buf->data, buf->used);
/* test regression where read fails due to incorrect behaviour
when buffer is full before going to decrypt code */
i_stream_set_max_buffer_size(is, 8192);
i_stream_read(is);
struct istream *is_2 = i_stream_create_decrypt(is, test_v1_kp.priv);

size_t offset = 0;
Expand Down

0 comments on commit b5d604b

Please sign in to comment.