Thrift: "make check" support.

Summary:
Add a Makefile.am in the test directory that runs some of the test programs
when "make check" is executed.  Also removed some obsolete comments.

Reviewed By: mcslee

Test Plan:
Ran make check, saw all tests pass.
Ran make install, saw no test programs installed.
Ran ./cleanup.sh, saw a pristine workspace.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665458 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/Makefile.am b/Makefile.am
index 6bcb61f..30398bc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
 ACLOCAL_AMFLAGS = -I ./aclocal
 
-SUBDIRS = compiler/cpp lib if
+SUBDIRS = compiler/cpp lib if test
 ## Don't run make dist from a subversion working copy
 ## because it will pull in your .svn directories.
 EXTRA_DIST = bootstrap.sh cleanup.sh doc test tutorial \
diff --git a/cleanup.sh b/cleanup.sh
index 878bf62..4760f43 100755
--- a/cleanup.sh
+++ b/cleanup.sh
@@ -33,4 +33,5 @@
 if/Makefile.in \
 lib/Makefile.in \
 lib/cpp/Makefile.in \
-lib/py/Makefile.in
+lib/py/Makefile.in \
+test/Makefile.in
diff --git a/configure.ac b/configure.ac
index 9e68a5d..de9d704 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,6 +106,7 @@
   lib/cpp/thrift-z.pc
   lib/py/Makefile
   if/Makefile
+  test/Makefile
 ])
 
 AC_OUTPUT
diff --git a/test/DebugProtoTest.cpp b/test/DebugProtoTest.cpp
index bae2a16..d736d95 100644
--- a/test/DebugProtoTest.cpp
+++ b/test/DebugProtoTest.cpp
@@ -1,11 +1,3 @@
-/*
-thrift -cpp DebugProtoTest.thrift
-g++ -Wall -g -I../lib/cpp/src -I/usr/local/include/boost-1_33_1 \
-  DebugProtoTest.cpp gen-cpp/DebugProtoTest_types.cpp \
-  ../lib/cpp/.libs/libthrift.a -o DebugProtoTest
-./DebugProtoTest
-*/
-
 #include <iostream>
 #include <cmath>
 #include "gen-cpp/DebugProtoTest_types.h"
diff --git a/test/DebugProtoTest.thrift b/test/DebugProtoTest.thrift
index e669fb3..aa3ecef 100644
--- a/test/DebugProtoTest.thrift
+++ b/test/DebugProtoTest.thrift
@@ -1,11 +1,3 @@
-/*
-thrift -cpp DebugProtoTest.thrift
-g++ -Wall -g -I../lib/cpp/src -I/usr/local/include/boost-1_33_1 \
-  DebugProtoTest.cpp gen-cpp/DebugProtoTest_types.cpp \
-  ../lib/cpp/.libs/libthrift.a -o DebugProtoTest
-./DebugProtoTest
-*/
-
 cpp_namespace thrift.test
 
 struct OneOfEach {
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 0000000..1a95001
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,67 @@
+check_PROGRAMS = \
+	DebugProtoTest \
+	OptionalRequiredTest \
+	ReflectionTest
+
+TESTS = \
+	$(check_PROGRAMS)
+
+
+#
+# DebugProtoTest
+#
+DebugProtoTest_SOURCES = \
+	gen-cpp/DebugProtoTest_types.cpp \
+	DebugProtoTest.cpp
+
+DebugProtoTest_LDADD = \
+	$(top_srcdir)/lib/cpp/libthrift.la
+
+
+#
+# OptionalRequiredTest
+#
+OptionalRequiredTest_SOURCES = \
+	gen-cpp/OptionalRequiredTest_types.cpp \
+	OptionalRequiredTest.cpp
+
+OptionalRequiredTest_LDADD = \
+	$(top_srcdir)/lib/cpp/libthrift.la
+
+
+#
+# ReflectionTest
+#
+ReflectionTest_SOURCES = \
+	gen-cpp/DebugProtoTest_types.cpp \
+	gen-cpp/PartiallyReflectable.cpp \
+	gen-cpp/Service.cpp \
+	gen-cpp/StressTest_types.cpp \
+	ReflectionTest.cpp
+
+ReflectionTest_LDADD = \
+	$(top_srcdir)/lib/cpp/libthrift.la
+
+
+#
+# Common thrift code generation rules
+#
+THRIFT = $(top_srcdir)/compiler/cpp/thrift
+
+gen-cpp/DebugProtoTest_types.cpp gen-cpp/PartiallyReflectable.cpp: DebugProtoTest.thrift
+	$(THRIFT) -cpp $<
+
+gen-cpp/OptionalRequiredTest_types.cpp: OptionalRequiredTest.thrift
+	$(THRIFT) -cpp $<
+
+gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp: StressTest.thrift
+	$(THRIFT) -cpp $<
+
+
+INCLUDES = \
+	-I$(top_srcdir)/lib/cpp/src
+
+AM_CPPFLAGS = $(BOOST_CPPFLAGS)
+
+clean-local:
+	rm -rf gen-cpp
diff --git a/test/OptionalRequiredTest.cpp b/test/OptionalRequiredTest.cpp
index 643cbe9..1fbc1f8 100644
--- a/test/OptionalRequiredTest.cpp
+++ b/test/OptionalRequiredTest.cpp
@@ -1,11 +1,3 @@
-/*
-../compiler/cpp/thrift -cpp OptionalRequiredTest.thrift
-g++ -Wall -g -I../lib/cpp/src -I/usr/local/include/boost-1_33_1 \
-  OptionalRequiredTest.cpp gen-cpp/OptionalRequiredTest_types.cpp \
-  ../lib/cpp/.libs/libthrift.a -o OptionalRequiredTest
-./OptionalRequiredTest
-*/
-
 #include <cassert>
 #include <map>
 #include <iostream>
diff --git a/test/OptionalRequiredTest.thrift b/test/OptionalRequiredTest.thrift
index 431a0b0..42e7879 100644
--- a/test/OptionalRequiredTest.thrift
+++ b/test/OptionalRequiredTest.thrift
@@ -1,11 +1,3 @@
-/*
-../compiler/cpp/thrift -cpp OptionalRequiredTest.thrift
-g++ -Wall -g -I../lib/cpp/src -I/usr/local/include/boost-1_33_1 \
-  OptionalRequiredTest.cpp gen-cpp/OptionalRequiredTest_types.cpp \
-  ../lib/cpp/.libs/libthrift.a -o OptionalRequiredTest
-./OptionalRequiredTest
-*/
-
 cpp_namespace thrift.test
 
 struct OldSchool {
diff --git a/test/ReflectionTest.cpp b/test/ReflectionTest.cpp
index 614c613..8193a3e 100644
--- a/test/ReflectionTest.cpp
+++ b/test/ReflectionTest.cpp
@@ -1,14 +1,3 @@
-/*
-../compiler/cpp/thrift -cpp DebugProtoTest.thrift
-../compiler/cpp/thrift -cpp StressTest.thrift
-g++ -Wall -I../lib/cpp/src -I/usr/local/include/boost-1_33_1 \
-  ReflectionTest.cpp \
-  gen-cpp/StressTest_types.cpp gen-cpp/DebugProtoTest_types.cpp \
-  gen-cpp/Service.cpp gen-cpp/PartiallyReflectable.cpp \
-  ../lib/cpp/.libs/libthrift.a -o ReflectionTest
-./ReflectionTest
-*/
-
 #include <iostream>
 #include "gen-cpp/PartiallyReflectable.h"
 #include "gen-cpp/Service.h"