diff options
author | Yann Collet <cyan@fb.com> | 2022-07-05 21:08:36 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2022-07-05 21:08:36 (GMT) |
commit | 6e242d1915df794d2f5c337f3bc29146efa98588 (patch) | |
tree | 36d2ea6a25e698a2aec95fbe7487acdf71937422 | |
parent | 6349795258c0538a0984fd755abd3ef125a80c15 (diff) | |
download | lz4-6e242d1915df794d2f5c337f3bc29146efa98588.zip lz4-6e242d1915df794d2f5c337f3bc29146efa98588.tar.gz lz4-6e242d1915df794d2f5c337f3bc29146efa98588.tar.bz2 |
update frametest for new condition for uncompressedUpdate
-rw-r--r-- | tests/frametest.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/tests/frametest.c b/tests/frametest.c index 939d4c2..a496c3c 100644 --- a/tests/frametest.c +++ b/tests/frametest.c @@ -1023,21 +1023,18 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi #if 1 /* insert uncompressed segment */ - if ((iSize>0) && !neverFlush && ((FUZ_rand(&randState) & 15) == 1)) { + if ( (iSize>0) + && !neverFlush /* do not mess with compressBound when neverFlush is set */ + && prefsPtr != NULL /* prefs are set */ + && prefs.frameInfo.blockMode == LZ4F_blockIndependent /* uncompressedUpdate is only valid with blockMode==independent */ + && (FUZ_rand(&randState) & 15) == 1 ) { size_t const uSize = FUZ_rand(&randState) % iSize; - DISPLAYLEVEL(2, "insert %zu / %zu (blockSize=%uKB) \n", uSize, iSize, 1 << (2*prefs.frameInfo.blockSizeID - 2)); - { size_t const flushedSize = LZ4F_uncompressedUpdate(cCtx, op, (size_t)(oend-op), ip, uSize, &cOptions); - CHECK(LZ4F_isError(flushedSize), "Insert uncompressed data failed (error %i : %s)", - (int)flushedSize, LZ4F_getErrorName(flushedSize)); - op += flushedSize; - ip += uSize; - } + size_t const flushedSize = LZ4F_uncompressedUpdate(cCtx, op, (size_t)(oend-op), ip, uSize, &cOptions); + CHECK(LZ4F_isError(flushedSize), "Insert uncompressed data failed (error %i : %s)", + (int)flushedSize, LZ4F_getErrorName(flushedSize)); + op += flushedSize; + ip += uSize; iSize -= uSize; - { size_t const flushedSize = LZ4F_flush(cCtx, op, (size_t)(oend-op), &cOptions); - CHECK(LZ4F_isError(flushedSize), "Flush after LZ4F_uncompressedUpdate failed (error %i : %s)", - (int)flushedSize, LZ4F_getErrorName(flushedSize)); - op += flushedSize; - } } #endif |