THRIFT-503. cpp: Move the tests built by "make check" under lib/cpp

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@991246 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/.gitignore b/.gitignore
index a9d981b..e89b041 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,6 +32,22 @@
 /lib/cpp/.libs
 /lib/cpp/Makefile
 /lib/cpp/Makefile.in
+/lib/cpp/test/.deps
+/lib/cpp/test/.libs
+/lib/cpp/test/gen-cpp
+/lib/cpp/test/Makefile
+/lib/cpp/test/Makefile.in
+/lib/cpp/test/Benchmark
+/lib/cpp/test/DebugProtoTest
+/lib/cpp/test/JSONProtoTest
+/lib/cpp/test/OptionalRequiredTest
+/lib/cpp/test/ReflectionTest
+/lib/cpp/test/TFDTransportTest
+/lib/cpp/test/TPipedTransportTest
+/lib/cpp/test/UnitTests
+/lib/cpp/test/*.la
+/lib/cpp/test/*.lo
+/lib/cpp/test/*.o
 /lib/cpp/concurrency_test
 /lib/cpp/*.o
 /lib/cpp/*.la
@@ -68,22 +84,8 @@
 /ltmain.sh
 /missing
 /stamp-h1
-/test/.deps
-/test/.libs
-/test/*.o
-/test/*.la
-/test/*.lo
-/test/Benchmark
-/test/DebugProtoTest
-/test/JSONProtoTest
-/test/TFDTransportTest
-/test/TPipedTransportTest
-/test/UnitTests
 /test/Makefile
 /test/Makefile.in
-/test/OptionalRequiredTest
-/test/ReflectionTest
-/test/gen-cpp
 /test/py/Makefile
 /test/py/Makefile.in
 /test/py/gen-py
diff --git a/configure.ac b/configure.ac
index 3175a7b..b440ccb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -292,6 +292,7 @@
   compiler/cpp/version.h
   lib/Makefile
   lib/cpp/Makefile
+  lib/cpp/test/Makefile
   lib/cpp/thrift.pc
   lib/cpp/thrift-nb.pc
   lib/cpp/thrift-z.pc
diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am
index e83b182..664a58a 100644
--- a/lib/cpp/Makefile.am
+++ b/lib/cpp/Makefile.am
@@ -17,6 +17,8 @@
 # under the License.
 #
 
+SUBDIRS = . test
+
 pkgconfigdir = $(libdir)/pkgconfig
 
 lib_LTLIBRARIES = libthrift.la
diff --git a/test/AllProtocolTests.cpp b/lib/cpp/test/AllProtocolTests.cpp
similarity index 100%
rename from test/AllProtocolTests.cpp
rename to lib/cpp/test/AllProtocolTests.cpp
diff --git a/test/AllProtocolTests.tcc b/lib/cpp/test/AllProtocolTests.tcc
similarity index 100%
rename from test/AllProtocolTests.tcc
rename to lib/cpp/test/AllProtocolTests.tcc
diff --git a/test/Benchmark.cpp b/lib/cpp/test/Benchmark.cpp
similarity index 100%
rename from test/Benchmark.cpp
rename to lib/cpp/test/Benchmark.cpp
diff --git a/test/DebugProtoTest.cpp b/lib/cpp/test/DebugProtoTest.cpp
similarity index 100%
rename from test/DebugProtoTest.cpp
rename to lib/cpp/test/DebugProtoTest.cpp
diff --git a/test/DebugProtoTest_extras.cpp b/lib/cpp/test/DebugProtoTest_extras.cpp
similarity index 100%
rename from test/DebugProtoTest_extras.cpp
rename to lib/cpp/test/DebugProtoTest_extras.cpp
diff --git a/test/DenseProtoTest.cpp b/lib/cpp/test/DenseProtoTest.cpp
similarity index 100%
rename from test/DenseProtoTest.cpp
rename to lib/cpp/test/DenseProtoTest.cpp
diff --git a/test/GenericHelpers.h b/lib/cpp/test/GenericHelpers.h
similarity index 100%
rename from test/GenericHelpers.h
rename to lib/cpp/test/GenericHelpers.h
diff --git a/test/JSONProtoTest.cpp b/lib/cpp/test/JSONProtoTest.cpp
similarity index 100%
rename from test/JSONProtoTest.cpp
rename to lib/cpp/test/JSONProtoTest.cpp
diff --git a/lib/cpp/test/Makefile.am b/lib/cpp/test/Makefile.am
new file mode 100644
index 0000000..0585250
--- /dev/null
+++ b/lib/cpp/test/Makefile.am
@@ -0,0 +1,147 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+noinst_LTLIBRARIES = libtestgencpp.la
+nodist_libtestgencpp_la_SOURCES = \
+	gen-cpp/DebugProtoTest_types.cpp \
+	gen-cpp/OptionalRequiredTest_types.cpp \
+	gen-cpp/DebugProtoTest_types.cpp \
+	gen-cpp/ThriftTest_types.cpp \
+	gen-cpp/DebugProtoTest_types.h \
+	gen-cpp/OptionalRequiredTest_types.h \
+	gen-cpp/ThriftTest_types.h \
+	ThriftTest_extras.cpp \
+	DebugProtoTest_extras.cpp
+
+ThriftTest_extras.o: gen-cpp/ThriftTest_types.h
+DebugProtoTest_extras.o: gen-cpp/DebugProtoTest_types.h
+
+libtestgencpp_la_LIBADD = $(top_builddir)/lib/cpp/libthrift.la
+
+noinst_PROGRAMS = Benchmark
+
+Benchmark_SOURCES = \
+	Benchmark.cpp
+
+Benchmark_LDADD = libtestgencpp.la
+
+check_PROGRAMS = \
+	TFDTransportTest \
+	TPipedTransportTest \
+	DebugProtoTest \
+	JSONProtoTest \
+	OptionalRequiredTest \
+	AllProtocolsTest \
+	UnitTests
+
+TESTS = \
+	$(check_PROGRAMS)
+
+UnitTests_SOURCES = \
+	UnitTestMain.cpp \
+	TMemoryBufferTest.cpp \
+	TBufferBaseTest.cpp
+
+UnitTests_LDADD = libtestgencpp.la -lboost_unit_test_framework
+
+#
+# TFDTransportTest
+#
+TFDTransportTest_SOURCES = \
+	TFDTransportTest.cpp
+
+TFDTransportTest_LDADD = \
+	$(top_builddir)/lib/cpp/libthrift.la
+
+
+#
+# TPipedTransportTest
+#
+TPipedTransportTest_SOURCES = \
+	TPipedTransportTest.cpp
+
+TPipedTransportTest_LDADD = \
+	$(top_builddir)/lib/cpp/libthrift.la
+
+#
+# AllProtocolsTest
+#
+AllProtocolsTest_SOURCES = \
+	AllProtocolTests.cpp \
+	AllProtocolTests.tcc \
+	GenericHelpers.h
+
+AllProtocolsTest_LDADD = libtestgencpp.la
+
+#
+# DebugProtoTest
+#
+DebugProtoTest_SOURCES = \
+	DebugProtoTest.cpp
+
+DebugProtoTest_LDADD = libtestgencpp.la
+
+
+#
+# JSONProtoTest
+#
+JSONProtoTest_SOURCES = \
+	JSONProtoTest.cpp
+
+JSONProtoTest_LDADD = libtestgencpp.la
+
+#
+# OptionalRequiredTest
+#
+OptionalRequiredTest_SOURCES = \
+	OptionalRequiredTest.cpp
+
+OptionalRequiredTest_LDADD = libtestgencpp.la
+
+
+#
+# Common thrift code generation rules
+#
+THRIFT = $(top_builddir)/compiler/cpp/thrift
+
+gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h: $(top_srcdir)/test/DebugProtoTest.thrift
+	$(THRIFT) --gen cpp:dense $<
+
+gen-cpp/OptionalRequiredTest_types.cpp gen-cpp/OptionalRequiredTest_types.h: $(top_srcdir)/test/OptionalRequiredTest.thrift
+	$(THRIFT) --gen cpp:dense $<
+
+gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp: $(top_srcdir)/test/StressTest.thrift
+	$(THRIFT) --gen cpp:dense $<
+
+gen-cpp/SecondService.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_types.h: $(top_srcdir)/test/ThriftTest.thrift
+	$(THRIFT) --gen cpp:dense $<
+
+INCLUDES = \
+	-I$(top_srcdir)/lib/cpp/src
+
+AM_CPPFLAGS = $(BOOST_CPPFLAGS)
+
+clean-local:
+	$(RM) -r gen-cpp
+
+EXTRA_DIST = \
+	ZlibTest.cpp \
+	DenseProtoTest.cpp \
+	ThriftTest_extras.cpp \
+	DebugProtoTest_extras.cpp
diff --git a/test/OptionalRequiredTest.cpp b/lib/cpp/test/OptionalRequiredTest.cpp
similarity index 100%
rename from test/OptionalRequiredTest.cpp
rename to lib/cpp/test/OptionalRequiredTest.cpp
diff --git a/test/TBufferBaseTest.cpp b/lib/cpp/test/TBufferBaseTest.cpp
similarity index 100%
rename from test/TBufferBaseTest.cpp
rename to lib/cpp/test/TBufferBaseTest.cpp
diff --git a/test/TFDTransportTest.cpp b/lib/cpp/test/TFDTransportTest.cpp
similarity index 100%
rename from test/TFDTransportTest.cpp
rename to lib/cpp/test/TFDTransportTest.cpp
diff --git a/test/TMemoryBufferTest.cpp b/lib/cpp/test/TMemoryBufferTest.cpp
similarity index 100%
rename from test/TMemoryBufferTest.cpp
rename to lib/cpp/test/TMemoryBufferTest.cpp
diff --git a/test/TPipedTransportTest.cpp b/lib/cpp/test/TPipedTransportTest.cpp
similarity index 100%
rename from test/TPipedTransportTest.cpp
rename to lib/cpp/test/TPipedTransportTest.cpp
diff --git a/test/ThriftTest_extras.cpp b/lib/cpp/test/ThriftTest_extras.cpp
similarity index 100%
rename from test/ThriftTest_extras.cpp
rename to lib/cpp/test/ThriftTest_extras.cpp
diff --git a/test/UnitTestMain.cpp b/lib/cpp/test/UnitTestMain.cpp
similarity index 100%
rename from test/UnitTestMain.cpp
rename to lib/cpp/test/UnitTestMain.cpp
diff --git a/test/ZlibTest.cpp b/lib/cpp/test/ZlibTest.cpp
similarity index 100%
rename from test/ZlibTest.cpp
rename to lib/cpp/test/ZlibTest.cpp
diff --git a/test/Makefile.am b/test/Makefile.am
index 5fd4f0d..7256f21 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -27,128 +27,6 @@
 SUBDIRS += rb
 endif
 
-noinst_LTLIBRARIES = libtestgencpp.la
-nodist_libtestgencpp_la_SOURCES = \
-	gen-cpp/DebugProtoTest_types.cpp \
-	gen-cpp/OptionalRequiredTest_types.cpp \
-	gen-cpp/DebugProtoTest_types.cpp \
-	gen-cpp/ThriftTest_types.cpp \
-	gen-cpp/DebugProtoTest_types.h \
-	gen-cpp/OptionalRequiredTest_types.h \
-	gen-cpp/ThriftTest_types.h \
-	ThriftTest_extras.cpp \
-	DebugProtoTest_extras.cpp
-
-ThriftTest_extras.o: gen-cpp/ThriftTest_types.h
-DebugProtoTest_extras.o: gen-cpp/DebugProtoTest_types.h
-
-libtestgencpp_la_LIBADD = $(top_builddir)/lib/cpp/libthrift.la
-
-noinst_PROGRAMS = Benchmark
-
-Benchmark_SOURCES = \
-	Benchmark.cpp
-
-Benchmark_LDADD = libtestgencpp.la
-
-check_PROGRAMS = \
-	TFDTransportTest \
-	TPipedTransportTest \
-	DebugProtoTest \
-	JSONProtoTest \
-	OptionalRequiredTest \
-	AllProtocolsTest \
-	UnitTests
-
-TESTS = \
-	$(check_PROGRAMS)
-
-UnitTests_SOURCES = \
-	UnitTestMain.cpp \
-	TMemoryBufferTest.cpp \
-	TBufferBaseTest.cpp
-
-UnitTests_LDADD = libtestgencpp.la -lboost_unit_test_framework
-
-#
-# TFDTransportTest
-#
-TFDTransportTest_SOURCES = \
-	TFDTransportTest.cpp
-
-TFDTransportTest_LDADD = \
-	$(top_builddir)/lib/cpp/libthrift.la
-
-
-#
-# TPipedTransportTest
-#
-TPipedTransportTest_SOURCES = \
-	TPipedTransportTest.cpp
-
-TPipedTransportTest_LDADD = \
-	$(top_builddir)/lib/cpp/libthrift.la
-
-#
-# AllProtocolsTest
-#
-AllProtocolsTest_SOURCES = \
-	AllProtocolTests.cpp \
-	AllProtocolTests.tcc \
-	GenericHelpers.h
-
-AllProtocolsTest_LDADD = libtestgencpp.la
-
-#
-# DebugProtoTest
-#
-DebugProtoTest_SOURCES = \
-	DebugProtoTest.cpp
-
-DebugProtoTest_LDADD = libtestgencpp.la
-
-
-#
-# JSONProtoTest
-#
-JSONProtoTest_SOURCES = \
-	JSONProtoTest.cpp
-
-JSONProtoTest_LDADD = libtestgencpp.la
-
-#
-# OptionalRequiredTest
-#
-OptionalRequiredTest_SOURCES = \
-	OptionalRequiredTest.cpp
-
-OptionalRequiredTest_LDADD = libtestgencpp.la
-
-
-#
-# Common thrift code generation rules
-#
-THRIFT = $(top_builddir)/compiler/cpp/thrift
-
-gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h: DebugProtoTest.thrift
-	$(THRIFT) --gen cpp:dense $<
-
-gen-cpp/OptionalRequiredTest_types.cpp gen-cpp/OptionalRequiredTest_types.h: OptionalRequiredTest.thrift
-	$(THRIFT) --gen cpp:dense $<
-
-gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp: StressTest.thrift
-	$(THRIFT) --gen cpp:dense $<
-
-gen-cpp/SecondService.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_types.h: ThriftTest.thrift
-	$(THRIFT) --gen cpp:dense $<
-
-INCLUDES = \
-	-I$(top_srcdir)/lib/cpp/src
-
-AM_CPPFLAGS = $(BOOST_CPPFLAGS)
-
-clean-local:
-	$(RM) -r gen-cpp
 
 EXTRA_DIST = \
 	cpp \
@@ -173,9 +51,4 @@
 	SmallTest.thrift \
 	StressTest.thrift \
 	ThriftTest.thrift \
-	ZlibTest.cpp \
-	DenseProtoTest.cpp \
-	FastbinaryTest.py \
-	ThriftTest_extras.cpp \
-	DebugProtoTest_extras.cpp
-
+	FastbinaryTest.py