From 040cfd8e7d2159b15e2b9254e7eeba4073e63c5f Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Thu, 1 Sep 2016 16:21:19 -0700 Subject: [PATCH] Get ready to add tests to travis-ci --- .gitignore | 1 + contrib/pzstd/Makefile | 7 ++++++- contrib/pzstd/test/Makefile | 12 +++++++----- contrib/pzstd/utils/test/Makefile | 7 ++++--- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 5f2ca97d..13b61972 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ _zstdbench/ *.idea *.swp .DS_Store +googletest/ diff --git a/contrib/pzstd/Makefile b/contrib/pzstd/Makefile index 512a7629..ba86f5d4 100644 --- a/contrib/pzstd/Makefile +++ b/contrib/pzstd/Makefile @@ -59,6 +59,11 @@ main.o: main.cpp *.h utils/*.h pzstd: libzstd.a Pzstd.o SkippableFrame.o Options.o main.o $(CXX) $(FLAGS) $^ -o $@$(EXT) +googletest: + @git clone https://github.com/google/googletest + @mkdir -p googletest/build + @cd googletest/build && cmake .. && make + test: libzstd.a Pzstd.o Options.o SkippableFrame.o $(MAKE) -C utils/test test $(MAKE) -C test test @@ -67,5 +72,5 @@ clean: $(MAKE) -C $(ZSTDDIR) clean $(MAKE) -C utils/test clean $(MAKE) -C test clean - @$(RM) libzstd.a *.o pzstd$(EXT) + @$(RM) -rf googletest/ libzstd.a *.o pzstd$(EXT) @echo Cleaning completed diff --git a/contrib/pzstd/test/Makefile b/contrib/pzstd/test/Makefile index 3b0ffec8..147d9bd7 100644 --- a/contrib/pzstd/test/Makefile +++ b/contrib/pzstd/test/Makefile @@ -7,10 +7,6 @@ # of patent rights can be found in the PATENTS file in the same directory. # ########################################################################## -# Set GTEST_INC and GTEST_LIB to work with your install of gtest -GTEST_INC ?= -isystem googletest/googletest/include -GTEST_LIB ?= -L googletest/build/googlemock/gtest - # Define *.exe as extension for Windows systems ifneq (,$(filter Windows%,$(OS))) EXT =.exe @@ -22,6 +18,10 @@ PZSTDDIR = .. PROGDIR = ../../../programs ZSTDDIR = ../../../lib +# Set GTEST_INC and GTEST_LIB to work with your install of gtest +GTEST_INC ?= -isystem $(PZSTDDIR)/googletest/googletest/include +GTEST_LIB ?= -L $(PZSTDDIR)/googletest/build/googlemock/gtest + CPPFLAGS = -I$(PZSTDDIR) $(GTEST_INC) $(GTEST_LIB) -I$(ZSTDDIR)/common -I$(PROGDIR) CFLAGS ?= -O3 @@ -37,9 +37,11 @@ datagen.o: $(PROGDIR)/datagen.* .PHONY: test clean -test: OptionsTest PzstdTest RoundTripTest +test: OptionsTest PzstdTest @./OptionsTest$(EXT) @./PzstdTest$(EXT) + +roundtrip: RoundTripTest @./RoundTripTest$(EXT) clean: diff --git a/contrib/pzstd/utils/test/Makefile b/contrib/pzstd/utils/test/Makefile index 4c690633..6f801c30 100644 --- a/contrib/pzstd/utils/test/Makefile +++ b/contrib/pzstd/utils/test/Makefile @@ -7,9 +7,6 @@ # of patent rights can be found in the PATENTS file in the same directory. # ########################################################################## -GTEST_INC ?= -isystem googletest/googletest/include -GTEST_LIB ?= -L googletest/build/googlemock/gtest - # Define *.exe as extension for Windows systems ifneq (,$(filter Windows%,$(OS))) EXT =.exe @@ -19,6 +16,10 @@ endif PZSTDDIR = ../.. +# Set GTEST_INC and GTEST_LIB to work with your install of gtest +GTEST_INC ?= -isystem $(PZSTDDIR)/googletest/googletest/include +GTEST_LIB ?= -L $(PZSTDDIR)/googletest/build/googlemock/gtest + CPPFLAGS = -I$(PZSTDDIR) $(GTEST_INC) $(GTEST_LIB) CFLAGS ?= -O3 CFLAGS += -std=c++11