diff --git a/programs/bench.c b/programs/bench.c index 663b30743..2dd1cfb0f 100644 --- a/programs/bench.c +++ b/programs/bench.c @@ -581,6 +581,7 @@ int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles, const char* di { double const compressibility = (double)g_compressibilityDefault / 100; + if (cLevel < 1) cLevel = 1; /* minimum compression level */ if (cLevel > ZSTD_maxCLevel()) cLevel = ZSTD_maxCLevel(); if (cLevelLast > ZSTD_maxCLevel()) cLevelLast = ZSTD_maxCLevel(); if (cLevelLast < cLevel) cLevelLast = cLevel; diff --git a/programs/zstdcli.c b/programs/zstdcli.c index a7b4fddc8..050d7a6a2 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -370,10 +370,12 @@ int main(int argCount, const char* argv[]) if (!strcmp(argument, "--keep")) { FIO_setRemoveSrcFile(0); continue; } if (!strcmp(argument, "--rm")) { FIO_setRemoveSrcFile(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; } +#endif /* long commands with arguments */ -#ifndef ZSTD_NODICT +#ifndef ZSTD_NODICT if (longCommandWArg(&argument, "--cover=")) { cover=1; if (!parseCoverParameters(argument, &coverParams)) CLEAN_RETURN(badusage(programName)); continue; diff --git a/tests/playTests.sh b/tests/playTests.sh index 88c0ecdfe..5933b14e6 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -304,11 +304,32 @@ $ECHO "\n**** benchmark mode tests **** " $ECHO "bench one file" ./datagen > tmp1 -$ZSTD -bi1 tmp1 +$ZSTD -bi0 tmp1 $ECHO "bench multiple levels" -$ZSTD -i1b1e3 tmp1 +$ZSTD -i0b0e3 tmp1 $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 **** " @@ -317,10 +338,10 @@ roundTripTest roundTripTest -g15K # TableID==3 roundTripTest -g127K # TableID==2 roundTripTest -g255K # TableID==1 -roundTripTest -g513K # TableID==0 -roundTripTest -g512K 6 # greedy, hash chain -roundTripTest -g512K 16 # btlazy2 -roundTripTest -g512K 19 # btopt +roundTripTest -g522K # TableID==0 +roundTripTest -g519K 6 # greedy, hash chain +roundTripTest -g517K 16 # btlazy2 +roundTripTest -g516K 19 # btopt rm tmp*