mirror of
https://github.com/facebook/zstd.git
synced 2025-08-01 09:47:01 +03:00
added gzip tests
also : made sure zstd --format=gzip -V would fail if gzip compatibility is not supported
This commit is contained in:
@ -581,6 +581,7 @@ int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles, const char* di
|
|||||||
{
|
{
|
||||||
double const compressibility = (double)g_compressibilityDefault / 100;
|
double const compressibility = (double)g_compressibilityDefault / 100;
|
||||||
|
|
||||||
|
if (cLevel < 1) cLevel = 1; /* minimum compression level */
|
||||||
if (cLevel > ZSTD_maxCLevel()) cLevel = ZSTD_maxCLevel();
|
if (cLevel > ZSTD_maxCLevel()) cLevel = ZSTD_maxCLevel();
|
||||||
if (cLevelLast > ZSTD_maxCLevel()) cLevelLast = ZSTD_maxCLevel();
|
if (cLevelLast > ZSTD_maxCLevel()) cLevelLast = ZSTD_maxCLevel();
|
||||||
if (cLevelLast < cLevel) cLevelLast = cLevel;
|
if (cLevelLast < cLevel) cLevelLast = cLevel;
|
||||||
|
@ -370,10 +370,12 @@ int main(int argCount, const char* argv[])
|
|||||||
if (!strcmp(argument, "--keep")) { FIO_setRemoveSrcFile(0); continue; }
|
if (!strcmp(argument, "--keep")) { FIO_setRemoveSrcFile(0); continue; }
|
||||||
if (!strcmp(argument, "--rm")) { FIO_setRemoveSrcFile(1); continue; }
|
if (!strcmp(argument, "--rm")) { FIO_setRemoveSrcFile(1); continue; }
|
||||||
if (!strcmp(argument, "--priority=rt")) { setRealTimePrio = 1; continue; }
|
if (!strcmp(argument, "--priority=rt")) { setRealTimePrio = 1; continue; }
|
||||||
|
#ifdef ZSTD_GZCOMPRESS
|
||||||
if (!strcmp(argument, "--format=gzip")) { suffix = GZ_EXTENSION; FIO_setCompressionType(FIO_gzipCompression); continue; }
|
if (!strcmp(argument, "--format=gzip")) { suffix = GZ_EXTENSION; FIO_setCompressionType(FIO_gzipCompression); continue; }
|
||||||
|
#endif
|
||||||
|
|
||||||
/* long commands with arguments */
|
/* long commands with arguments */
|
||||||
#ifndef ZSTD_NODICT
|
#ifndef ZSTD_NODICT
|
||||||
if (longCommandWArg(&argument, "--cover=")) {
|
if (longCommandWArg(&argument, "--cover=")) {
|
||||||
cover=1; if (!parseCoverParameters(argument, &coverParams)) CLEAN_RETURN(badusage(programName));
|
cover=1; if (!parseCoverParameters(argument, &coverParams)) CLEAN_RETURN(badusage(programName));
|
||||||
continue;
|
continue;
|
||||||
|
@ -304,11 +304,32 @@ $ECHO "\n**** benchmark mode tests **** "
|
|||||||
|
|
||||||
$ECHO "bench one file"
|
$ECHO "bench one file"
|
||||||
./datagen > tmp1
|
./datagen > tmp1
|
||||||
$ZSTD -bi1 tmp1
|
$ZSTD -bi0 tmp1
|
||||||
$ECHO "bench multiple levels"
|
$ECHO "bench multiple levels"
|
||||||
$ZSTD -i1b1e3 tmp1
|
$ZSTD -i0b0e3 tmp1
|
||||||
$ECHO "with recursive and quiet modes"
|
$ECHO "with recursive and quiet modes"
|
||||||
$ZSTD -rqi1b1e3 tmp1
|
$ZSTD -rqi1b1e2 tmp1
|
||||||
|
|
||||||
|
|
||||||
|
$ECHO "\n**** gzip compatibility tests **** "
|
||||||
|
|
||||||
|
GZIPMODE=1
|
||||||
|
$ZSTD --format=gzip -V || GZIPMODE=0
|
||||||
|
if [ $GZIPMODE -eq 1 ]; then
|
||||||
|
GZIPEXE=1
|
||||||
|
which gzip || GZIPEXE=0
|
||||||
|
if [ $GZIPEXE -eq 1 ]; then
|
||||||
|
./datagen > tmp
|
||||||
|
$ZSTD --format=gzip -f tmp
|
||||||
|
gzip -t -v tmp.gz
|
||||||
|
gzip -f tmp
|
||||||
|
$ZSTD -d -f -v tmp.gz
|
||||||
|
else
|
||||||
|
$ECHO "gzip binary not detected"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
$ECHO "gzip mode not supported"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
$ECHO "\n**** zstd round-trip tests **** "
|
$ECHO "\n**** zstd round-trip tests **** "
|
||||||
@ -317,10 +338,10 @@ roundTripTest
|
|||||||
roundTripTest -g15K # TableID==3
|
roundTripTest -g15K # TableID==3
|
||||||
roundTripTest -g127K # TableID==2
|
roundTripTest -g127K # TableID==2
|
||||||
roundTripTest -g255K # TableID==1
|
roundTripTest -g255K # TableID==1
|
||||||
roundTripTest -g513K # TableID==0
|
roundTripTest -g522K # TableID==0
|
||||||
roundTripTest -g512K 6 # greedy, hash chain
|
roundTripTest -g519K 6 # greedy, hash chain
|
||||||
roundTripTest -g512K 16 # btlazy2
|
roundTripTest -g517K 16 # btlazy2
|
||||||
roundTripTest -g512K 19 # btopt
|
roundTripTest -g516K 19 # btopt
|
||||||
|
|
||||||
rm tmp*
|
rm tmp*
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user