more compression tests

This commit is contained in:
Yann Collet 2015-11-22 14:40:51 +01:00
parent a5c737411a
commit d7233d6e14
3 changed files with 49 additions and 18 deletions

View File

@ -1558,7 +1558,7 @@ size_t ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx* ctx,
const BYTE* const repBase = repIndex < dictLimit ? dictBase : base;
const BYTE* const repMatch = repBase + repIndex;
if ((repIndex <= dictLimit-4) || (repIndex >= dictLimit))
if (MEM_read32(ip+1) == MEM_read32(repMatch))
if (MEM_read32(ip+1) == MEM_read32(repMatch))
{
/* repcode detected we should take it */
const BYTE* const repEnd = repIndex < dictLimit ? dictEnd : iend;
@ -1598,7 +1598,7 @@ size_t ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx* ctx,
const BYTE* const repBase = repIndex < dictLimit ? dictBase : base;
const BYTE* const repMatch = repBase + repIndex;
if ((repIndex <= dictLimit-4) || (repIndex >= dictLimit))
if (MEM_read32(ip) == MEM_read32(repMatch))
if (MEM_read32(ip) == MEM_read32(repMatch))
{
/* repcode detected */
size_t repLength;
@ -1642,7 +1642,7 @@ size_t ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx* ctx,
const BYTE* const repBase = repIndex < dictLimit ? dictBase : base;
const BYTE* const repMatch = repBase + repIndex;
if ((repIndex <= dictLimit-4) || (repIndex >= dictLimit))
if (MEM_read32(ip) == MEM_read32(repMatch))
if (MEM_read32(ip) == MEM_read32(repMatch))
{
/* repcode detected */
size_t repLength;
@ -1699,7 +1699,7 @@ _storeSequence:
const U32 repIndex = (U32)((ip-base) - offset_2);
const BYTE* const repBase = repIndex < dictLimit ? dictBase : base;
const BYTE* const repMatch = repBase + repIndex;
if (MEM_read32(ip) == MEM_read32(repMatch))
if (MEM_read32(ip) == MEM_read32(repMatch))
{
/* repcode detected we should take it */
const BYTE* const repEnd = repIndex < dictLimit ? dictEnd : iend;
@ -1874,6 +1874,7 @@ size_t ZSTD_compressContinue (ZSTD_CCtx* ctxPtr,
ctxPtr->dictLimit = (U32)(ctxPtr->nextSrc - ctxPtr->base);
ctxPtr->dictBase = ctxPtr->base;
ctxPtr->base += ip - ctxPtr->nextSrc;
ctxPtr->nextToUpdate = ctxPtr->dictLimit;
}
/* input-dictionary overlap */

View File

@ -153,19 +153,49 @@ test-zstd: zstd datagen
echo foo | ./zstd > /dev/full; if [ $$? -eq 0 ] ; then echo "write error not detected!"; false; fi
echo foo | ./zstd | ./zstd -d > /dev/full; if [ $$? -eq 0 ] ; then echo "write error not detected!"; false; fi
@echo "**** zstd round-trip tests **** "
./datagen | md5sum > tmp1
./datagen | ./zstd -v | ./zstd -d | md5sum > tmp2
diff tmp1 tmp2
./datagen | ./zstd -6 -v | ./zstd -d | md5sum > tmp2
diff tmp1 tmp2
./datagen -g256MB | md5sum > tmp1
./datagen -g256MB | ./zstd -v | ./zstd -d | md5sum > tmp2
diff tmp1 tmp2
./datagen -g256MB | ./zstd -3 -v | ./zstd -d | md5sum > tmp2
diff tmp1 tmp2
./datagen -g6GB -P99 | md5sum > tmp1
./datagen -g6GB -P99 | ./zstd -vq | ./zstd -d | md5sum > tmp2
diff tmp1 tmp2
@./datagen | md5sum > tmp1
./datagen | ./zstd -v | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
./datagen | ./zstd -6 -v | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
@./datagen -g256MB | md5sum > tmp1
./datagen -g256MB | ./zstd -v | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
./datagen -g256MB | ./zstd -v2 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
./datagen -g256MB | ./zstd -v3 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
@./datagen -g128MB -P60| md5sum > tmp1
./datagen -g128MB -P60 | ./zstd -v4 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
./datagen -g128MB -P60 | ./zstd -v5 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
./datagen -g128MB -P60 | ./zstd -v6 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
@./datagen -g64MB -P70 | md5sum > tmp1
./datagen -g64MB -P70 | ./zstd -v7 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
./datagen -g64MB -P70 | ./zstd -v8 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
./datagen -g64MB -P70 | ./zstd -v9 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
@./datagen -g32MB -P75 | md5sum > tmp1
./datagen -g32MB -P75 | ./zstd -v10 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
./datagen -g32MB -P75 | ./zstd -v11 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
./datagen -g32MB -P75 | ./zstd -v12 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
@./datagen -g16MB -P80 | md5sum > tmp1
./datagen -g16MB -P80 | ./zstd -v13 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
./datagen -g16MB -P80 | ./zstd -v14 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
./datagen -g16MB -P80 | ./zstd -v15 | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
./datagen -g6GB -P99 | md5sum > tmp1
./datagen -g6GB -P99 | ./zstd -vq | ./zstd -d | md5sum > tmp2
@diff tmp1 tmp2
test-zstd32: zstd32 datagen
./datagen | ./zstd32 -v | ./zstd32 -d > $(VOID)

View File

@ -283,7 +283,7 @@ unsigned long long FIO_compressFilename(const char* output_filename, const char*
inSize = fread(inSlot, (size_t)1, blockSize, finput);
if (inSize==0) break;
filesize += inSize;
DISPLAYUPDATE(2, "\rRead : %u MB ", (U32)(filesize>>20));
DISPLAYUPDATE(2, "\rRead : %u MB ", (U32)(filesize>>20));
/* Compress Block */
cSize = ZSTD_compressContinue(ctx, outBuff, outBuffSize, inSlot, inSize);