From: inikep Date: Wed, 25 May 2016 08:50:28 +0000 (+0200) Subject: playTests.sh joined with playTestsMSYS.sh X-Git-Tag: v0.7.0^2~54^2^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d589562fe93d517abf71aa8fc71c5cbb545d0cf;p=thirdparty%2Fzstd.git playTests.sh joined with playTestsMSYS.sh --- diff --git a/appveyor.yml b/appveyor.yml index c6f735ea3..4721fa951 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,12 @@ version: 1.0.{build} environment: matrix: + - COMPILER: "gcc" + MAKE_PARAMS: "test" + PLATFORM: "mingw64" + - COMPILER: "gcc" + MAKE_PARAMS: "test" + PLATFORM: "mingw32" - COMPILER: "visual" CONFIGURATION: "Release" PLATFORM: "Win32" @@ -13,12 +19,6 @@ environment: - COMPILER: "visual" CONFIGURATION: "Debug" PLATFORM: "x64" - - COMPILER: "gcc" - MAKE_PARAMS: "test" - PLATFORM: "mingw32" - - COMPILER: "gcc" - MAKE_PARAMS: "test" - PLATFORM: "mingw64" install: - ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION% diff --git a/programs/Makefile b/programs/Makefile index 11709300a..c4e19229a 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -155,9 +155,6 @@ clean: #------------------------------------------------------------------------ ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU)) HOST_OS = POSIX -zstd-playTests: datagen - ZSTD=$(ZSTD) ./tests/playTests.sh $(ZSTDRTTEST) - install: zstd @echo Installing binaries @install -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/ @@ -199,8 +196,6 @@ endif ifneq (,$(filter MSYS%,$(shell uname))) HOST_OS = MSYS -zstd-playTests: datagen - ZSTD=$(ZSTD) ./tests/playTestsMSYS.sh $(ZSTDRTTEST) endif @@ -208,6 +203,9 @@ endif #make tests validated only for MSYS, Linux, OSX, kFreeBSD and Hurd targets #------------------------------------------------------------------------ ifneq (,$(filter $(HOST_OS),MSYS POSIX)) +zstd-playTests: datagen + ZSTD=$(ZSTD) ./tests/playTests.sh $(ZSTDRTTEST) + test: test-zstd test-fullbench test-fuzzer test-zbuff test32: test-zstd32 test-fullbench32 test-fuzzer32 test-zbuff32 diff --git a/programs/tests/playTests.sh b/programs/tests/playTests.sh index 58455c0f9..dbeb916d0 100755 --- a/programs/tests/playTests.sh +++ b/programs/tests/playTests.sh @@ -1,7 +1,7 @@ #!/bin/sh -e die() { - echo "$@" 1>&2 + $ECHO "$@" 1>&2 exit 1 } @@ -14,34 +14,44 @@ roundTripTest() { fi rm -f tmp1 tmp2 - echo "roundTripTest: ./datagen $1 $p | $ZSTD -v$c | $ZSTD -d" + $ECHO "roundTripTest: ./datagen $1 $p | $ZSTD -v$c | $ZSTD -d" ./datagen $1 $p | md5sum > tmp1 ./datagen $1 $p | $ZSTD -vq$c | $ZSTD -d | md5sum > tmp2 diff -q tmp1 tmp2 } -[ -n "$ZSTD" ] || die "ZSTD variable must be defined!" +isWindows=false +ECHO="echo" +if [[ "$OS" == "Windows"* ]]; then + isWindows=true + ECHO="echo -e" +fi + +$ECHO "\nStarting playTests.sh isWindows=$isWindows" +[ -n "$ZSTD" ] || die "ZSTD variable must be defined!" -echo "\n**** simple tests **** " +$ECHO "\n**** simple tests **** " ./datagen > tmp $ZSTD -f tmp # trivial compression case, creates tmp.zst $ZSTD -df tmp.zst # trivial decompression case (overwrites tmp) -echo "test : too large compression level (must fail)" +$ECHO "test : too large compression level (must fail)" $ZSTD -99 tmp && die "too large compression level undetected" -echo "test : compress to stdout" +$ECHO "test : compress to stdout" $ZSTD tmp -c > tmpCompressed $ZSTD tmp --stdout > tmpCompressed # long command format -echo "test : null-length file roundtrip" -echo -n '' | $ZSTD - --stdout | $ZSTD -d --stdout -echo "test : decompress file with wrong suffix (must fail)" +$ECHO "test : null-length file roundtrip" +$ECHO -n '' | $ZSTD - --stdout | $ZSTD -d --stdout +$ECHO "test : decompress file with wrong suffix (must fail)" $ZSTD -d tmpCompressed && die "wrong suffix error not detected!" $ZSTD -d tmpCompressed -c > tmpResult # decompression using stdout $ZSTD --decompress tmpCompressed -c > tmpResult $ZSTD --decompress tmpCompressed --stdout > tmpResult -$ZSTD -d < tmp.zst > /dev/null # combine decompression, stdin & stdout -$ZSTD -d - < tmp.zst > /dev/null +if [ "$isWindows" = false ] ; then + $ZSTD -d < tmp.zst > /dev/null # combine decompression, stdin & stdout + $ZSTD -d - < tmp.zst > /dev/null +fi $ZSTD -dc < tmp.zst > /dev/null $ZSTD -dc - < tmp.zst > /dev/null $ZSTD -q tmp && die "overwrite check failed!" @@ -50,15 +60,15 @@ $ZSTD -q --force tmp $ZSTD -df tmp && die "should have refused : wrong extension" -echo "\n**** Pass-Through mode **** " -echo "Hello world !" | $ZSTD -df -echo "Hello world !" | $ZSTD -dcf +$ECHO "\n**** Pass-Through mode **** " +$ECHO "Hello world !" | $ZSTD -df +$ECHO "Hello world !" | $ZSTD -dcf -echo "\n**** frame concatenation **** " +$ECHO "\n**** frame concatenation **** " -echo "hello " > hello.tmp -echo "world!" > world.tmp +$ECHO "hello " > hello.tmp +$ECHO "world!" > world.tmp cat hello.tmp world.tmp > helloworld.tmp $ZSTD -c hello.tmp > hello.zstd $ZSTD -c world.tmp > world.zstd @@ -67,18 +77,20 @@ $ZSTD -dc helloworld.zstd > result.tmp cat result.tmp sdiff helloworld.tmp result.tmp rm ./*.tmp ./*.zstd -echo "frame concatenation tests completed" +$ECHO "frame concatenation tests completed" -echo "\n**** flush write error test **** " +if [ "$isWindows" = false ] ; then +$ECHO "\n**** flush write error test **** " -echo "echo foo | $ZSTD > /dev/full" -echo foo | $ZSTD > /dev/full && die "write error not detected!" -echo "echo foo | $ZSTD | $ZSTD -d > /dev/full" -echo foo | $ZSTD | $ZSTD -d > /dev/full && die "write error not detected!" +$ECHO "$ECHO foo | $ZSTD > /dev/full" +$ECHO foo | $ZSTD > /dev/full && die "write error not detected!" +$ECHO "$ECHO foo | $ZSTD | $ZSTD -d > /dev/full" +$ECHO foo | $ZSTD | $ZSTD -d > /dev/full && die "write error not detected!" +fi -echo "\n**** test sparse file support **** " +$ECHO "\n**** test sparse file support **** " ./datagen -g5M -P100 > tmpSparse $ZSTD tmpSparse -c | $ZSTD -dv -o tmpSparseRegen @@ -91,10 +103,10 @@ ls -ls tmpSparse* ./datagen -s1 -g1200007 -P100 | $ZSTD | $ZSTD -dv --sparse -c > tmpSparseOdd # Odd size file (to not finish on an exact nb of blocks) ./datagen -s1 -g1200007 -P100 | diff -s - tmpSparseOdd ls -ls tmpSparseOdd -echo "\n Sparse Compatibility with Console :" -echo "Hello World 1 !" | $ZSTD | $ZSTD -d -c -echo "Hello World 2 !" | $ZSTD | $ZSTD -d | cat -echo "\n Sparse Compatibility with Append :" +$ECHO "\n Sparse Compatibility with Console :" +$ECHO "Hello World 1 !" | $ZSTD | $ZSTD -d -c +$ECHO "Hello World 2 !" | $ZSTD | $ZSTD -d | cat +$ECHO "\n Sparse Compatibility with Append :" ./datagen -P100 -g1M > tmpSparse1M cat tmpSparse1M tmpSparse1M > tmpSparse2M $ZSTD -v -f tmpSparse1M -o tmpSparseCompressed @@ -105,7 +117,7 @@ diff tmpSparse2M tmpSparseRegenerated # rm tmpSparse* -echo "\n**** dictionary tests **** " +$ECHO "\n**** dictionary tests **** " ./datagen > tmpDict ./datagen -g1M | md5sum > tmp1 @@ -117,41 +129,41 @@ $ZSTD -d tmp -D tmpDict -of result diff xxhash.c result -echo "\n**** multiple files tests **** " +$ECHO "\n**** multiple files tests **** " ./datagen -s1 > tmp1 2> /dev/null ./datagen -s2 -g100K > tmp2 2> /dev/null ./datagen -s3 -g1M > tmp3 2> /dev/null $ZSTD -f tmp* -echo "compress tmp* : " +$ECHO "compress tmp* : " ls -ls tmp* rm tmp1 tmp2 tmp3 -echo "decompress tmp* : " +$ECHO "decompress tmp* : " $ZSTD -df *.zst ls -ls tmp* -echo "compress tmp* into stdout > tmpall : " +$ECHO "compress tmp* into stdout > tmpall : " $ZSTD -c tmp1 tmp2 tmp3 > tmpall ls -ls tmp* -echo "decompress tmpall* into stdout > tmpdec : " +$ECHO "decompress tmpall* into stdout > tmpdec : " cp tmpall tmpall2 $ZSTD -dc tmpall* > tmpdec ls -ls tmp* -echo "compress multiple files including a missing one (notHere) : " +$ECHO "compress multiple files including a missing one (notHere) : " $ZSTD -f tmp1 notHere tmp2 && die "missing file not detected!" -echo "\n**** integrity tests **** " +$ECHO "\n**** integrity tests **** " -echo "test one file (tmp1.zst) " +$ECHO "test one file (tmp1.zst) " $ZSTD -t tmp1.zst $ZSTD --test tmp1.zst -echo "test multiple files (*.zst) " +$ECHO "test multiple files (*.zst) " $ZSTD -t *.zst -echo "test good and bad files (*) " +$ECHO "test good and bad files (*) " $ZSTD -t * && die "bad files not detected !" -echo "\n**** zstd round-trip tests **** " +$ECHO "\n**** zstd round-trip tests **** " roundTripTest roundTripTest -g15K # TableID==3 @@ -165,7 +177,7 @@ roundTripTest -g512K 19 # btopt rm tmp* if [ "$1" != "--test-large-data" ]; then - echo "Skipping large data tests" + $ECHO "Skipping large data tests" exit 0 fi diff --git a/programs/tests/playTestsMSYS.sh b/programs/tests/playTestsMSYS.sh deleted file mode 100755 index 3d5a0e842..000000000 --- a/programs/tests/playTestsMSYS.sh +++ /dev/null @@ -1,190 +0,0 @@ -#!/bin/sh -e - -die() { - echo "$@" 1>&2 - exit 1 -} - -roundTripTest() { - if [ -n "$3" ]; then - local c="$3" - local p="$2" - else - local c="$2" - fi - - rm -f tmp1 tmp2 - echo "roundTripTest: ./datagen $1 $p | $ZSTD -v$c | $ZSTD -d" - ./datagen $1 $p | md5sum > tmp1 - ./datagen $1 $p | $ZSTD -vq$c | $ZSTD -d | md5sum > tmp2 - fc tmp1 tmp2 -} - -[ -n "$ZSTD" ] || die "ZSTD variable must be defined!" - - -echo -e "\n**** simple tests **** " -./datagen > tmp -$ZSTD -f tmp # trivial compression case, creates tmp.zst -$ZSTD -df tmp.zst # trivial decompression case (overwrites tmp) -echo "test : too large compression level (must fail)" -$ZSTD -99 tmp && die "too large compression level undetected" -echo "test : compress to stdout" -$ZSTD tmp -c > tmpCompressed -$ZSTD tmp --stdout > tmpCompressed # long command format -echo "test : null-length file roundtrip" -echo -n '' | $ZSTD - --stdout | $ZSTD -d --stdout -echo "test : decompress file with wrong suffix (must fail)" -$ZSTD -d tmpCompressed && die "wrong suffix error not detected!" -$ZSTD -d tmpCompressed -c > tmpResult # decompression using stdout -$ZSTD --decompress tmpCompressed -c > tmpResult -$ZSTD --decompress tmpCompressed --stdout > tmpResult -#$ZSTD -d < tmp.zst > /dev/null # combine decompression, stdin & stdout -#$ZSTD -d - < tmp.zst > /dev/null -$ZSTD -dc < tmp.zst > /dev/null -$ZSTD -dc - < tmp.zst > /dev/null -$ZSTD -q tmp && die "overwrite check failed!" -$ZSTD -q -f tmp -$ZSTD -q --force tmp -$ZSTD -df tmp && die "should have refused : wrong extension" - - -echo -e "\n**** Pass-Through mode **** " -echo "Hello world !" | $ZSTD -df -echo "Hello world !" | $ZSTD -dcf - - -echo -e "\n**** frame concatenation **** " - -echo "hello " > hello.tmp -echo "world!" > world.tmp -cat hello.tmp world.tmp > helloworld.tmp -$ZSTD -c hello.tmp > hello.zstd -$ZSTD -c world.tmp > world.zstd -cat hello.zstd world.zstd > helloworld.zstd -$ZSTD -dc helloworld.zstd > result.tmp -cat result.tmp -fc helloworld.tmp result.tmp -rm ./*.tmp ./*.zstd - -echo frame concatenation tests completed - - -echo -e "\n**** test sparse file support **** " - -./datagen -g5M -P100 > tmpSparse -$ZSTD tmpSparse -c | $ZSTD -dv -o tmpSparseRegen -fc tmpSparse tmpSparseRegen -$ZSTD tmpSparse -c | $ZSTD -dv --sparse -c > tmpOutSparse -fc tmpSparse tmpOutSparse -$ZSTD tmpSparse -c | $ZSTD -dv --no-sparse -c > tmpOutNoSparse -fc tmpSparse tmpOutNoSparse -ls -ls tmpSparse* -./datagen -s1 -g1200007 -P100 | $ZSTD | $ZSTD -dv --sparse -c > tmpSparseOdd # Odd size file (to not finish on an exact nb of blocks) -./datagen -s1 -g1200007 -P100 | fc - tmpSparseOdd -ls -ls tmpSparseOdd -echo -e "\n Sparse Compatibility with Console :" -echo "Hello World 1 !" | $ZSTD | $ZSTD -d -c -echo "Hello World 2 !" | $ZSTD | $ZSTD -d | cat -echo -e "\n Sparse Compatibility with Append :" -./datagen -P100 -g1M > tmpSparse1M -cat tmpSparse1M tmpSparse1M > tmpSparse2M -$ZSTD -v -f tmpSparse1M -o tmpSparseCompressed -$ZSTD -d -v -f tmpSparseCompressed -o tmpSparseRegenerated -$ZSTD -d -v -f tmpSparseCompressed -c >> tmpSparseRegenerated -ls -ls tmpSparse* -fc tmpSparse2M tmpSparseRegenerated - - - -echo -e "\n**** dictionary tests **** " - -./datagen > tmpDict -./datagen -g1M | md5sum > tmp1 -./datagen -g1M | $ZSTD -D tmpDict | $ZSTD -D tmpDict -dvq | md5sum > tmp2 -fc tmp1 tmp2 -$ZSTD --train *.c *.h -o tmpDict -$ZSTD xxhash.c -D tmpDict -of tmp -$ZSTD -d tmp -D tmpDict -of result -fc xxhash.c result - - -echo -e "\n**** multiple files tests **** " - -./datagen -s1 > tmp1 2> /dev/null -./datagen -s2 -g100K > tmp2 2> /dev/null -./datagen -s3 -g1M > tmp3 2> /dev/null -$ZSTD -f tmp* -echo "compress tmp* : " -ls -ls tmp* -rm tmp1 tmp2 tmp3 -echo "decompress tmp* : " -$ZSTD -df *.zst -ls -ls tmp* -echo "compress tmp* into stdout > tmpall : " -$ZSTD -c tmp1 tmp2 tmp3 > tmpall -ls -ls tmp* -echo "decompress tmpall* into stdout > tmpdec : " -cp tmpall tmpall2 -$ZSTD -dc tmpall* > tmpdec -ls -ls tmp* -echo "compress multiple files including a missing one (notHere) : " -$ZSTD -f tmp1 notHere tmp2 && die "missing file not detected!" - -echo -e "\n**** integrity tests **** " -echo "test one file (tmp1.zst) " -$ZSTD -t tmp1.zst -$ZSTD --test tmp1.zst -echo "test multiple files (*.zst) " -$ZSTD -t *.zst -echo "test good and bad files (*) " -$ZSTD -t * && die "bad files not detected !" - -echo -e "\n**** zstd round-trip tests **** " - -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 - -rm tmp* - -if [ "$1" != "--test-large-data" ]; then - echo "Skipping large data tests" - exit 0 -fi - -roundTripTest -g270000000 1 -roundTripTest -g270000000 2 -roundTripTest -g270000000 3 - -roundTripTest -g140000000 -P60 4 -roundTripTest -g140000000 -P60 5 -roundTripTest -g140000000 -P60 6 - -roundTripTest -g70000000 -P70 7 -roundTripTest -g70000000 -P70 8 -roundTripTest -g70000000 -P70 9 - -roundTripTest -g35000000 -P75 10 -roundTripTest -g35000000 -P75 11 -roundTripTest -g35000000 -P75 12 - -roundTripTest -g18000000 -P80 13 -roundTripTest -g18000000 -P80 14 -roundTripTest -g18000000 -P80 15 -roundTripTest -g18000000 -P80 16 -roundTripTest -g18000000 -P80 17 - -roundTripTest -g50000000 -P94 18 -roundTripTest -g50000000 -P94 19 - -roundTripTest -g99000000 -P99 20 -roundTripTest -g6000000000 -P99 1 - -rm tmp* -