From 2868d565e4b6efbcb48798b342b4803cb91376e0 Mon Sep 17 00:00:00 2001 From: inikep Date: Thu, 18 Aug 2016 13:18:11 +0200 Subject: [PATCH 01/10] test-related files moved to tests/ --- programs/Makefile | 136 +------------- tests/Makefile | 262 +++++++++++++++++++++++++-- {programs => tests}/datagencli.c | 0 {programs => tests}/fullbench.c | 0 {programs => tests}/fuzzer.c | 0 {programs => tests}/paramgrill.c | 0 {programs => tests}/playTests.sh | 0 {programs => tests}/roundTripCrash.c | 0 {programs => tests}/zbufftest.c | 0 {programs => tests}/zstreamtest.c | 0 10 files changed, 255 insertions(+), 143 deletions(-) rename {programs => tests}/datagencli.c (100%) rename {programs => tests}/fullbench.c (100%) rename {programs => tests}/fuzzer.c (100%) rename {programs => tests}/paramgrill.c (100%) rename {programs => tests}/playTests.sh (100%) mode change 100755 => 100644 rename {programs => tests}/roundTripCrash.c (100%) rename {programs => tests}/zbufftest.c (100%) rename {programs => tests}/zstreamtest.c (100%) diff --git a/programs/Makefile b/programs/Makefile index 9c70f868b..b9d04edcd 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -22,13 +22,11 @@ # - zstd homepage : http://www.zstd.net/ # ########################################################################## # zstd : Command Line Utility, supporting gzip-like arguments -# datagen : Synthetic and parametrable data generator, for tests -# fuzzer : Test tool, to check zstd integrity on target platform -# fuzzer32: Same as fuzzer, but forced to compile in 32-bits mode -# zbufftest : Test tool, to check ZBUFF integrity on target platform -# zbufftest32: Same as zbufftest, but forced to compile in 32-bits mode -# fullbench : Precisely measure speed for each zstd inner function -# fullbench32: Same as fullbench, but forced to compile in 32-bits mode +# zstd32 : Same as zstd, but forced to compile in 32-bits mode +# zstd_nolegacy : zstd without support of decompression of legacy versions +# zstd-small: minimal zstd without dictBuilder and bench +# zstd-compress: compressor-only version of zstd +# zstd-decompress: decompressor-only version of zstd # ########################################################################## DESTDIR?= @@ -56,7 +54,6 @@ ZSTDCOMMON_FILES := $(ZSTDDIR)/common/*.c ZSTDCOMP_FILES := $(ZSTDDIR)/compress/zstd_compress.c $(ZSTDDIR)/compress/fse_compress.c $(ZSTDDIR)/compress/huf_compress.c ZSTDDECOMP_FILES := $(ZSTDDIR)/decompress/huf_decompress.c ZSTD_FILES := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) -ZBUFF_FILES := $(ZSTDDIR)/compress/zbuff_compress.c $(ZSTDDIR)/decompress/zbuff_decompress.c ZDICT_FILES := $(ZSTDDIR)/dictBuilder/*.c ZSTDDECOMP_O = $(ZSTDDIR)/decompress/zstd_decompress.o ZSTDDECOMP32_O = $(ZSTDDIR)/decompress/zstd_decompress32.o @@ -80,17 +77,12 @@ EXT = VOID = /dev/null endif -ZBUFFTEST = -T2mn -FUZZERTEST= -T5mn -ZSTDRTTEST= --test-large-data -.PHONY: default all all32 clean install uninstall test test32 test-all +.PHONY: default all clean install uninstall default: zstd -all: zstd fullbench fuzzer zbufftest zstreamtest paramgrill datagen - -all32: cleano32 zstd32 fullbench32 fuzzer32 zbufftest32 zstreamtest32 +all: zstd $(ZSTDDECOMP_O): $(ZSTDDIR)/decompress/zstd_decompress.c @@ -136,58 +128,18 @@ zstd-decompress: $(ZSTDCOMMON_FILES) $(ZSTDDECOMP_FILES) \ zstd-small: clean CFLAGS="-Os -s" $(MAKE) zstd-frugal -fullbench : $(ZSTDDECOMP_O) $(ZSTD_FILES) $(ZBUFF_FILES) datagen.c fullbench.c - $(CC) $(FLAGS) $^ -o $@$(EXT) - -fullbench32 : $(ZSTDDECOMP32_O) $(ZSTD_FILES) $(ZBUFF_FILES) datagen.c fullbench.c - $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) - -fuzzer : CPPFLAGS += -I$(ZSTDDIR)/dictBuilder -fuzzer : $(ZSTDDECOMP_O) $(ZSTD_FILES) $(ZDICT_FILES) datagen.c fuzzer.c - $(CC) $(FLAGS) $^ -o $@$(EXT) - -fuzzer32 : CPPFLAGS += -I$(ZSTDDIR)/dictBuilder -fuzzer32 : $(ZSTDDECOMP32_O) $(ZSTD_FILES) $(ZDICT_FILES) datagen.c fuzzer.c - $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) - -zbufftest : $(ZSTDDECOMP_O) $(ZSTD_FILES) $(ZBUFF_FILES) datagen.c zbufftest.c - $(CC) $(FLAGS) $^ -o $@$(EXT) - -zbufftest32 : $(ZSTDDECOMP32_O) $(ZSTD_FILES) $(ZBUFF_FILES) datagen.c zbufftest.c - $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) - -zstreamtest : $(ZSTDDECOMP_O) $(ZSTD_FILES) datagen.c zstreamtest.c - $(CC) $(FLAGS) $^ -o $@$(EXT) - -zstreamtest32 : $(ZSTDDECOMP32_O) $(ZSTD_FILES) datagen.c zstreamtest.c - $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) - -paramgrill : $(ZSTDDECOMP_O) $(ZSTD_FILES) datagen.c paramgrill.c - $(CC) $(FLAGS) $^ -lm -o $@$(EXT) - -datagen : datagen.c datagencli.c - $(CC) $(FLAGS) $^ -o $@$(EXT) - -roundTripCrash : $(ZSTDDECOMP_O) $(ZSTD_FILES) roundTripCrash.c - $(CC) $(FLAGS) $^ -o $@$(EXT) clean: $(MAKE) -C ../lib clean @rm -f core *.o tmp* result* *.gcda dictionary *.zst \ - zstd$(EXT) zstd32$(EXT) zstd-compress$(EXT) zstd-decompress$(EXT) \ - fullbench$(EXT) fullbench32$(EXT) \ - fuzzer$(EXT) fuzzer32$(EXT) zbufftest$(EXT) zbufftest32$(EXT) \ - datagen$(EXT) paramgrill$(EXT) roundTripCrash$(EXT) + zstd$(EXT) zstd32$(EXT) zstd-compress$(EXT) zstd-decompress$(EXT) @echo Cleaning completed -cleano32: - @rm -f ../lib/decompress/*.o #---------------------------------------------------------------------------------- #make install is validated only for Linux, OSX, kFreeBSD, Hurd and some BSD targets #---------------------------------------------------------------------------------- ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly)) -HOST_OS = POSIX install: zstd @echo Installing binaries @install -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/ @@ -208,76 +160,4 @@ uninstall: rm -f $(DESTDIR)$(MANDIR)/unzstd.1 [ -f $(DESTDIR)$(MANDIR)/zstd.1 ] && rm -f $(DESTDIR)$(MANDIR)/zstd.1 @echo zstd programs successfully uninstalled - -valgrindTest: VALGRIND = valgrind --leak-check=full --error-exitcode=1 -valgrindTest: zstd datagen fuzzer fullbench zbufftest - @echo "\n ---- valgrind tests : memory analyzer ----" - $(VALGRIND) ./datagen -g50M > $(VOID) - $(VALGRIND) ./zstd ; if [ $$? -eq 0 ] ; then echo "zstd without argument should have failed"; false; fi - ./datagen -g80 | $(VALGRIND) ./zstd - -c > $(VOID) - ./datagen -g16KB | $(VALGRIND) ./zstd -vf - -o $(VOID) - ./datagen -g2930KB | $(VALGRIND) ./zstd -5 -vf - -o tmp - $(VALGRIND) ./zstd -vdf tmp -o $(VOID) - ./datagen -g64MB | $(VALGRIND) ./zstd -vf - -o $(VOID) - @rm tmp - $(VALGRIND) ./fuzzer -T1mn -t1 - $(VALGRIND) ./fullbench -i1 - $(VALGRIND) ./zbufftest -T1mn - -endif - - -ifneq (,$(filter MSYS%,$(shell uname))) -HOST_OS = MSYS -endif - - -#------------------------------------------------------------------------ -#make tests validated only for MSYS, Linux, OSX, kFreeBSD and Hurd targets -#------------------------------------------------------------------------ -ifneq (,$(filter $(HOST_OS),MSYS POSIX)) -zstd-playTests: datagen - ZSTD=$(ZSTD) ./playTests.sh $(ZSTDRTTEST) - -test: test-zstd test-fullbench test-fuzzer test-zbuff test-zstream - -test32: test-zstd32 test-fullbench32 test-fuzzer32 test-zbuff32 test-zstream32 - -test-all: test test32 valgrindTest - -test-zstd: ZSTD = ./zstd -test-zstd: zstd zstd-playTests - -test-zstd32: ZSTD = ./zstd32 -test-zstd32: zstd32 zstd-playTests - -test-zstd_nolegacy: ZSTD = ./zstd -test-zstd_nolegacy: zstd_nolegacy zstd-playTests - -test-fullbench: fullbench datagen - ./fullbench -i1 - ./fullbench -i1 -P0 - -test-fullbench32: fullbench32 datagen - ./fullbench32 -i1 - ./fullbench32 -i1 -P0 - -test-fuzzer: fuzzer - ./fuzzer $(FUZZERTEST) - -test-fuzzer32: fuzzer32 - ./fuzzer32 $(FUZZERTEST) - -test-zbuff: zbufftest - ./zbufftest $(ZBUFFTEST) - -test-zbuff32: zbufftest32 - ./zbufftest32 $(ZBUFFTEST) - -test-zstream: zstreamtest - ./zstreamtest $(ZBUFFTEST) - -test-zstream32: zstreamtest32 - ./zstreamtest32 $(ZBUFFTEST) - endif diff --git a/tests/Makefile b/tests/Makefile index d83a1dfc1..33db59e18 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,7 +1,6 @@ # ########################################################################## -# Zstd tests - Makefile +# ZSTD programs - Makefile # Copyright (C) Yann Collet 2015-2016 -# All rights reserved. # # GPL v2 License # @@ -20,27 +19,260 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # You can contact the author at : -# - ZSTD homepage : http://www.zstd.net/ +# - zstd homepage : http://www.zstd.net/ # ########################################################################## -# versionstest : Compatibility test between zstd versions stored on Github (v0.1+) +# zstd : Command Line Utility, supporting gzip-like arguments +# datagen : Synthetic and parametrable data generator, for tests +# fuzzer : Test tool, to check zstd integrity on target platform +# fuzzer32: Same as fuzzer, but forced to compile in 32-bits mode +# zbufftest : Test tool, to check ZBUFF integrity on target platform +# zbufftest32: Same as zbufftest, but forced to compile in 32-bits mode +# fullbench : Precisely measure speed for each zstd inner function +# fullbench32: Same as fullbench, but forced to compile in 32-bits mode # ########################################################################## -PYTHON ?= python3 -TESTARTEFACT := versionsTest namespaceTest +DESTDIR?= +PREFIX ?= /usr/local +BINDIR = $(PREFIX)/bin +MANDIR = $(PREFIX)/share/man/man1 -.PHONY: default all clean namespaceTest versionsTest +ZSTDDIR = ../lib -default: all +ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version "), 1) +ALIGN_LOOP = -falign-loops=32 +else +ALIGN_LOOP = +endif -all: namespaceTest versionsTest +CPPFLAGS= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/dictBuilder +CFLAGS ?= -O3 +CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 \ + -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef +CFLAGS += $(MOREFLAGS) +FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -namespaceTest: - if $(CC) namespaceTest.c ../lib/common/xxhash.c -o $@ ; then echo compilation should fail; exit 1 ; fi - $(RM) $@ -versionsTest: - $(PYTHON) test-zstd-versions.py +ZSTDCOMMON_FILES := $(ZSTDDIR)/common/*.c +ZSTDCOMP_FILES := $(ZSTDDIR)/compress/zstd_compress.c $(ZSTDDIR)/compress/fse_compress.c $(ZSTDDIR)/compress/huf_compress.c +ZSTDDECOMP_FILES := $(ZSTDDIR)/decompress/zstd_decompress.c $(ZSTDDIR)/decompress/huf_decompress.c +ZSTD_FILES := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) +ZBUFF_FILES := $(ZSTDDIR)/compress/zbuff_compress.c $(ZSTDDIR)/decompress/zbuff_decompress.c +ZDICT_FILES := $(ZSTDDIR)/dictBuilder/*.c +ZSTDDECOMP_O = + + +ifeq ($(ZSTD_LEGACY_SUPPORT), 0) +CPPFLAGS += -DZSTD_LEGACY_SUPPORT=0 +ZSTDLEGACY_FILES:= +else +ZSTD_LEGACY_SUPPORT:=1 +CPPFLAGS += -I$(ZSTDDIR)/legacy -I./legacy +ZSTDLEGACY_FILES:= $(ZSTDDIR)/legacy/*.c legacy/fileio_legacy.c +endif + + +# Define *.exe as extension for Windows systems +ifneq (,$(filter Windows%,$(OS))) +EXT =.exe +VOID = nul +else +EXT = +VOID = /dev/null +endif + +ZBUFFTEST = -T2mn +FUZZERTEST= -T5mn +ZSTDRTTEST= --test-large-data + +.PHONY: default all all32 clean install uninstall test test32 test-all + +default: zstd + +all: zstd fullbench fuzzer zbufftest zstreamtest paramgrill datagen + +all32: cleano32 zstd32 fullbench32 fuzzer32 zbufftest32 zstreamtest32 + + + +zstd : $(ZSTD_FILES) $(ZSTDLEGACY_FILES) $(ZDICT_FILES) \ + zstdcli.c fileio.c bench.c datagen.c dibio.c + $(CC) $(FLAGS) -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT) $^ -o $@$(EXT) + +zstd32 : $(ZSTD_FILES) $(ZSTDLEGACY_FILES) $(ZDICT_FILES) \ + zstdcli.c fileio.c bench.c datagen.c dibio.c + $(CC) -m32 $(FLAGS) -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT) $^ -o $@$(EXT) + + +zstd_nolegacy : + $(MAKE) zstd ZSTD_LEGACY_SUPPORT=0 + +zstd-pgo : MOREFLAGS = -fprofile-generate +zstd-pgo : clean zstd + ./zstd -b19i1 $(PROFILE_WITH) + ./zstd -b16i1 $(PROFILE_WITH) + ./zstd -b9i2 $(PROFILE_WITH) + ./zstd -b $(PROFILE_WITH) + ./zstd -b7i2 $(PROFILE_WITH) + ./zstd -b5 $(PROFILE_WITH) + rm zstd + $(MAKE) zstd MOREFLAGS=-fprofile-use + +zstd-frugal: $(ZSTD_FILES) zstdcli.c fileio.c + $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_LEGACY_SUPPORT=0 $^ -o zstd$(EXT) + +zstd-compress: $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) \ + zstdcli.c fileio.c + $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NODECOMPRESS -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) + +zstd-decompress: $(ZSTDCOMMON_FILES) $(ZSTDDECOMP_FILES) \ + zstdcli.c fileio.c + $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NOCOMPRESS -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) + +zstd-small: clean + CFLAGS="-Os -s" $(MAKE) zstd-frugal + +fullbench : $(ZSTD_FILES) $(ZBUFF_FILES) datagen.c fullbench.c + $(CC) $(FLAGS) $^ -o $@$(EXT) + +fullbench32 : $(ZSTD_FILES) $(ZBUFF_FILES) datagen.c fullbench.c + $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) + +fuzzer : CPPFLAGS += -I$(ZSTDDIR)/dictBuilder +fuzzer : $(ZSTD_FILES) $(ZDICT_FILES) datagen.c fuzzer.c + $(CC) $(FLAGS) $^ -o $@$(EXT) + +fuzzer32 : CPPFLAGS += -I$(ZSTDDIR)/dictBuilder +fuzzer32 : $(ZSTD_FILES) $(ZDICT_FILES) datagen.c fuzzer.c + $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) + +zbufftest : $(ZSTD_FILES) $(ZBUFF_FILES) datagen.c zbufftest.c + $(CC) $(FLAGS) $^ -o $@$(EXT) + +zbufftest32 : $(ZSTD_FILES) $(ZBUFF_FILES) datagen.c zbufftest.c + $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) + +zstreamtest : $(ZSTD_FILES) datagen.c zstreamtest.c + $(CC) $(FLAGS) $^ -o $@$(EXT) + +zstreamtest32 : $(ZSTD_FILES) datagen.c zstreamtest.c + $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) + +paramgrill : $(ZSTD_FILES) datagen.c paramgrill.c + $(CC) $(FLAGS) $^ -lm -o $@$(EXT) + +datagen : datagen.c datagencli.c + $(CC) $(FLAGS) $^ -o $@$(EXT) + +roundTripCrash : $(ZSTD_FILES) roundTripCrash.c + $(CC) $(FLAGS) $^ -o $@$(EXT) clean: - @$(RM) -fR $(TESTARTEFACT) + $(MAKE) -C ../lib clean + @rm -f core *.o tmp* result* *.gcda dictionary *.zst \ + zstd$(EXT) zstd32$(EXT) zstd-compress$(EXT) zstd-decompress$(EXT) \ + fullbench$(EXT) fullbench32$(EXT) \ + fuzzer$(EXT) fuzzer32$(EXT) zbufftest$(EXT) zbufftest32$(EXT) \ + datagen$(EXT) paramgrill$(EXT) roundTripCrash$(EXT) @echo Cleaning completed + +cleano32: + @rm -f ../lib/decompress/*.o + +#---------------------------------------------------------------------------------- +#make install is validated only for Linux, OSX, kFreeBSD, Hurd and some BSD targets +#---------------------------------------------------------------------------------- +ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly)) +HOST_OS = POSIX +install: zstd + @echo Installing binaries + @install -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/ + @install -m 755 zstd$(EXT) $(DESTDIR)$(BINDIR)/zstd$(EXT) + @ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/zstdcat + @ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/unzstd + @echo Installing man pages + @install -m 644 zstd.1 $(DESTDIR)$(MANDIR)/zstd.1 + @ln -sf zstd.1 $(DESTDIR)$(MANDIR)/zstdcat.1 + @ln -sf zstd.1 $(DESTDIR)$(MANDIR)/unzstd.1 + @echo zstd installation completed + +uninstall: + rm -f $(DESTDIR)$(BINDIR)/zstdcat + rm -f $(DESTDIR)$(BINDIR)/unzstd + [ -x $(DESTDIR)$(BINDIR)/zstd$(EXT) ] && rm -f $(DESTDIR)$(BINDIR)/zstd$(EXT) + rm -f $(DESTDIR)$(MANDIR)/zstdcat.1 + rm -f $(DESTDIR)$(MANDIR)/unzstd.1 + [ -f $(DESTDIR)$(MANDIR)/zstd.1 ] && rm -f $(DESTDIR)$(MANDIR)/zstd.1 + @echo zstd programs successfully uninstalled + +valgrindTest: VALGRIND = valgrind --leak-check=full --error-exitcode=1 +valgrindTest: zstd datagen fuzzer fullbench zbufftest + @echo "\n ---- valgrind tests : memory analyzer ----" + $(VALGRIND) ./datagen -g50M > $(VOID) + $(VALGRIND) ./zstd ; if [ $$? -eq 0 ] ; then echo "zstd without argument should have failed"; false; fi + ./datagen -g80 | $(VALGRIND) ./zstd - -c > $(VOID) + ./datagen -g16KB | $(VALGRIND) ./zstd -vf - -o $(VOID) + ./datagen -g2930KB | $(VALGRIND) ./zstd -5 -vf - -o tmp + $(VALGRIND) ./zstd -vdf tmp -o $(VOID) + ./datagen -g64MB | $(VALGRIND) ./zstd -vf - -o $(VOID) + @rm tmp + $(VALGRIND) ./fuzzer -T1mn -t1 + $(VALGRIND) ./fullbench -i1 + $(VALGRIND) ./zbufftest -T1mn + +endif + + +ifneq (,$(filter MSYS%,$(shell uname))) +HOST_OS = MSYS +endif + + +#------------------------------------------------------------------------ +#make tests validated only for MSYS, Linux, OSX, kFreeBSD and Hurd targets +#------------------------------------------------------------------------ +ifneq (,$(filter $(HOST_OS),MSYS POSIX)) +zstd-playTests: datagen + ZSTD=$(ZSTD) ./playTests.sh $(ZSTDRTTEST) + +test: test-zstd test-fullbench test-fuzzer test-zbuff test-zstream + +test32: test-zstd32 test-fullbench32 test-fuzzer32 test-zbuff32 test-zstream32 + +test-all: test test32 valgrindTest + +test-zstd: ZSTD = ./zstd +test-zstd: zstd zstd-playTests + +test-zstd32: ZSTD = ./zstd32 +test-zstd32: zstd32 zstd-playTests + +test-zstd_nolegacy: ZSTD = ./zstd +test-zstd_nolegacy: zstd_nolegacy zstd-playTests + +test-fullbench: fullbench datagen + ./fullbench -i1 + ./fullbench -i1 -P0 + +test-fullbench32: fullbench32 datagen + ./fullbench32 -i1 + ./fullbench32 -i1 -P0 + +test-fuzzer: fuzzer + ./fuzzer $(FUZZERTEST) + +test-fuzzer32: fuzzer32 + ./fuzzer32 $(FUZZERTEST) + +test-zbuff: zbufftest + ./zbufftest $(ZBUFFTEST) + +test-zbuff32: zbufftest32 + ./zbufftest32 $(ZBUFFTEST) + +test-zstream: zstreamtest + ./zstreamtest $(ZBUFFTEST) + +test-zstream32: zstreamtest32 + ./zstreamtest32 $(ZBUFFTEST) + +endif diff --git a/programs/datagencli.c b/tests/datagencli.c similarity index 100% rename from programs/datagencli.c rename to tests/datagencli.c diff --git a/programs/fullbench.c b/tests/fullbench.c similarity index 100% rename from programs/fullbench.c rename to tests/fullbench.c diff --git a/programs/fuzzer.c b/tests/fuzzer.c similarity index 100% rename from programs/fuzzer.c rename to tests/fuzzer.c diff --git a/programs/paramgrill.c b/tests/paramgrill.c similarity index 100% rename from programs/paramgrill.c rename to tests/paramgrill.c diff --git a/programs/playTests.sh b/tests/playTests.sh old mode 100755 new mode 100644 similarity index 100% rename from programs/playTests.sh rename to tests/playTests.sh diff --git a/programs/roundTripCrash.c b/tests/roundTripCrash.c similarity index 100% rename from programs/roundTripCrash.c rename to tests/roundTripCrash.c diff --git a/programs/zbufftest.c b/tests/zbufftest.c similarity index 100% rename from programs/zbufftest.c rename to tests/zbufftest.c diff --git a/programs/zstreamtest.c b/tests/zstreamtest.c similarity index 100% rename from programs/zstreamtest.c rename to tests/zstreamtest.c From a1c8115df59f1bb7e01b4529fca07f7a89cb3e13 Mon Sep 17 00:00:00 2001 From: inikep Date: Thu, 18 Aug 2016 13:35:36 +0200 Subject: [PATCH 02/10] improved tests\Makefile --- Makefile | 8 ++--- tests/Makefile | 81 +++++--------------------------------------------- 2 files changed, 11 insertions(+), 78 deletions(-) diff --git a/Makefile b/Makefile index 32f063f0c..0d5b1cc2a 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ PRGDIR = programs ZSTDDIR = lib ZWRAPDIR = zlibWrapper +TESTDIR = tests # Define nul output ifneq (,$(filter Windows%,$(OS))) @@ -47,9 +48,7 @@ default: zstd all: $(MAKE) -C $(ZSTDDIR) $@ - $(MAKE) -C $(PRGDIR) $@ - @rm -f lib/decompress/*.o - $(MAKE) -C $(PRGDIR) all32 + $(MAKE) -C $(PRGDIR) $@ zstd32 zstd: $(MAKE) -C $(PRGDIR) @@ -60,11 +59,12 @@ zlibwrapper: $(MAKE) -C $(ZWRAPDIR) all test: - $(MAKE) -C $(PRGDIR) $@ + $(MAKE) -C $(TESTDIR) $@ clean: @$(MAKE) -C $(ZSTDDIR) $@ > $(VOID) @$(MAKE) -C $(PRGDIR) $@ > $(VOID) + @$(MAKE) -C $(TESTDIR) $@ > $(VOID) @$(MAKE) -C $(ZWRAPDIR) $@ > $(VOID) @rm -f zstd @echo Cleaning completed diff --git a/tests/Makefile b/tests/Makefile index 33db59e18..bbe6f183a 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -35,14 +35,8 @@ DESTDIR?= PREFIX ?= /usr/local BINDIR = $(PREFIX)/bin MANDIR = $(PREFIX)/share/man/man1 - ZSTDDIR = ../lib -ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version "), 1) -ALIGN_LOOP = -falign-loops=32 -else -ALIGN_LOOP = -endif CPPFLAGS= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/dictBuilder CFLAGS ?= -O3 @@ -58,18 +52,8 @@ ZSTDDECOMP_FILES := $(ZSTDDIR)/decompress/zstd_decompress.c $(ZSTDDIR)/decompres ZSTD_FILES := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) ZBUFF_FILES := $(ZSTDDIR)/compress/zbuff_compress.c $(ZSTDDIR)/decompress/zbuff_decompress.c ZDICT_FILES := $(ZSTDDIR)/dictBuilder/*.c -ZSTDDECOMP_O = -ifeq ($(ZSTD_LEGACY_SUPPORT), 0) -CPPFLAGS += -DZSTD_LEGACY_SUPPORT=0 -ZSTDLEGACY_FILES:= -else -ZSTD_LEGACY_SUPPORT:=1 -CPPFLAGS += -I$(ZSTDDIR)/legacy -I./legacy -ZSTDLEGACY_FILES:= $(ZSTDDIR)/legacy/*.c legacy/fileio_legacy.c -endif - # Define *.exe as extension for Windows systems ifneq (,$(filter Windows%,$(OS))) @@ -90,46 +74,17 @@ default: zstd all: zstd fullbench fuzzer zbufftest zstreamtest paramgrill datagen -all32: cleano32 zstd32 fullbench32 fuzzer32 zbufftest32 zstreamtest32 +all32: zstd32 fullbench32 fuzzer32 zbufftest32 zstreamtest32 -zstd : $(ZSTD_FILES) $(ZSTDLEGACY_FILES) $(ZDICT_FILES) \ +zstd : $(ZSTD_FILES) $(ZDICT_FILES) \ zstdcli.c fileio.c bench.c datagen.c dibio.c - $(CC) $(FLAGS) -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT) $^ -o $@$(EXT) + $(CC) $(FLAGS) -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) -zstd32 : $(ZSTD_FILES) $(ZSTDLEGACY_FILES) $(ZDICT_FILES) \ +zstd32 : $(ZSTD_FILES) $(ZDICT_FILES) \ zstdcli.c fileio.c bench.c datagen.c dibio.c - $(CC) -m32 $(FLAGS) -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT) $^ -o $@$(EXT) - - -zstd_nolegacy : - $(MAKE) zstd ZSTD_LEGACY_SUPPORT=0 - -zstd-pgo : MOREFLAGS = -fprofile-generate -zstd-pgo : clean zstd - ./zstd -b19i1 $(PROFILE_WITH) - ./zstd -b16i1 $(PROFILE_WITH) - ./zstd -b9i2 $(PROFILE_WITH) - ./zstd -b $(PROFILE_WITH) - ./zstd -b7i2 $(PROFILE_WITH) - ./zstd -b5 $(PROFILE_WITH) - rm zstd - $(MAKE) zstd MOREFLAGS=-fprofile-use - -zstd-frugal: $(ZSTD_FILES) zstdcli.c fileio.c - $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_LEGACY_SUPPORT=0 $^ -o zstd$(EXT) - -zstd-compress: $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) \ - zstdcli.c fileio.c - $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NODECOMPRESS -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) - -zstd-decompress: $(ZSTDCOMMON_FILES) $(ZSTDDECOMP_FILES) \ - zstdcli.c fileio.c - $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NOCOMPRESS -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) - -zstd-small: clean - CFLAGS="-Os -s" $(MAKE) zstd-frugal + $(CC) -m32 $(FLAGS) -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) fullbench : $(ZSTD_FILES) $(ZBUFF_FILES) datagen.c fullbench.c $(CC) $(FLAGS) $^ -o $@$(EXT) @@ -169,40 +124,18 @@ roundTripCrash : $(ZSTD_FILES) roundTripCrash.c clean: $(MAKE) -C ../lib clean @rm -f core *.o tmp* result* *.gcda dictionary *.zst \ - zstd$(EXT) zstd32$(EXT) zstd-compress$(EXT) zstd-decompress$(EXT) \ + zstd$(EXT) zstd32$(EXT) \ fullbench$(EXT) fullbench32$(EXT) \ fuzzer$(EXT) fuzzer32$(EXT) zbufftest$(EXT) zbufftest32$(EXT) \ datagen$(EXT) paramgrill$(EXT) roundTripCrash$(EXT) @echo Cleaning completed -cleano32: - @rm -f ../lib/decompress/*.o #---------------------------------------------------------------------------------- -#make install is validated only for Linux, OSX, kFreeBSD, Hurd and some BSD targets +#make valgrindTest is validated only for Linux, OSX, kFreeBSD, Hurd and some BSD targets #---------------------------------------------------------------------------------- ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly)) HOST_OS = POSIX -install: zstd - @echo Installing binaries - @install -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/ - @install -m 755 zstd$(EXT) $(DESTDIR)$(BINDIR)/zstd$(EXT) - @ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/zstdcat - @ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/unzstd - @echo Installing man pages - @install -m 644 zstd.1 $(DESTDIR)$(MANDIR)/zstd.1 - @ln -sf zstd.1 $(DESTDIR)$(MANDIR)/zstdcat.1 - @ln -sf zstd.1 $(DESTDIR)$(MANDIR)/unzstd.1 - @echo zstd installation completed - -uninstall: - rm -f $(DESTDIR)$(BINDIR)/zstdcat - rm -f $(DESTDIR)$(BINDIR)/unzstd - [ -x $(DESTDIR)$(BINDIR)/zstd$(EXT) ] && rm -f $(DESTDIR)$(BINDIR)/zstd$(EXT) - rm -f $(DESTDIR)$(MANDIR)/zstdcat.1 - rm -f $(DESTDIR)$(MANDIR)/unzstd.1 - [ -f $(DESTDIR)$(MANDIR)/zstd.1 ] && rm -f $(DESTDIR)$(MANDIR)/zstd.1 - @echo zstd programs successfully uninstalled valgrindTest: VALGRIND = valgrind --leak-check=full --error-exitcode=1 valgrindTest: zstd datagen fuzzer fullbench zbufftest From 2d5eb2beb967af322f629fb4edb9b90dfd08c577 Mon Sep 17 00:00:00 2001 From: inikep Date: Thu, 18 Aug 2016 13:53:26 +0200 Subject: [PATCH 03/10] updated .travis.yml and appveyor.yml for tests/ --- .travis.yml | 6 ++--- Makefile | 21 ++++++++-------- appveyor.yml | 2 +- tests/Makefile | 68 +++++++++++++++++++++++++------------------------- 4 files changed, 49 insertions(+), 48 deletions(-) diff --git a/.travis.yml b/.travis.yml index 42f0043b2..350fc1e6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ matrix: env: PLATFORM="Ubuntu 12.04 container" CMD="make test && make clean && make travis-install" - os: linux sudo: false - env: PLATFORM="Ubuntu 12.04 container" CMD="make -C programs test-zstd_nolegacy && make clean && make zlibwrapper && make clean && make cmaketest" + env: PLATFORM="Ubuntu 12.04 container" CMD="make -C tests test-zstd_nolegacy && make clean && make zlibwrapper && make clean && make cmaketest" - os: linux sudo: false env: PLATFORM="Ubuntu 12.04 container" CMD="make usan" @@ -39,7 +39,7 @@ matrix: - qemu-user-static - os: linux sudo: required - env: PLATFORM="Ubuntu 12.04" CMD="make -C programs test32" + env: PLATFORM="Ubuntu 12.04" CMD="make -C tests test32" addons: apt: packages: @@ -58,7 +58,7 @@ matrix: - gcc-multilib - os: linux sudo: required - env: PLATFORM="Ubuntu 12.04" CMD="make -C programs valgrindTest" + env: PLATFORM="Ubuntu 12.04" CMD="make -C tests valgrindTest" addons: apt: packages: diff --git a/Makefile b/Makefile index 0d5b1cc2a..a6b2fb42e 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,7 @@ default: zstd all: $(MAKE) -C $(ZSTDDIR) $@ $(MAKE) -C $(PRGDIR) $@ zstd32 + $(MAKE) -C $(TESTDIR) $@ all32 zstd: $(MAKE) -C $(PRGDIR) @@ -102,16 +103,16 @@ clangtest: clean $(MAKE) all CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion" armtest: clean - $(MAKE) -C $(PRGDIR) datagen # use native, faster - $(MAKE) -C $(PRGDIR) test CC=arm-linux-gnueabi-gcc ZSTDRTTEST= MOREFLAGS="-Werror -static" + $(MAKE) -C $(TESTDIR) datagen # use native, faster + $(MAKE) -C $(TESTDIR) test CC=arm-linux-gnueabi-gcc ZSTDRTTEST= MOREFLAGS="-Werror -static" ppctest: clean - $(MAKE) -C $(PRGDIR) datagen # use native, faster - $(MAKE) -C $(PRGDIR) test CC=powerpc-linux-gnu-gcc ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static" + $(MAKE) -C $(TESTDIR) datagen # use native, faster + $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static" ppc64test: clean - $(MAKE) -C $(PRGDIR) datagen # use native, faster - $(MAKE) -C $(PRGDIR) test CC=powerpc-linux-gnu-gcc ZSTDRTTEST= MOREFLAGS="-m64 -static" + $(MAKE) -C $(TESTDIR) datagen # use native, faster + $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc ZSTDRTTEST= MOREFLAGS="-m64 -static" usan: clean $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=undefined" @@ -123,7 +124,7 @@ msan: clean $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=memory -fno-omit-frame-pointer" # datagen.c fails this test for no obvious reason asan32: clean - $(MAKE) -C $(PRGDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address" + $(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address" uasan: clean $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address -fsanitize=undefined" @@ -163,13 +164,13 @@ c11test: clean CFLAGS="-std=c11" $(MAKE) all bmix64test: clean - CFLAGS="-O3 -mbmi -Werror" $(MAKE) -C $(PRGDIR) test + CFLAGS="-O3 -mbmi -Werror" $(MAKE) -C $(TESTDIR) test bmix32test: clean - CFLAGS="-O3 -mbmi -mx32 -Werror" $(MAKE) -C $(PRGDIR) test + CFLAGS="-O3 -mbmi -mx32 -Werror" $(MAKE) -C $(TESTDIR) test bmi32test: clean - CFLAGS="-O3 -mbmi -m32 -Werror" $(MAKE) -C $(PRGDIR) test + CFLAGS="-O3 -mbmi -m32 -Werror" $(MAKE) -C $(TESTDIR) test staticAnalyze: clean CPPFLAGS=-g scan-build --status-bugs -v $(MAKE) all diff --git a/appveyor.yml b/appveyor.yml index 03fb79306..4b4ef6c6a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,7 +24,7 @@ install: - ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION% - if [%COMPILER%]==[gcc] SET PATH_ORIGINAL=%PATH% - if [%COMPILER%]==[gcc] ( - SET "CLANG_PARAMS=-C programs zstd fullbench fuzzer zbufftest paramgrill datagen CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion"" && + SET "CLANG_PARAMS=-C tests zstd fullbench fuzzer zbufftest paramgrill datagen CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion"" && SET "PATH_MINGW32=c:\MinGW\bin;c:\MinGW\usr\bin" && SET "PATH_MINGW64=c:\msys64\mingw64\bin;c:\msys64\usr\bin" && COPY C:\MinGW\bin\mingw32-make.exe C:\MinGW\bin\make.exe && diff --git a/tests/Makefile b/tests/Makefile index bbe6f183a..e0689ce67 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,5 +1,5 @@ # ########################################################################## -# ZSTD programs - Makefile +# ZSTD tests - Makefile # Copyright (C) Yann Collet 2015-2016 # # GPL v2 License @@ -21,7 +21,6 @@ # You can contact the author at : # - zstd homepage : http://www.zstd.net/ # ########################################################################## -# zstd : Command Line Utility, supporting gzip-like arguments # datagen : Synthetic and parametrable data generator, for tests # fuzzer : Test tool, to check zstd integrity on target platform # fuzzer32: Same as fuzzer, but forced to compile in 32-bits mode @@ -36,9 +35,9 @@ PREFIX ?= /usr/local BINDIR = $(PREFIX)/bin MANDIR = $(PREFIX)/share/man/man1 ZSTDDIR = ../lib +PRGDIR = ../programs - -CPPFLAGS= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/dictBuilder +CPPFLAGS= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/dictBuilder -I$(PRGDIR) CFLAGS ?= -O3 CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 \ -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef @@ -68,54 +67,55 @@ ZBUFFTEST = -T2mn FUZZERTEST= -T5mn ZSTDRTTEST= --test-large-data -.PHONY: default all all32 clean install uninstall test test32 test-all +.PHONY: default all all32 clean test test32 test-all -default: zstd +default: fullbench -all: zstd fullbench fuzzer zbufftest zstreamtest paramgrill datagen +all: fullbench fuzzer zbufftest zstreamtest paramgrill datagen -all32: zstd32 fullbench32 fuzzer32 zbufftest32 zstreamtest32 +all32: fullbench32 fuzzer32 zbufftest32 zstreamtest32 -zstd : $(ZSTD_FILES) $(ZDICT_FILES) \ - zstdcli.c fileio.c bench.c datagen.c dibio.c - $(CC) $(FLAGS) -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) +zstd: + $(MAKE) -C $(PRGDIR) $@ -zstd32 : $(ZSTD_FILES) $(ZDICT_FILES) \ - zstdcli.c fileio.c bench.c datagen.c dibio.c - $(CC) -m32 $(FLAGS) -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) +zstd32: + $(MAKE) -C $(PRGDIR) $@ -fullbench : $(ZSTD_FILES) $(ZBUFF_FILES) datagen.c fullbench.c +zstd_nolegacy: + $(MAKE) -C $(PRGDIR) $@ + +fullbench : $(ZSTD_FILES) $(ZBUFF_FILES) $(PRGDIR)/datagen.c fullbench.c $(CC) $(FLAGS) $^ -o $@$(EXT) -fullbench32 : $(ZSTD_FILES) $(ZBUFF_FILES) datagen.c fullbench.c +fullbench32 : $(ZSTD_FILES) $(ZBUFF_FILES) $(PRGDIR)/datagen.c fullbench.c $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) fuzzer : CPPFLAGS += -I$(ZSTDDIR)/dictBuilder -fuzzer : $(ZSTD_FILES) $(ZDICT_FILES) datagen.c fuzzer.c +fuzzer : $(ZSTD_FILES) $(ZDICT_FILES) $(PRGDIR)/datagen.c fuzzer.c $(CC) $(FLAGS) $^ -o $@$(EXT) fuzzer32 : CPPFLAGS += -I$(ZSTDDIR)/dictBuilder -fuzzer32 : $(ZSTD_FILES) $(ZDICT_FILES) datagen.c fuzzer.c +fuzzer32 : $(ZSTD_FILES) $(ZDICT_FILES) $(PRGDIR)/datagen.c fuzzer.c $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) -zbufftest : $(ZSTD_FILES) $(ZBUFF_FILES) datagen.c zbufftest.c +zbufftest : $(ZSTD_FILES) $(ZBUFF_FILES) $(PRGDIR)/datagen.c zbufftest.c $(CC) $(FLAGS) $^ -o $@$(EXT) -zbufftest32 : $(ZSTD_FILES) $(ZBUFF_FILES) datagen.c zbufftest.c +zbufftest32 : $(ZSTD_FILES) $(ZBUFF_FILES) $(PRGDIR)/datagen.c zbufftest.c $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) -zstreamtest : $(ZSTD_FILES) datagen.c zstreamtest.c +zstreamtest : $(ZSTD_FILES) $(PRGDIR)/datagen.c zstreamtest.c $(CC) $(FLAGS) $^ -o $@$(EXT) -zstreamtest32 : $(ZSTD_FILES) datagen.c zstreamtest.c +zstreamtest32 : $(ZSTD_FILES) $(PRGDIR)/datagen.c zstreamtest.c $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) -paramgrill : $(ZSTD_FILES) datagen.c paramgrill.c +paramgrill : $(ZSTD_FILES) $(PRGDIR)/datagen.c paramgrill.c $(CC) $(FLAGS) $^ -lm -o $@$(EXT) -datagen : datagen.c datagencli.c +datagen : $(PRGDIR)/datagen.c datagencli.c $(CC) $(FLAGS) $^ -o $@$(EXT) roundTripCrash : $(ZSTD_FILES) roundTripCrash.c @@ -124,7 +124,7 @@ roundTripCrash : $(ZSTD_FILES) roundTripCrash.c clean: $(MAKE) -C ../lib clean @rm -f core *.o tmp* result* *.gcda dictionary *.zst \ - zstd$(EXT) zstd32$(EXT) \ + $(PRGDIR)/zstd$(EXT) $(PRGDIR)/zstd32$(EXT) \ fullbench$(EXT) fullbench32$(EXT) \ fuzzer$(EXT) fuzzer32$(EXT) zbufftest$(EXT) zbufftest32$(EXT) \ datagen$(EXT) paramgrill$(EXT) roundTripCrash$(EXT) @@ -141,12 +141,12 @@ valgrindTest: VALGRIND = valgrind --leak-check=full --error-exitcode=1 valgrindTest: zstd datagen fuzzer fullbench zbufftest @echo "\n ---- valgrind tests : memory analyzer ----" $(VALGRIND) ./datagen -g50M > $(VOID) - $(VALGRIND) ./zstd ; if [ $$? -eq 0 ] ; then echo "zstd without argument should have failed"; false; fi - ./datagen -g80 | $(VALGRIND) ./zstd - -c > $(VOID) - ./datagen -g16KB | $(VALGRIND) ./zstd -vf - -o $(VOID) - ./datagen -g2930KB | $(VALGRIND) ./zstd -5 -vf - -o tmp - $(VALGRIND) ./zstd -vdf tmp -o $(VOID) - ./datagen -g64MB | $(VALGRIND) ./zstd -vf - -o $(VOID) + $(VALGRIND) $(PRGDIR)/zstd ; if [ $$? -eq 0 ] ; then echo "zstd without argument should have failed"; false; fi + ./datagen -g80 | $(VALGRIND) $(PRGDIR)/zstd - -c > $(VOID) + ./datagen -g16KB | $(VALGRIND) $(PRGDIR)/zstd -vf - -o $(VOID) + ./datagen -g2930KB | $(VALGRIND) $(PRGDIR)/zstd -5 -vf - -o tmp + $(VALGRIND) $(PRGDIR)/zstd -vdf tmp -o $(VOID) + ./datagen -g64MB | $(VALGRIND) $(PRGDIR)/zstd -vf - -o $(VOID) @rm tmp $(VALGRIND) ./fuzzer -T1mn -t1 $(VALGRIND) ./fullbench -i1 @@ -173,13 +173,13 @@ test32: test-zstd32 test-fullbench32 test-fuzzer32 test-zbuff32 test-zstream32 test-all: test test32 valgrindTest -test-zstd: ZSTD = ./zstd +test-zstd: ZSTD = $(PRGDIR)/zstd test-zstd: zstd zstd-playTests -test-zstd32: ZSTD = ./zstd32 +test-zstd32: ZSTD = $(PRGDIR)/zstd32 test-zstd32: zstd32 zstd-playTests -test-zstd_nolegacy: ZSTD = ./zstd +test-zstd_nolegacy: ZSTD = $(PRGDIR)/zstd test-zstd_nolegacy: zstd_nolegacy zstd-playTests test-fullbench: fullbench datagen From 63e335704efac0977f8b45fe56fdbaeb903d338a Mon Sep 17 00:00:00 2001 From: inikep Date: Thu, 18 Aug 2016 14:04:57 +0200 Subject: [PATCH 04/10] updated scripts +x permissions --- tests/Makefile | 16 ++++++++++++++-- tests/playTests.sh | 0 2 files changed, 14 insertions(+), 2 deletions(-) mode change 100644 => 100755 tests/playTests.sh diff --git a/tests/Makefile b/tests/Makefile index e0689ce67..a8fb97c21 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -28,6 +28,7 @@ # zbufftest32: Same as zbufftest, but forced to compile in 32-bits mode # fullbench : Precisely measure speed for each zstd inner function # fullbench32: Same as fullbench, but forced to compile in 32-bits mode +# versionstest : Compatibility test between zstd versions stored on Github (v0.1+) # ########################################################################## DESTDIR?= @@ -36,6 +37,9 @@ BINDIR = $(PREFIX)/bin MANDIR = $(PREFIX)/share/man/man1 ZSTDDIR = ../lib PRGDIR = ../programs +PYTHON ?= python3 +TESTARTEFACT := versionsTest namespaceTest + CPPFLAGS= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/dictBuilder -I$(PRGDIR) CFLAGS ?= -O3 @@ -67,7 +71,7 @@ ZBUFFTEST = -T2mn FUZZERTEST= -T5mn ZSTDRTTEST= --test-large-data -.PHONY: default all all32 clean test test32 test-all +.PHONY: default all all32 clean test test32 test-all namespaceTest versionsTest default: fullbench @@ -121,9 +125,17 @@ datagen : $(PRGDIR)/datagen.c datagencli.c roundTripCrash : $(ZSTD_FILES) roundTripCrash.c $(CC) $(FLAGS) $^ -o $@$(EXT) +namespaceTest: + if $(CC) namespaceTest.c ../lib/common/xxhash.c -o $@ ; then echo compilation should fail; exit 1 ; fi + $(RM) $@ + +versionsTest: + $(PYTHON) test-zstd-versions.py + clean: $(MAKE) -C ../lib clean - @rm -f core *.o tmp* result* *.gcda dictionary *.zst \ + @$(RM) -fR $(TESTARTEFACT) + @$(RM) -f core *.o tmp* result* *.gcda dictionary *.zst \ $(PRGDIR)/zstd$(EXT) $(PRGDIR)/zstd32$(EXT) \ fullbench$(EXT) fullbench32$(EXT) \ fuzzer$(EXT) fuzzer32$(EXT) zbufftest$(EXT) zbufftest32$(EXT) \ diff --git a/tests/playTests.sh b/tests/playTests.sh old mode 100644 new mode 100755 From b1421f2d366e0c0b2a390bbff8b85452afc7dfa8 Mon Sep 17 00:00:00 2001 From: inikep Date: Thu, 18 Aug 2016 14:17:11 +0200 Subject: [PATCH 05/10] updated VS projects --- projects/VS2005/fullbench/fullbench.vcproj | 2 +- projects/VS2005/fuzzer/fuzzer.vcproj | 2 +- projects/VS2008/fullbench/fullbench.vcproj | 2 +- projects/VS2008/fuzzer/fuzzer.vcproj | 2 +- projects/VS2010/datagen/datagen.vcxproj | 4 ++-- projects/VS2010/fullbench/fullbench.vcxproj | 4 ++-- projects/VS2010/fuzzer/fuzzer.vcxproj | 4 ++-- projects/VS2010/zstdlib/zstdlib.vcxproj | 3 +-- 8 files changed, 11 insertions(+), 12 deletions(-) diff --git a/projects/VS2005/fullbench/fullbench.vcproj b/projects/VS2005/fullbench/fullbench.vcproj index 6379cf262..8aab08205 100644 --- a/projects/VS2005/fullbench/fullbench.vcproj +++ b/projects/VS2005/fullbench/fullbench.vcproj @@ -348,7 +348,7 @@ > + @@ -157,7 +157,7 @@ - + diff --git a/projects/VS2010/fullbench/fullbench.vcxproj b/projects/VS2010/fullbench/fullbench.vcxproj index 159a58d5a..882c78f84 100644 --- a/projects/VS2010/fullbench/fullbench.vcxproj +++ b/projects/VS2010/fullbench/fullbench.vcxproj @@ -1,4 +1,4 @@ - + @@ -168,7 +168,7 @@ - + diff --git a/projects/VS2010/fuzzer/fuzzer.vcxproj b/projects/VS2010/fuzzer/fuzzer.vcxproj index 5c8d800bf..34b610538 100644 --- a/projects/VS2010/fuzzer/fuzzer.vcxproj +++ b/projects/VS2010/fuzzer/fuzzer.vcxproj @@ -1,4 +1,4 @@ - + @@ -168,7 +168,7 @@ - + diff --git a/projects/VS2010/zstdlib/zstdlib.vcxproj b/projects/VS2010/zstdlib/zstdlib.vcxproj index 8a5bc8b1d..232fdf442 100644 --- a/projects/VS2010/zstdlib/zstdlib.vcxproj +++ b/projects/VS2010/zstdlib/zstdlib.vcxproj @@ -1,4 +1,4 @@ - + @@ -43,7 +43,6 @@ - From 49775e3a60648932573408198f07afa70349e037 Mon Sep 17 00:00:00 2001 From: inikep Date: Thu, 18 Aug 2016 14:25:28 +0200 Subject: [PATCH 06/10] VS projects: fixed include directiories --- projects/VS2005/fullbench/fullbench.vcproj | 8 ++++---- projects/VS2005/fuzzer/fuzzer.vcproj | 8 ++++---- projects/VS2008/fullbench/fullbench.vcproj | 8 ++++---- projects/VS2008/fuzzer/fuzzer.vcproj | 8 ++++---- projects/VS2010/datagen/datagen.vcxproj | 8 ++++---- projects/VS2010/fullbench/fullbench.vcxproj | 8 ++++---- projects/VS2010/fuzzer/fuzzer.vcxproj | 8 ++++---- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/projects/VS2005/fullbench/fullbench.vcproj b/projects/VS2005/fullbench/fullbench.vcproj index 8aab08205..17af9c819 100644 --- a/projects/VS2005/fullbench/fullbench.vcproj +++ b/projects/VS2005/fullbench/fullbench.vcproj @@ -43,7 +43,7 @@ true false - $(IncludePath);$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + $(IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); $(Platform)\$(Configuration)\ true false - $(IncludePath);$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + $(IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); false false - $(IncludePath);$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + $(IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); $(Platform)\$(Configuration)\ false false - $(IncludePath);$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + $(IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); diff --git a/projects/VS2010/fullbench/fullbench.vcxproj b/projects/VS2010/fullbench/fullbench.vcxproj index 882c78f84..d342bcb64 100644 --- a/projects/VS2010/fullbench/fullbench.vcxproj +++ b/projects/VS2010/fullbench/fullbench.vcxproj @@ -65,24 +65,24 @@ true - $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); false $(Platform)\$(Configuration)\ true - $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); false false - $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); false $(Platform)\$(Configuration)\ false - $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); false diff --git a/projects/VS2010/fuzzer/fuzzer.vcxproj b/projects/VS2010/fuzzer/fuzzer.vcxproj index 34b610538..a436b0389 100644 --- a/projects/VS2010/fuzzer/fuzzer.vcxproj +++ b/projects/VS2010/fuzzer/fuzzer.vcxproj @@ -66,24 +66,24 @@ true false - $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); $(Platform)\$(Configuration)\ true false - $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); false false - $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); $(Platform)\$(Configuration)\ false false - $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); From 6ca9b853a1ed858ed3c15f915ca39d2b3a9f3636 Mon Sep 17 00:00:00 2001 From: inikep Date: Thu, 18 Aug 2016 14:42:28 +0200 Subject: [PATCH 07/10] cmake project: fixed include directories --- projects/cmake/CMakeLists.txt | 1 + projects/cmake/programs/.gitignore | 5 --- projects/cmake/programs/CMakeLists.txt | 15 ------- projects/cmake/tests/.gitignore | 7 +++ projects/cmake/tests/CMakeLists.txt | 61 ++++++++++++++++++++++++++ tests/playTests.sh | 9 ++-- 6 files changed, 73 insertions(+), 25 deletions(-) create mode 100644 projects/cmake/tests/.gitignore create mode 100644 projects/cmake/tests/CMakeLists.txt diff --git a/projects/cmake/CMakeLists.txt b/projects/cmake/CMakeLists.txt index 9650eb4f2..86178bf97 100644 --- a/projects/cmake/CMakeLists.txt +++ b/projects/cmake/CMakeLists.txt @@ -46,6 +46,7 @@ ENDIF (ZSTD_LEGACY_SUPPORT) ADD_SUBDIRECTORY(lib) ADD_SUBDIRECTORY(programs) +ADD_SUBDIRECTORY(tests) #----------------------------------------------------------------------------- # Add extra compilation flags diff --git a/projects/cmake/programs/.gitignore b/projects/cmake/programs/.gitignore index 81eec349e..f04c5b429 100644 --- a/projects/cmake/programs/.gitignore +++ b/projects/cmake/programs/.gitignore @@ -1,8 +1,3 @@ # produced by make -datagen -fullbench -fuzzer -paramgrill -zbufftest zstd zstd-frugal diff --git a/projects/cmake/programs/CMakeLists.txt b/projects/cmake/programs/CMakeLists.txt index fddfc7df2..163e944c0 100644 --- a/projects/cmake/programs/CMakeLists.txt +++ b/projects/cmake/programs/CMakeLists.txt @@ -51,23 +51,8 @@ ENDIF (ZSTD_LEGACY_SUPPORT) ADD_EXECUTABLE(zstd ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/fileio.c ${PROGRAMS_DIR}/bench.c ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/dibio.c ${ZSTD_FILEIO_LEGACY}) TARGET_LINK_LIBRARIES(zstd libzstd_static) -ADD_EXECUTABLE(fullbench ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/fullbench.c) -TARGET_LINK_LIBRARIES(fullbench libzstd_static) - -ADD_EXECUTABLE(fuzzer ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/fuzzer.c) -TARGET_LINK_LIBRARIES(fuzzer libzstd_static) - IF (UNIX) ADD_EXECUTABLE(zstd-frugal ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/fileio.c) TARGET_LINK_LIBRARIES(zstd-frugal libzstd_static) SET_TARGET_PROPERTIES(zstd-frugal PROPERTIES COMPILE_DEFINITIONS "ZSTD_NOBENCH;ZSTD_NODICT") - - ADD_EXECUTABLE(zbufftest ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/zbufftest.c) - TARGET_LINK_LIBRARIES(zbufftest libzstd_static) - - ADD_EXECUTABLE(paramgrill ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/paramgrill.c) - TARGET_LINK_LIBRARIES(paramgrill libzstd_static m) #m is math library - - ADD_EXECUTABLE(datagen ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/datagencli.c) - TARGET_LINK_LIBRARIES(datagen libzstd_static) ENDIF (UNIX) diff --git a/projects/cmake/tests/.gitignore b/projects/cmake/tests/.gitignore new file mode 100644 index 000000000..2ab62a3e1 --- /dev/null +++ b/projects/cmake/tests/.gitignore @@ -0,0 +1,7 @@ +# produced by make +datagen +fullbench +fuzzer +paramgrill +zbufftest + diff --git a/projects/cmake/tests/CMakeLists.txt b/projects/cmake/tests/CMakeLists.txt new file mode 100644 index 000000000..f5ece894e --- /dev/null +++ b/projects/cmake/tests/CMakeLists.txt @@ -0,0 +1,61 @@ +# ################################################################ +# zstd - Makefile +# Copyright (C) Yann Collet 2014-2016 +# All rights reserved. +# +# BSD license +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# You can contact the author at : +# - zstd homepage : http://www.zstd.net/ +# ################################################################ + +PROJECT(tests) + +SET(CMAKE_INCLUDE_CURRENT_DIR TRUE) + +# Define project root directory +SET(ROOT_DIR ../../..) + +# Define programs directory, where sources and header files are located +SET(LIBRARY_DIR ${ROOT_DIR}/lib) +SET(PROGRAMS_DIR ${ROOT_DIR}/programs) +SET(TESTS_DIR ${ROOT_DIR}/tests) +INCLUDE_DIRECTORIES(${TESTS_DIR} ${PROGRAMS_DIR} ${LIBRARY_DIR} ${LIBRARY_DIR}/common ${LIBRARY_DIR}/dictBuilder) + +ADD_EXECUTABLE(fullbench ${PROGRAMS_DIR}/datagen.c ${TESTS_DIR}/fullbench.c) +TARGET_LINK_LIBRARIES(fullbench libzstd_static) + +ADD_EXECUTABLE(fuzzer ${PROGRAMS_DIR}/datagen.c ${TESTS_DIR}/fuzzer.c) +TARGET_LINK_LIBRARIES(fuzzer libzstd_static) + +IF (UNIX) + ADD_EXECUTABLE(zbufftest ${PROGRAMS_DIR}/datagen.c ${TESTS_DIR}/zbufftest.c) + TARGET_LINK_LIBRARIES(zbufftest libzstd_static) + + ADD_EXECUTABLE(paramgrill ${PROGRAMS_DIR}/datagen.c ${TESTS_DIR}/paramgrill.c) + TARGET_LINK_LIBRARIES(paramgrill libzstd_static m) #m is math library + + ADD_EXECUTABLE(datagen ${PROGRAMS_DIR}/datagen.c ${TESTS_DIR}/datagencli.c) + TARGET_LINK_LIBRARIES(datagen libzstd_static) +ENDIF (UNIX) diff --git a/tests/playTests.sh b/tests/playTests.sh index 70ac35ecb..b454a6db7 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -175,12 +175,12 @@ $ECHO "\n**** dictionary tests **** " diff -q tmp1 tmp2 $ECHO "- Create first dictionary" $ZSTD --train *.c -o tmpDict -cp zstdcli.c tmp +cp fuzzer.c tmp $ZSTD -f tmp -D tmpDict $ZSTD -d tmp.zst -D tmpDict -of result -diff zstdcli.c result +diff fuzzer.c result $ECHO "- Create second (different) dictionary" -$ZSTD --train *.c *.h -o tmpDictC +$ZSTD --train *.c -o tmpDictC $ZSTD -d tmp.zst -D tmpDictC -of result && die "wrong dictionary not detected!" $ECHO "- Create dictionary with short dictID" $ZSTD --train *.c --dictID 1 -o tmpDict1 @@ -188,12 +188,11 @@ cmp tmpDict tmpDict1 && die "dictionaries should have different ID !" $ECHO "- Compress without dictID" $ZSTD -f tmp -D tmpDict1 --no-dictID $ZSTD -d tmp.zst -D tmpDict -of result -diff zstdcli.c result +diff fuzzer.c result $ECHO "- Compress multiple files with dictionary" rm -rf dirTestDict mkdir dirTestDict cp *.c dirTestDict -cp *.h dirTestDict cat dirTestDict/* | $MD5SUM > tmph1 # note : we expect same file order to generate same hash $ZSTD -f dirTestDict/* -D tmpDictC $ZSTD -d dirTestDict/*.zst -D tmpDictC -c | $MD5SUM > tmph2 From b7d3449d5dfd768b9934fa429ef645f8ff567265 Mon Sep 17 00:00:00 2001 From: inikep Date: Thu, 18 Aug 2016 15:13:41 +0200 Subject: [PATCH 08/10] playTests.sh working with tests/ --- tests/playTests.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/playTests.sh b/tests/playTests.sh index b454a6db7..013ba6f64 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -169,30 +169,33 @@ $ZSTD -f tmp1 notHere tmp2 && die "missing file not detected!" $ECHO "\n**** dictionary tests **** " +TESTFILE=../programs/zstdcli.c ./datagen > tmpDict ./datagen -g1M | $MD5SUM > tmp1 ./datagen -g1M | $ZSTD -D tmpDict | $ZSTD -D tmpDict -dvq | $MD5SUM > tmp2 diff -q tmp1 tmp2 $ECHO "- Create first dictionary" -$ZSTD --train *.c -o tmpDict -cp fuzzer.c tmp +$ZSTD --train *.c ../programs/*.c -o tmpDict +cp $TESTFILE tmp $ZSTD -f tmp -D tmpDict $ZSTD -d tmp.zst -D tmpDict -of result -diff fuzzer.c result +diff $TESTFILE result $ECHO "- Create second (different) dictionary" -$ZSTD --train *.c -o tmpDictC +$ZSTD --train *.c ../programs/*.c ../programs/*.h -o tmpDictC $ZSTD -d tmp.zst -D tmpDictC -of result && die "wrong dictionary not detected!" $ECHO "- Create dictionary with short dictID" -$ZSTD --train *.c --dictID 1 -o tmpDict1 +$ZSTD --train *.c ../programs/*.c --dictID 1 -o tmpDict1 cmp tmpDict tmpDict1 && die "dictionaries should have different ID !" $ECHO "- Compress without dictID" $ZSTD -f tmp -D tmpDict1 --no-dictID $ZSTD -d tmp.zst -D tmpDict -of result -diff fuzzer.c result +diff $TESTFILE result $ECHO "- Compress multiple files with dictionary" rm -rf dirTestDict mkdir dirTestDict cp *.c dirTestDict +cp ../programs/*.c dirTestDict +cp ../programs/*.h dirTestDict cat dirTestDict/* | $MD5SUM > tmph1 # note : we expect same file order to generate same hash $ZSTD -f dirTestDict/* -D tmpDictC $ZSTD -d dirTestDict/*.zst -D tmpDictC -c | $MD5SUM > tmph2 From 7feafdd7b80868762805db8ff3fdff75ca3dba72 Mon Sep 17 00:00:00 2001 From: inikep Date: Thu, 18 Aug 2016 15:17:18 +0200 Subject: [PATCH 09/10] appveyor.yml working with tests/ --- appveyor.yml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4b4ef6c6a..4e21db1c4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -44,7 +44,7 @@ build_script: ECHO *** && ECHO make %CLANG_PARAMS% && make %CLANG_PARAMS% && - COPY programs\fuzzer.exe projects\fuzzer_clang.exe && + COPY tests\fuzzer.exe tests\fuzzer_clang.exe && make clean ) - if [%COMPILER%]==[gcc] ( @@ -64,7 +64,7 @@ build_script: msbuild "projects\VS2008\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v90 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && DIR projects\VS2008\bin\%PLATFORM%\%CONFIGURATION%\*.exe && MD5sum projects/VS2008/bin/%PLATFORM%/%CONFIGURATION%/*.exe && - COPY projects\VS2008\bin\%PLATFORM%\%CONFIGURATION%\fuzzer.exe projects\fuzzer_VS2008_%PLATFORM%_%CONFIGURATION%.exe && + COPY projects\VS2008\bin\%PLATFORM%\%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2008_%PLATFORM%_%CONFIGURATION%.exe && ECHO *** && ECHO *** Building Visual Studio 2010 %PLATFORM%\%CONFIGURATION% && ECHO *** && @@ -74,7 +74,7 @@ build_script: msbuild "projects\VS2010\zstd.sln" %ADDITIONALPARAM% /m /verbosity:minimal /property:PlatformToolset=v100 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && DIR projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\*.exe && MD5sum projects/VS2010/bin/%PLATFORM%/%CONFIGURATION%/*.exe && - COPY projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\fuzzer.exe projects\fuzzer_VS2010_%PLATFORM%_%CONFIGURATION%.exe && + COPY projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2010_%PLATFORM%_%CONFIGURATION%.exe && ECHO *** && ECHO *** Building Visual Studio 2012 %PLATFORM%\%CONFIGURATION% && ECHO *** && @@ -84,7 +84,7 @@ build_script: msbuild "projects\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v110 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && DIR projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\*.exe && MD5sum projects/VS2010/bin/%PLATFORM%/%CONFIGURATION%/*.exe && - COPY projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\fuzzer.exe projects\fuzzer_VS2012_%PLATFORM%_%CONFIGURATION%.exe && + COPY projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2012_%PLATFORM%_%CONFIGURATION%.exe && ECHO *** && ECHO *** Building Visual Studio 2013 %PLATFORM%\%CONFIGURATION% && ECHO *** && @@ -94,7 +94,7 @@ build_script: msbuild "projects\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v120 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && DIR projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\*.exe && MD5sum projects/VS2010/bin/%PLATFORM%/%CONFIGURATION%/*.exe && - COPY projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\fuzzer.exe projects\fuzzer_VS2013_%PLATFORM%_%CONFIGURATION%.exe && + COPY projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2013_%PLATFORM%_%CONFIGURATION%.exe && ECHO *** && ECHO *** Building Visual Studio 2015 %PLATFORM%\%CONFIGURATION% && ECHO *** && @@ -104,26 +104,25 @@ build_script: msbuild "projects\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v140 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && DIR projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\*.exe && MD5sum projects/VS2010/bin/%PLATFORM%/%CONFIGURATION%/*.exe && - COPY projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\fuzzer.exe projects\fuzzer_VS2015_%PLATFORM%_%CONFIGURATION%.exe && - COPY projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\*.exe programs\ + COPY projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2015_%PLATFORM%_%CONFIGURATION%.exe && + COPY projects\VS2010\bin\%PLATFORM%\%CONFIGURATION%\*.exe tests\ ) test_script: - ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION% - SET FUZZERTEST=-T1mn - if [%COMPILER%]==[gcc] ( - if [%PLATFORM%]==[mingw64] projects\fuzzer_clang.exe %FUZZERTEST% + if [%PLATFORM%]==[mingw64] tests\fuzzer_clang.exe %FUZZERTEST% ) - if [%COMPILER%]==[visual] if [%CONFIGURATION%]==[Release] ( - CD programs && + CD tests && SET ZSTD=./zstd.exe && sh -e playTests.sh --test-large-data && fullbench.exe -i1 && fullbench.exe -i1 -P0 && - CD .. && - projects\fuzzer_VS2008_%PLATFORM%_Release.exe %FUZZERTEST% && - projects\fuzzer_VS2010_%PLATFORM%_Release.exe %FUZZERTEST% && - projects\fuzzer_VS2012_%PLATFORM%_Release.exe %FUZZERTEST% && - projects\fuzzer_VS2013_%PLATFORM%_Release.exe %FUZZERTEST% && - projects\fuzzer_VS2015_%PLATFORM%_Release.exe %FUZZERTEST% + fuzzer_VS2008_%PLATFORM%_Release.exe %FUZZERTEST% && + fuzzer_VS2010_%PLATFORM%_Release.exe %FUZZERTEST% && + fuzzer_VS2012_%PLATFORM%_Release.exe %FUZZERTEST% && + fuzzer_VS2013_%PLATFORM%_Release.exe %FUZZERTEST% && + fuzzer_VS2015_%PLATFORM%_Release.exe %FUZZERTEST% ) From b6514d24966dfd0a675e14c11736f03d95ed4039 Mon Sep 17 00:00:00 2001 From: inikep Date: Thu, 18 Aug 2016 16:53:29 +0200 Subject: [PATCH 10/10] improved .gitignore --- programs/.gitignore | 27 --------------------------- tests/.gitignore | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/programs/.gitignore b/programs/.gitignore index 369a27cc1..5875fc792 100644 --- a/programs/.gitignore +++ b/programs/.gitignore @@ -3,42 +3,16 @@ zstd zstd32 zstd-compress zstd-decompress -fullbench -fullbench32 -fuzzer -fuzzer32 -zbufftest -zbufftest32 -zstreamtest -zstreamtest32 -datagen -paramgrill -paramgrill32 -roundTripCrash # Object files *.o *.ko -# Libraries -*.lib -*.a - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - # Executables *.exe *.out *.app -# Visual solution files -*.suo -*.user - # Default result files dictionary grillResults.txt @@ -53,5 +27,4 @@ afl # Misc files *.bat -fileTests.sh dirTest* diff --git a/tests/.gitignore b/tests/.gitignore index 5ea6b5b75..c8f9ae79e 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,3 +1,17 @@ +# local binary (Makefile) +fullbench +fullbench32 +fuzzer +fuzzer32 +zbufftest +zbufftest32 +zstreamtest +zstreamtest32 +datagen +paramgrill +paramgrill32 +roundTripCrash + # Tmp test directory zstdtest speedTest @@ -7,3 +21,28 @@ namespaceTest # Local script startSpeedTest speedTest.pid + +# Object files +*.o +*.ko + +# Executables +*.exe +*.out +*.app + +# Default result files +dictionary +grillResults.txt +_* +tmp* +*.zst +result +out + +# fuzzer +afl + +# Misc files +*.bat +dirTest*