summaryrefslogtreecommitdiffstats
path: root/programs
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2014-09-10 12:53:42 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2014-09-10 12:53:42 (GMT)
commited4a6bf2cb8a46979e2c9f0eab99052844b21f03 (patch)
tree99cbe5c0c57a95bab60fcbf0faead98c4204a6a2 /programs
parent0400451ac22b9578274a3971ed65e6c70cd7fdb9 (diff)
downloadlz4-ed4a6bf2cb8a46979e2c9f0eab99052844b21f03.zip
lz4-ed4a6bf2cb8a46979e2c9f0eab99052844b21f03.tar.gz
lz4-ed4a6bf2cb8a46979e2c9f0eab99052844b21f03.tar.bz2
More tests : random flushes
Diffstat (limited to 'programs')
-rw-r--r--programs/frametest.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/programs/frametest.c b/programs/frametest.c
index efe1883..2c45f85 100644
--- a/programs/frametest.c
+++ b/programs/frametest.c
@@ -356,7 +356,7 @@ _output_error:
}
-static const U32 srcDataLength = 4 MB;
+static const U32 srcDataLength = 9 MB; /* needs to be > 2x4MB to test large blocks */
int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressibility)
{
@@ -419,11 +419,18 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi
unsigned nbBitsSeg = FUZ_rand(&randState) % maxBits;
size_t iSize = (FUZ_rand(&randState) & ((1<<nbBitsSeg)-1)) + 1;
size_t oSize = oend-op;
+ unsigned forceFlush = ((FUZ_rand(&randState) & 3) == 1);
if (iSize > (size_t)(iend-ip)) iSize = iend-ip;
result = LZ4F_compress(cCtx, op, oSize, ip, iSize, NULL);
CHECK(LZ4F_isError(result), "Compression failed (error %i)", (int)result);
op += result;
ip += iSize;
+ if (forceFlush)
+ {
+ result = LZ4F_flush(cCtx, op, oend-op, NULL);
+ CHECK(LZ4F_isError(result), "Compression failed (error %i)", (int)result);
+ op += result;
+ }
}
result = LZ4F_compressEnd(cCtx, op, oend-op, NULL);
CHECK(LZ4F_isError(result), "Compression completion failed (error %i)", (int)result);