From: Roger Meier Date: Fri, 11 May 2012 10:12:39 +0000 (+0000) Subject: THRIFT-1336 thrift: added server and processor test code X-Git-Tag: 0.9.1~372 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=2b1a5289a7aa61377f2d20ee8dfffd72310cc886;p=common%2Fthrift.git THRIFT-1336 thrift: added server and processor test code move the tests from src to test: lib\cpp\src\thrift\concurrency\test to lib\cpp\test\concurrency lib\cpp\src\thrift\processor\test to lib\cpp\test\processor git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1337098 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am index 6e2b2baf..4834e9f0 100755 --- a/lib/cpp/Makefile.am +++ b/lib/cpp/Makefile.am @@ -207,52 +207,8 @@ include_qt_HEADERS = \ src/thrift/qt/TQIODeviceTransport.h \ src/thrift/qt/TQTcpServer.h - -noinst_PROGRAMS = concurrency_test \ - processor_test - -concurrency_test_SOURCES = \ - src/thrift/concurrency/test/Tests.cpp \ - src/thrift/concurrency/test/ThreadFactoryTests.h \ - src/thrift/concurrency/test/ThreadManagerTests.h \ - src/thrift/concurrency/test/TimerManagerTests.h - -concurrency_test_LDADD = libthrift.la - -processor_test_SOURCES = src/thrift/processor/test/ProcessorTest.cpp \ - src/thrift/processor/test/EventLog.cpp \ - src/thrift/processor/test/ServerThread.cpp \ - src/thrift/processor/test/EventLog.h \ - src/thrift/processor/test/Handlers.h \ - src/thrift/processor/test/ServerThread.h - -processor_test_LDADD = libprocessortest.la \ - libthrift.la \ - libthriftnb.la \ - $(BOOST_LDFLAGS) \ - -levent \ - $(BOOST_ROOT_PATH)/lib/libboost_unit_test_framework.a - -check_PROGRAMS = \ - concurrency_test \ - processor_test - -TESTS = \ - $(check_PROGRAMS) - -noinst_LTLIBRARIES = libprocessortest.la - THRIFT = $(top_builddir)/compiler/cpp/thrift -gen-cpp/ChildService.cpp: $(top_srcdir)/lib/cpp/src/thrift/processor/test/proc.thrift - $(THRIFT) --gen cpp:templates,cob_style $< - -nodist_libprocessortest_la_SOURCES = \ - src/thrift/processor/test/gen-cpp/ChildService.h \ - src/thrift/processor/test/gen-cpp/ChildService.cpp \ - src/thrift/processor/test/gen-cpp/ParentService.h \ - src/thrift/processor/test/gen-cpp/ParentService.cpp - WINDOWS_DIST = \ README_WINDOWS \ src/thrift/windows \ diff --git a/lib/cpp/test/Makefile.am b/lib/cpp/test/Makefile.am old mode 100644 new mode 100755 index bf419354..f7b1c26c --- a/lib/cpp/test/Makefile.am +++ b/lib/cpp/test/Makefile.am @@ -17,7 +17,7 @@ # under the License. # -noinst_LTLIBRARIES = libtestgencpp.la +noinst_LTLIBRARIES = libtestgencpp.la libprocessortest.la nodist_libtestgencpp_la_SOURCES = \ gen-cpp/DebugProtoTest_types.cpp \ gen-cpp/OptionalRequiredTest_types.cpp \ @@ -29,6 +29,14 @@ nodist_libtestgencpp_la_SOURCES = \ ThriftTest_extras.cpp \ DebugProtoTest_extras.cpp +nodist_libprocessortest_la_SOURCES = \ + gen-cpp/ChildService.cpp \ + gen-cpp/ChildService.h \ + gen-cpp/ParentService.cpp \ + gen-cpp/ParentService.h \ + gen-cpp/proc_types.cpp \ + gen-cpp/proc_types.h + ThriftTest_extras.o: gen-cpp/ThriftTest_types.h DebugProtoTest_extras.o: gen-cpp/DebugProtoTest_types.h @@ -52,7 +60,9 @@ check_PROGRAMS = \ TransportTest \ ZlibTest \ TFileTransportTest \ - UnitTests + UnitTests \ + concurrency_test \ + processor_test TESTS_ENVIRONMENT= \ BOOST_TEST_LOG_SINK=tests.xml \ @@ -163,7 +173,29 @@ SpecializationTest_SOURCES = \ SpecializationTest_LDADD = libtestgencpp.la - +concurrency_test_SOURCES = \ + concurrency/Tests.cpp \ + concurrency/ThreadFactoryTests.h \ + concurrency/ThreadManagerTests.h \ + concurrency/TimerManagerTests.h + +concurrency_test_LDADD = \ + $(top_builddir)/lib/cpp/libthrift.la + +processor_test_SOURCES = \ + processor/ProcessorTest.cpp \ + processor/EventLog.cpp \ + processor/ServerThread.cpp \ + processor/EventLog.h \ + processor/Handlers.h \ + processor/ServerThread.h + +processor_test_LDADD = libprocessortest.la \ + $(top_builddir)/lib/cpp/libthrift.la \ + $(top_builddir)/lib/cpp/libthriftnb.la \ + $(BOOST_LDFLAGS) \ + -levent \ + $(BOOST_ROOT_PATH)/lib/libboost_unit_test_framework.a # # Common thrift code generation rules # @@ -181,6 +213,9 @@ gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp: $(top_srcdir)/test/StressTest. 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 $< +gen-cpp/ChildService.cpp: processor/proc.thrift + $(THRIFT) --gen cpp:templates,cob_style $< + INCLUDES = \ -I$(top_srcdir)/lib/cpp/src diff --git a/lib/cpp/src/thrift/concurrency/test/Tests.cpp b/lib/cpp/test/concurrency/Tests.cpp similarity index 100% rename from lib/cpp/src/thrift/concurrency/test/Tests.cpp rename to lib/cpp/test/concurrency/Tests.cpp diff --git a/lib/cpp/src/thrift/concurrency/test/ThreadFactoryTests.h b/lib/cpp/test/concurrency/ThreadFactoryTests.h similarity index 100% rename from lib/cpp/src/thrift/concurrency/test/ThreadFactoryTests.h rename to lib/cpp/test/concurrency/ThreadFactoryTests.h diff --git a/lib/cpp/src/thrift/concurrency/test/ThreadManagerTests.h b/lib/cpp/test/concurrency/ThreadManagerTests.h similarity index 100% rename from lib/cpp/src/thrift/concurrency/test/ThreadManagerTests.h rename to lib/cpp/test/concurrency/ThreadManagerTests.h diff --git a/lib/cpp/src/thrift/concurrency/test/TimerManagerTests.h b/lib/cpp/test/concurrency/TimerManagerTests.h similarity index 100% rename from lib/cpp/src/thrift/concurrency/test/TimerManagerTests.h rename to lib/cpp/test/concurrency/TimerManagerTests.h diff --git a/lib/cpp/src/thrift/processor/test/EventLog.cpp b/lib/cpp/test/processor/EventLog.cpp old mode 100644 new mode 100755 similarity index 98% rename from lib/cpp/src/thrift/processor/test/EventLog.cpp rename to lib/cpp/test/processor/EventLog.cpp index 7d27569a..0ac3028a --- a/lib/cpp/src/thrift/processor/test/EventLog.cpp +++ b/lib/cpp/test/processor/EventLog.cpp @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -#include "processor/test/EventLog.h" +#include "EventLog.h" #include diff --git a/lib/cpp/src/thrift/processor/test/EventLog.h b/lib/cpp/test/processor/EventLog.h old mode 100644 new mode 100755 similarity index 98% rename from lib/cpp/src/thrift/processor/test/EventLog.h rename to lib/cpp/test/processor/EventLog.h index 007b6660..d731cec2 --- a/lib/cpp/src/thrift/processor/test/EventLog.h +++ b/lib/cpp/test/processor/EventLog.h @@ -19,7 +19,7 @@ #ifndef _THRIFT_TEST_EVENTLOG_H_ #define _THRIFT_TEST_EVENTLOG_H_ 1 -#include "concurrency/Monitor.h" +#include namespace apache { namespace thrift { namespace test { diff --git a/lib/cpp/src/thrift/processor/test/Handlers.h b/lib/cpp/test/processor/Handlers.h old mode 100644 new mode 100755 similarity index 99% rename from lib/cpp/src/thrift/processor/test/Handlers.h rename to lib/cpp/test/processor/Handlers.h index a4f5070e..2be262af --- a/lib/cpp/src/thrift/processor/test/Handlers.h +++ b/lib/cpp/test/processor/Handlers.h @@ -19,7 +19,7 @@ #ifndef _THRIFT_PROCESSOR_TEST_HANDLERS_H_ #define _THRIFT_PROCESSOR_TEST_HANDLERS_H_ 1 -#include "processor/test/EventLog.h" +#include "EventLog.h" #include "gen-cpp/ParentService.h" #include "gen-cpp/ChildService.h" diff --git a/lib/cpp/src/thrift/processor/test/ProcessorTest.cpp b/lib/cpp/test/processor/ProcessorTest.cpp similarity index 99% rename from lib/cpp/src/thrift/processor/test/ProcessorTest.cpp rename to lib/cpp/test/processor/ProcessorTest.cpp index fd43d14f..58b82fbe 100755 --- a/lib/cpp/src/thrift/processor/test/ProcessorTest.cpp +++ b/lib/cpp/test/processor/ProcessorTest.cpp @@ -35,9 +35,9 @@ #include #include -#include -#include -#include +#include "EventLog.h" +#include "ServerThread.h" +#include "Handlers.h" #include "gen-cpp/ChildService.h" using namespace std; diff --git a/lib/cpp/src/thrift/processor/test/ServerThread.cpp b/lib/cpp/test/processor/ServerThread.cpp old mode 100644 new mode 100755 similarity index 94% rename from lib/cpp/src/thrift/processor/test/ServerThread.cpp rename to lib/cpp/test/processor/ServerThread.cpp index d90fdf3e..9f2087c8 --- a/lib/cpp/src/thrift/processor/test/ServerThread.cpp +++ b/lib/cpp/test/processor/ServerThread.cpp @@ -19,13 +19,13 @@ #ifndef _THRIFT_TEST_SERVERTHREAD_TCC_ #define _THRIFT_TEST_SERVERTHREAD_TCC_ 1 -#include "processor/test/ServerThread.h" +#include "ServerThread.h" -#include "concurrency/PosixThreadFactory.h" -#include "concurrency/ThreadManager.h" -#include "server/TThreadPoolServer.h" -#include "transport/TBufferTransports.h" -#include "transport/TServerSocket.h" +#include +#include +#include +#include +#include namespace apache { namespace thrift { namespace test { diff --git a/lib/cpp/src/thrift/processor/test/ServerThread.h b/lib/cpp/test/processor/ServerThread.h old mode 100644 new mode 100755 similarity index 95% rename from lib/cpp/src/thrift/processor/test/ServerThread.h rename to lib/cpp/test/processor/ServerThread.h index 76ceded8..0dd51279 --- a/lib/cpp/src/thrift/processor/test/ServerThread.h +++ b/lib/cpp/test/processor/ServerThread.h @@ -19,12 +19,12 @@ #ifndef _THRIFT_TEST_SERVERTHREAD_H_ #define _THRIFT_TEST_SERVERTHREAD_H_ 1 -#include "TProcessor.h" -#include "protocol/TProtocol.h" -#include "server/TServer.h" -#include "transport/TTransport.h" +#include +#include +#include +#include -#include "processor/test/EventLog.h" +#include "EventLog.h" namespace apache { namespace thrift { namespace test { diff --git a/lib/cpp/src/thrift/processor/test/proc.thrift b/lib/cpp/test/processor/proc.thrift similarity index 100% rename from lib/cpp/src/thrift/processor/test/proc.thrift rename to lib/cpp/test/processor/proc.thrift