Repository: incubator-hawq Updated Branches: refs/heads/master 5ea92a599 -> a1f47072f
HAWQ-721. New Feature Test Skeleton. Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/a1f47072 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/a1f47072 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/a1f47072 Branch: refs/heads/master Commit: a1f47072f30391d331f6c79034babb40368e634c Parents: 5ea92a5 Author: xunzhang <[email protected]> Authored: Mon May 9 14:16:03 2016 +0800 Committer: Ruilong Huo <[email protected]> Committed: Tue May 10 09:32:57 2016 +0800 ---------------------------------------------------------------------- GNUmakefile.in | 8 ++++++++ src/Makefile | 8 ++++++++ src/Makefile.global.in | 4 +++- src/test/Makefile | 10 ++++++++-- src/test/feature/Makefile | 11 +++++++++++ src/test/feature/example/Makefile | 16 ++++++++++++++++ src/test/feature/example/test_example.cpp | 10 ++++++++++ src/test/feature/lib/common.h | 22 ++++++++++++++++++++++ 8 files changed, 86 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/a1f47072/GNUmakefile.in ---------------------------------------------------------------------- diff --git a/GNUmakefile.in b/GNUmakefile.in index 66f97bd..3f1a624 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -48,6 +48,12 @@ distprep: $(MAKE) -C config $@ $(MAKE) -C contrib $@ +feature_test: + $(MAKE) -C src feature_test + +feature_test_clean: + $(MAKE) -C src feature_test_clean + # clean, distclean, etc should apply to contrib too, even though # it's not built by default clean: @@ -61,6 +67,7 @@ clean: $(MAKE) -C contrib/gp_cancel_query $@ $(MAKE) -C contrib/hawq-hadoop $@ $(MAKE) -C tools $@ + $(MAKE) -C src feature_test clean # Garbage from autoconf: @rm -rf autom4te.cache/ @@ -72,6 +79,7 @@ distclean maintainer-clean: -$(MAKE) -C config $@ -$(MAKE) -C tools $@ -$(MAKE) -C src $@ + $(MAKE) -C src feature_test clean -rm -f config.cache config.log config.status GNUmakefile # Garbage from autoconf: @rm -rf autom4te.cache/ http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/a1f47072/src/Makefile ---------------------------------------------------------------------- diff --git a/src/Makefile b/src/Makefile index 6ff7c3a..9cd4d8a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -26,6 +26,12 @@ all install installdirs uninstall distprep: $(MAKE) -C test/regress $@ $(MAKE) -C tools/fsync $@ +feature_test: + $(MAKE) -C test feature_test + +feature_test_clean: + $(MAKE) -C test feature_test clean + install: install-local install-local: installdirs-local @@ -57,6 +63,7 @@ clean: $(MAKE) -C tutorial NO_PGXS=1 $@ $(MAKE) -C test/thread $@ $(MAKE) -C test/regress $@ + $(MAKE) -C test/feature/example $@ $(MAKE) -C tools/fsync $@ distclean maintainer-clean: @@ -73,6 +80,7 @@ distclean maintainer-clean: $(MAKE) -C tutorial NO_PGXS=1 $@ $(MAKE) -C test/thread $@ $(MAKE) -C test/regress $@ + $(MAKE) -C test/feature/example clean $(MAKE) -C tools/fsync $@ rm -f Makefile.port Makefile.global http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/a1f47072/src/Makefile.global.in ---------------------------------------------------------------------- diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 061695e..702b567 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -23,6 +23,8 @@ # make `all' the default target all: +feature_test: + # Delete target files if the command fails after it has # started to update the file. .DELETE_ON_ERROR: @@ -487,7 +489,7 @@ submake-libpgport: # reliable) method is to communicate what you want to do to the # configure script, and leave the makefiles alone. --include $(top_srcdir)/src/Makefile.custom +#-include $(top_srcdir)/src/Makefile.custom ifneq ($(CUSTOM_INSTALL),) INSTALL= $(CUSTOM_INSTALL) http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/a1f47072/src/test/Makefile ---------------------------------------------------------------------- diff --git a/src/test/Makefile b/src/test/Makefile index 702f5b4..4a7649c 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -11,5 +11,11 @@ # #------------------------------------------------------------------------- -.DEFAULT: - $(MAKE) -C regress $@ +#.DEFAULT: +# $(MAKE) -C regress $@ + +feature_test: + $(MAKE) -C feature all + +clean: + $(MAKE) -C feature clean http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/a1f47072/src/test/feature/Makefile ---------------------------------------------------------------------- diff --git a/src/test/feature/Makefile b/src/test/feature/Makefile new file mode 100644 index 0000000..64ef46d --- /dev/null +++ b/src/test/feature/Makefile @@ -0,0 +1,11 @@ +top_builddir = ../../.. +include $(top_builddir)/src/Makefile.global + +#.DEFAULT: +#$(MAKE) -C lib $@ + +all: + $(MAKE) -C example all + +clean: + $(MAKE) -C example clean http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/a1f47072/src/test/feature/example/Makefile ---------------------------------------------------------------------- diff --git a/src/test/feature/example/Makefile b/src/test/feature/example/Makefile new file mode 100644 index 0000000..afe3672 --- /dev/null +++ b/src/test/feature/example/Makefile @@ -0,0 +1,16 @@ +subdir = src/test/feature/example +top_builddir = ../../../.. +include $(top_builddir)/src/Makefile.global + +override CXXFLAGS = -Wall -O0 -g -std=c++11 +override CPPFLAGS := -I/usr/include -I/usr/local/include -I$(top_builddir)/src/test/feature/ +override LIBS := $(LIBS) -lgtest +override LDFLAGS += -L/usr/local/lib -L/usr/lib + +PROG = test_example.cpp + +all: + g++ $(CPPFLAGS) $(CXXFLAGS) $(PROG) $(LDFLAGS) $(LIBS) -o test_example + +distclean clean: + rm -f test_example http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/a1f47072/src/test/feature/example/test_example.cpp ---------------------------------------------------------------------- diff --git a/src/test/feature/example/test_example.cpp b/src/test/feature/example/test_example.cpp new file mode 100644 index 0000000..ee1c268 --- /dev/null +++ b/src/test/feature/example/test_example.cpp @@ -0,0 +1,10 @@ +#include <vector> +#include "lib/common.h" + +int main(int argc, char *argv[]) +{ + std::vector<int> A = {1, 2, 3}; + std::vector<int> B = {1, 2, 3}; + hawq::test::EQUAL_CHECK(A, B); + return 0; +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/a1f47072/src/test/feature/lib/common.h ---------------------------------------------------------------------- diff --git a/src/test/feature/lib/common.h b/src/test/feature/lib/common.h new file mode 100644 index 0000000..34fc857 --- /dev/null +++ b/src/test/feature/lib/common.h @@ -0,0 +1,22 @@ +#ifndef FILE_58f9fa9e_188f_5f43_d103_c16c3132fd24_HPP +#define FILE_58f9fa9e_188f_5f43_d103_c16c3132fd24_HPP + +#include <vector> +#include <gtest/gtest.h> + +namespace hawq { +namespace test { + +template <class V> +void EQUAL_CHECK(std::vector<V> a, + std::vector<V> b) { + EXPECT_EQ(a.size(), b.size()); + for(size_t i = 0; i < a.size(); ++i) { + EXPECT_EQ(a[i], b[i]); + } +} + +} // namespace test +} // namespace hawq + +#endif
