diff options
author | dbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-11-25 09:05:43 +0000 |
---|---|---|
committer | dbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-11-25 09:05:43 +0000 |
commit | 7e8d69a1ed9b5e42c558f6c7b10682026dcf0886 (patch) | |
tree | dd8eba54b56000bcd480b2b09d154401d69898b6 | |
parent | 40afae5466f45c21e7cb635222cf1368202c640a (diff) | |
download | ATCD-7e8d69a1ed9b5e42c558f6c7b10682026dcf0886.tar.gz |
Wed Nov 25 09:01:20 UTC 2009 Denis Budko <denis.budko@remedy.nl>
* orbsvcs/DevGuideExamples/ValueTypes/Notify/supplier.cpp:
* orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp:
* orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl:
* orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp:
* orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp:
* orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl:
* orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp:
* orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp:
* orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl:
* orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp:
* orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp:
* orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl:
* orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl:
* orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp:
* orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp:
* orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl:
* orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp:
* orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl:
* orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp:
* orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl:
* orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp:
* orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp:
* orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl:
* orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp:
* orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp:
* orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp:
* orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl:
* orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp:
* orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl:
* orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl:
* orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl:
* orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl:
* orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp:
* orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp:
* orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl:
* orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl:
* orbsvcs/tests/Notify/Bug_3646c_Regression/server.cpp:
* orbsvcs/tests/Notify/Bug_3646c_Regression/run_test.pl:
* orbsvcs/tests/InterfaceRepo/Bug_3200_Regression/run_test.pl:
* orbsvcs/tests/InterfaceRepo/IDL3_Test/run_test.pl:
* orbsvcs/tests/InterfaceRepo/Bug_3495_Regression/run_test.pl:
* orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.cpp:
* orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp:
* orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.h:
* orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl:
* orbsvcs/examples/Log/Basic/run_test.pl:
* orbsvcs/examples/Log/Event/run_test.pl:
* orbsvcs/examples/Log/RTEvent/run_test.pl:
* orbsvcs/examples/Log/Notify/run_test.pl:
* orbsvcs/examples/CosEC/TypedSimple/Consumer.cpp:
* orbsvcs/examples/CosEC/TypedSimple/run_test.pl:
* orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test2.pl:
* orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test.pl:
* orbsvcs/examples/LoadBalancing/run_test.pl:
* performance-tests/Sequence_Latency/DSI/run_test.pl:
* performance-tests/Sequence_Latency/Deferred/run_test.pl:
* performance-tests/Sequence_Latency/Thread_Pool/run_test.pl:
* performance-tests/Sequence_Latency/Single_Threaded/default_configuration.pl:
* performance-tests/Sequence_Latency/Single_Threaded/run_test.pl:
* performance-tests/Sequence_Latency/DII/run_test.pl:
* performance-tests/Sequence_Latency/AMH_Single_Threaded/run_test.pl:
* performance-tests/Sequence_Latency/AMI/run_test.pl:
* performance-tests/Sequence_Latency/Thread_Per_Connection/run_test.pl:
* performance-tests/RTCorba/Oneways/Reliable/client_test.pl:
* performance-tests/RTCorba/Oneways/Reliable/server.cpp:
* performance-tests/RTCorba/Oneways/Reliable/run_test.pl:
* performance-tests/Latency/Thread_Pool/run_test.pl:
* performance-tests/Latency/Single_Threaded/default_configuration.pl:
* performance-tests/Latency/Single_Threaded/run_test.pl:
* performance-tests/Latency/Thread_Per_Connection/run_test.pl:
* tests/GIOP_Fragments/Java_Big_Request/run_test.pl:
* tests/GIOP_Fragments/Java_Big_Reply/run_test.pl:
* examples/CSD_Strategy/ThreadPool2/run_test.pl:
* examples/CSD_Strategy/ThreadPool4/run_test.pl:
* examples/CSD_Strategy/ThreadPool5/run_test.pl:
* examples/CSD_Strategy/ThreadPool6/run_test.pl:
Tests are converted to use new test framework and added to fuzz build.
78 files changed, 5771 insertions, 1941 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index b4de33081cd..70abcf31a0c 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,84 @@ +Wed Nov 25 09:01:20 UTC 2009 Denis Budko <denis.budko@remedy.nl> + + * orbsvcs/DevGuideExamples/ValueTypes/Notify/supplier.cpp: + * orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp: + * orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl: + * orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp: + * orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp: + * orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl: + * orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp: + * orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp: + * orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl: + * orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp: + * orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp: + * orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl: + * orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl: + * orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp: + * orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp: + * orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl: + * orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp: + * orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl: + * orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp: + * orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl: + * orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp: + * orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp: + * orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl: + * orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp: + * orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp: + * orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp: + * orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl: + * orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp: + * orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl: + * orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl: + * orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl: + * orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl: + * orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp: + * orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp: + * orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl: + * orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl: + * orbsvcs/tests/Notify/Bug_3646c_Regression/server.cpp: + * orbsvcs/tests/Notify/Bug_3646c_Regression/run_test.pl: + * orbsvcs/tests/InterfaceRepo/Bug_3200_Regression/run_test.pl: + * orbsvcs/tests/InterfaceRepo/IDL3_Test/run_test.pl: + * orbsvcs/tests/InterfaceRepo/Bug_3495_Regression/run_test.pl: + * orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.cpp: + * orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp: + * orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.h: + * orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl: + * orbsvcs/examples/Log/Basic/run_test.pl: + * orbsvcs/examples/Log/Event/run_test.pl: + * orbsvcs/examples/Log/RTEvent/run_test.pl: + * orbsvcs/examples/Log/Notify/run_test.pl: + * orbsvcs/examples/CosEC/TypedSimple/Consumer.cpp: + * orbsvcs/examples/CosEC/TypedSimple/run_test.pl: + * orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test2.pl: + * orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test.pl: + * orbsvcs/examples/LoadBalancing/run_test.pl: + * performance-tests/Sequence_Latency/DSI/run_test.pl: + * performance-tests/Sequence_Latency/Deferred/run_test.pl: + * performance-tests/Sequence_Latency/Thread_Pool/run_test.pl: + * performance-tests/Sequence_Latency/Single_Threaded/default_configuration.pl: + * performance-tests/Sequence_Latency/Single_Threaded/run_test.pl: + * performance-tests/Sequence_Latency/DII/run_test.pl: + * performance-tests/Sequence_Latency/AMH_Single_Threaded/run_test.pl: + * performance-tests/Sequence_Latency/AMI/run_test.pl: + * performance-tests/Sequence_Latency/Thread_Per_Connection/run_test.pl: + * performance-tests/RTCorba/Oneways/Reliable/client_test.pl: + * performance-tests/RTCorba/Oneways/Reliable/server.cpp: + * performance-tests/RTCorba/Oneways/Reliable/run_test.pl: + * performance-tests/Latency/Thread_Pool/run_test.pl: + * performance-tests/Latency/Single_Threaded/default_configuration.pl: + * performance-tests/Latency/Single_Threaded/run_test.pl: + * performance-tests/Latency/Thread_Per_Connection/run_test.pl: + * tests/GIOP_Fragments/Java_Big_Request/run_test.pl: + * tests/GIOP_Fragments/Java_Big_Reply/run_test.pl: + * examples/CSD_Strategy/ThreadPool2/run_test.pl: + * examples/CSD_Strategy/ThreadPool4/run_test.pl: + * examples/CSD_Strategy/ThreadPool5/run_test.pl: + * examples/CSD_Strategy/ThreadPool6/run_test.pl: + + Tests are converted to use new test framework and added to fuzz build. + Tue Nov 24 13:12:18 UTC 2009 Vladimir Zykov <vladimir.zykov@prismtech.com> * tao/RTCORBA/RT_ORB_Loader.cpp: diff --git a/TAO/bin/tao_other_tests.lst b/TAO/bin/tao_other_tests.lst index a220c59cebc..ffd48d3bf03 100644 --- a/TAO/bin/tao_other_tests.lst +++ b/TAO/bin/tao_other_tests.lst @@ -11,23 +11,23 @@ # TAO's. Please do not include regular tests here. TAO/performance-tests/Cubit/TAO/IDL_Cubit/run_test.pl: !LynxOS !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !Win32 !ACE_FOR_TAO !OpenVMS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/performance-tests/Cubit/TAO/MT_Cubit/run_test.pl: !ST !OpenBSD !Win32 !ACE_FOR_TAO !OpenVMS !CORBA_E_MICRO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/performance-tests/Latency/Single_Threaded/run_test.pl -n 1000: !Win32 !ACE_FOR_TAO !OpenVMS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/performance-tests/Latency/Thread_Pool/run_test.pl -n 1000: !ST !Win32 !ACE_FOR_TAO !OpenVMS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/performance-tests/Latency/Thread_Per_Connection/run_test.pl -n 1000: !ST !Win32 !ACE_FOR_TAO !OpenVMS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ +TAO/performance-tests/Latency/Single_Threaded/run_test.pl -n 1000: !Win32 !ACE_FOR_TAO !OpenVMS +TAO/performance-tests/Latency/Thread_Pool/run_test.pl -n 1000: !ST !Win32 !ACE_FOR_TAO !OpenVMS +TAO/performance-tests/Latency/Thread_Per_Connection/run_test.pl -n 1000: !ST !Win32 !ACE_FOR_TAO !OpenVMS TAO/performance-tests/Latency/AMI/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !Win32 !ACE_FOR_TAO !OpenVMS TAO/performance-tests/Latency/DSI/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !Win32 !ACE_FOR_TAO !OpenVMS TAO/performance-tests/Latency/DII/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !Win32 !ACE_FOR_TAO !OpenVMS TAO/performance-tests/Latency/Deferred/run_test.pl: !QNX !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !Win32 !ACE_FOR_TAO !OpenVMS -TAO/performance-tests/Sequence_Latency/Single_Threaded/run_test.pl: !Win32 !ACE_FOR_TAO !OpenVMS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/performance-tests/Sequence_Latency/Thread_Pool/run_test.pl: !ST !Win32 !ACE_FOR_TAO !OpenVMS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/performance-tests/Sequence_Latency/Thread_Per_Connection/run_test.pl: !ST !Win32 !ACE_FOR_TAO !OpenVMS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/performance-tests/Sequence_Latency/AMI/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !Win32 !ACE_FOR_TAO !OpenVMS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/performance-tests/Sequence_Latency/DSI/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !Win32 !ACE_FOR_TAO !OpenVMS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/performance-tests/Sequence_Latency/DII/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !Win32 !ACE_FOR_TAO !OpenVMS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/performance-tests/Sequence_Latency/Deferred/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !Win32 !ACE_FOR_TAO !OpenVMS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ +TAO/performance-tests/Sequence_Latency/Single_Threaded/run_test.pl: !Win32 !ACE_FOR_TAO !OpenVMS +TAO/performance-tests/Sequence_Latency/Thread_Pool/run_test.pl: !ST !Win32 !ACE_FOR_TAO !OpenVMS +TAO/performance-tests/Sequence_Latency/Thread_Per_Connection/run_test.pl: !ST !Win32 !ACE_FOR_TAO !OpenVMS +TAO/performance-tests/Sequence_Latency/AMI/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !Win32 !ACE_FOR_TAO !OpenVMS +TAO/performance-tests/Sequence_Latency/DSI/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !Win32 !ACE_FOR_TAO !OpenVMS +TAO/performance-tests/Sequence_Latency/DII/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !Win32 !ACE_FOR_TAO !OpenVMS +TAO/performance-tests/Sequence_Latency/Deferred/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !Win32 !ACE_FOR_TAO !OpenVMS TAO/performance-tests/Throughput/run_test.pl: !Win32 !ACE_FOR_TAO !OpenVMS TAO/performance-tests/POA/Object_Creation_And_Registration/run_test.pl: !Win32 !ACE_FOR_TAO !OpenVMS !CORBA_E_MICRO -TAO/performance-tests/RTCorba/Oneways/Reliable/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !Win32 !OpenVMS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !LynxOS +TAO/performance-tests/RTCorba/Oneways/Reliable/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !Win32 !OpenVMS !LynxOS TAO/performance-tests/Protocols/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !Win32 !ACE_FOR_TAO !OpenVMS !LynxOS TAO/examples/Simple/bank/run_test.pl: !NO_MESSAGING !CORBA_E_MICRO TAO/examples/Simple/grid/run_test.pl: !NO_MESSAGING !CORBA_E_MICRO @@ -93,8 +93,8 @@ TAO/orbsvcs/tests/FaultTolerance/GroupRef_Manipulation/run_test.pl:!MINIMUM !COR TAO/orbsvcs/tests/FaultTolerance/IOGR/run_test.pl:!MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/FaultTolerance/IOGRManipulation/run_test.pl:!MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS !ACE_FOR_TAO TAO/orbsvcs/tests/Bug_2137_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS !ACE_FOR_TAO -TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !NO_IFR !STATIC !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/orbsvcs/tests/InterfaceRepo/IDL3_Test/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !NO_IFR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ +TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !NO_IFR !STATIC !ACE_FOR_TAO +TAO/orbsvcs/tests/InterfaceRepo/IDL3_Test/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !NO_IFR !ACE_FOR_TAO TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !NO_IFR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !NO_IFR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !NO_IFR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ @@ -103,7 +103,7 @@ TAO/orbsvcs/tests/InterfaceRepo/Union_Forward_Test/run_test.pl: !MINIMUM !CORBA TAO/orbsvcs/tests/InterfaceRepo/Bug_2962_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !NO_IFR !ACE_FOR_TAO TAO/orbsvcs/tests/InterfaceRepo/Bug_3155_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !NO_IFR !ACE_FOR_TAO TAO/orbsvcs/tests/InterfaceRepo/Bug_3174_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !NO_IFR !ACE_FOR_TAO -TAO/orbsvcs/tests/InterfaceRepo/Bug_3495_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !NO_IFR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ +TAO/orbsvcs/tests/InterfaceRepo/Bug_3495_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !NO_IFR !ACE_FOR_TAO TAO/orbsvcs/tests/InterfaceRepo/IFR_Self_Recursive_IDL_Test/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !NO_IFR !STATIC !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/ImplRepo/run_test.pl both_ir: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/ImplRepo/run_test.pl nestea_ir: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ @@ -121,7 +121,7 @@ TAO/orbsvcs/tests/ImplRepo/ReconnectServer/run_test.pl: !MINIMUM !CORBA_E_COMPAC TAO/orbsvcs/tests/ImplRepo/ReconnectServer/run_test.pl -forwardalways: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !LynxOS TAO/orbsvcs/tests/ImplRepo/ReconnectServer/run_test.pl -forwardonce: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !LynxOS TAO/orbsvcs/examples/ImR/Combined_Service/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ST !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/examples/CosEC/TypedSimple/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_IFR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !WCHAR +TAO/orbsvcs/examples/CosEC/TypedSimple/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_IFR !ACE_FOR_TAO !WCHAR TAO/orbsvcs/tests/CosEvent/Timeout/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !NO_MESSAGING !ACE_FOR_TAO !LynxOS TAO/orbsvcs/tests/Log/Basic_Log_Test/run_test.pl: !NO_MESSAGING !ACE_FOR_TAO !CORBA_E_MICRO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/Notify/Basic/run_test.pl notify.reactive.conf: !ST !NO_MESSAGING !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !LynxOS @@ -154,7 +154,7 @@ TAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl: !ST !NO_MESSAGING !MIN TAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl -p: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/Notify/Bug_3646a_Regression/run_test.pl: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO TAO/orbsvcs/tests/Notify/Bug_3646b_Regression/run_test.pl: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/orbsvcs/tests/Notify/Bug_3646c_Regression/run_test.pl: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ +TAO/orbsvcs/tests/Notify/Bug_3646c_Regression/run_test.pl: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO TAO/orbsvcs/tests/Notify/Bug_3646d_Regression/run_test.pl: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO TAO/orbsvcs/tests/Notify/Bug_3663_Regression/run_test.pl: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO !FIXED_BUGS_ONLY TAO/orbsvcs/tests/Notify/Bug_2926_Regression/run_test.pl: !ST !NO_MESSAGING !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !LynxOS @@ -225,22 +225,22 @@ TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Federated/run_test.pl: !ST !NO_M TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Filter/run_test.pl: !NO_MESSAGING !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !LynxOS TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_MCast_Federated/run_test.pl: !NO_MCAST !NO_MESSAGING !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !LynxOS TAO/orbsvcs/DevGuideExamples/ImplRepo/run_test.pl: !MINIMUM !STATIC !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !LynxOS -TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl: !ST !MINIMUM !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl: !ST !MINIMUM !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl: !ST !MINIMUM !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl: !ST !MINIMUM !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl: !ST !MINIMUM !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl: !MINIMUM !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl: !ST !MINIMUM !STATIC !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS +TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS +TAO/orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS +TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS +TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS +TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS +TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS +TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl: !ST !MINIMUM !STATIC !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/run_test.pl: SSL !STATIC !DISABLE_INTERCEPTORS -TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl: SSL !STATIC !DISABLE_INTERCEPTORS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl: SSL !STATIC !DISABLE_INTERCEPTORS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl: !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl: !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl: !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS +TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl: SSL !STATIC !DISABLE_INTERCEPTORS +TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl: SSL !STATIC !DISABLE_INTERCEPTORS +TAO/orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl: !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS +TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl: !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS +TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl: !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Server/run_test.pl: !ST !NO_MCAST !NO_MESSAGING !CORBA_E_COMPACT !CORBA_E_MICRO -TAO/orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl: !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl: !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl: !ST !MINIMUM !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS +TAO/orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl: !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS +TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl: !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS +TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS TAO/orbsvcs/DevGuideExamples/InterfaceRepo/run_test.pl: !MINIMUM !NO_IFR !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO -TAO/orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl: !MINIMUM !DISABLE_INTERCEPTORS !LabVIEW_RT !WinCE !FUZZ !VxWorks !VxWorks_RTP !LynxOS +TAO/orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl: !MINIMUM !DISABLE_INTERCEPTORS !LynxOS diff --git a/TAO/examples/CSD_Strategy/ThreadPool2/run_test.pl b/TAO/examples/CSD_Strategy/ThreadPool2/run_test.pl index 160a0133adb..6f43ddda407 100755 --- a/TAO/examples/CSD_Strategy/ThreadPool2/run_test.pl +++ b/TAO/examples/CSD_Strategy/ThreadPool2/run_test.pl @@ -6,77 +6,133 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; +$debug_level = '0'; -$iorfname_prefix = "server"; -$num_servants=10; -$num_clients_per_servant=4; -$num_clients=$num_servants * $num_clients_per_servant; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -#Delete old ior files. -for (my $i = 0; $i < $num_servants; $i++) { - $servant_id = sprintf("%02d", ($i + 1)); - $iorfile[$i] = PerlACE::LocalFile($iorfname_prefix . "_$servant_id.ior"); - - unlink $iorfile[$i]; +my $iorfname_prefix = "server"; +my $num_servants = 10; +my $num_clients_per_servant = 4; +my $num_clients = $num_servants * $num_clients_per_servant; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + +$SV = $server->CreateProcess("server_main", "-p $iorfname_prefix ". + "-s $num_servants -c $num_clients"); + +my @clients = (); +for ($i = 0; $i < $num_clients; $i++) { + $clients[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target $i+1 failed\n"; } -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server_main", "-p $iorfname_prefix -s $num_servants -c $num_clients"); +#Delete old ior files. +my @iorfiles = (); +my @server_iorfiles = (); +for ($i = 0; $i < $num_servants; $i++) { + $servant_id = sprintf("%02d", ($i + 1)); + $iorfiles[$i] = $iorfname_prefix . "_$servant_id.ior"; + $server_iorfiles[$i] = $server->LocalFile($iorfiles[$i]); + $server->DeleteFile($iorfiles[$i]); } -else { - $SV = new PerlACE::Process ("server_main", "-p $iorfname_prefix -s $num_servants -c $num_clients"); + +my @CLS = (); +my @clients_iorfile = (); +$count = 0; +for ($i = 0; $i < $num_servants; $i++) { + for ($j = 0; $j < $num_clients_per_servant; $j++) { + $clients_iorfile[$count] = $clients[$count]->LocalFile($iorfiles[$i]); + $clients[$count]->DeleteFile($iorfiles[$i]); + $CLS[$count] = $clients[$count]->CreateProcess ("client_main", + " -i file://$clients_iorfile[$count]"); + $count ++; + } } -$SV->Spawn (); +$server_status = $SV->Spawn (); -# Wait for the servant ior files created by server. -for (my $i = 0; $i < $num_servants; $i++) { - $servant_id = sprintf("%02d", ($i + 1)); - $iorfile[$i] = PerlACE::LocalFile($iorfname_prefix . "_$servant_id.ior"); - - if (PerlACE::waitforfile_timed ($iorfile[$i], - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile[$i]>\n"; - $SV->Kill (); $SV->TimedWait (1); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; - } +} + +# Wait for the servant ior files created by server. +for ($i = 0; $i < $num_servants; $i++) { + if ($server->WaitForFileTimed ($iorfiles[$i], + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfiles[$i]>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; + } +} + +for ($i = 0; $i < $num_servants; $i++) { + if ($server->GetFile ($iorfiles[$i]) == -1) { + print STDERR "ERROR: cannot retrieve $i-th file <$server_iorfiles[$i]>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; + } +} + +$count = 0; +for ($i = 0; $i < $num_servants; $i++) { + for ($j = 0; $j < $num_clients_per_servant; $j++) { + if ($clients[$count]->PutFile ($iorfiles[$i]) == -1) { + print STDERR "ERROR: client $count cannot set file <$clients_iorfile[$count]>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; + } + $count ++; + } } $count = 0; -for (my $i = 0; $i < $num_servants; $i++) { - for ($j = 0; $j < $num_clients_per_servant; $j++) { - $CLS[$count] = new PerlACE::Process ("client_main", " -i file://$iorfile[$i]"); - $CLS[$count]->Spawn (); - $count ++; - } +for ($i = 0; $i < $num_servants; $i++) { + for ($j = 0; $j < $num_clients_per_servant; $j++) { + my $client_status = $CLS[$count]->Spawn(); + if ($client_status != 0) { + print STDERR "ERROR: client $count Spawn returned $client_status\n"; + $status = 1; + } + $count ++; + } } -for (my $i = 0; $i < $num_clients; $i++) { - $client = $CLS[$i]->WaitKill (60); +for ($i = 0; $i < $num_clients; $i++) { + my $client_status = $CLS[$i]->WaitKill ($clients[$i]->ProcessStartWaitInterval() + 45); - if ($client != 0) { - print STDERR "ERROR: client $i returned $client\n"; - $status = 1; - } + if ($client_status != 0) { + print STDERR "ERROR: client $i WaitKill returned $client_status\n"; + $status = 1; + } } -$server = $SV->WaitKill (60); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 45); -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } + #Delete ior files generated by this run. -for (my $i = 0; $i < $num_servants; $i++) { - $servant_id = sprintf("%02d", ($i + 1)); - $iorfile[$i] = PerlACE::LocalFile($iorfname_prefix . "_$servant_id.ior"); - - unlink $iorfile[$i]; +for ($i = 0; $i < $num_servants; $i++) { + $server->DeleteFile($iorfiles[$i]); +} + +$count = 0; +for ($i = 0; $i < $num_servants; $i++) { + for ($j = 0; $j < $num_clients_per_servant; $j++) { + $clients[$count]->DeleteFile($iorfiles[$i]); + $count++; + } } exit $status; diff --git a/TAO/examples/CSD_Strategy/ThreadPool4/run_test.pl b/TAO/examples/CSD_Strategy/ThreadPool4/run_test.pl index b3f17089ed4..22eb04e358f 100755 --- a/TAO/examples/CSD_Strategy/ThreadPool4/run_test.pl +++ b/TAO/examples/CSD_Strategy/ThreadPool4/run_test.pl @@ -6,40 +6,46 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} $synch_with_server_option = ""; if ($ARGV[0] eq 'synch_with_server') { - $synch_with_server_option = "-s"; + $synch_with_server_option = "-s"; } elsif ($ARGV[0] eq '') { - #synch with transport +#synch with transport } else { - print STDERR "ERROR: invalid parameter $ARGV[0] \n"; - exit 1; + print STDERR "ERROR: invalid parameter $ARGV[0] \n"; + exit 1; } -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server_main", "$synch_with_server_option"); -} -else { - $SV = new PerlACE::Process ("server_main", "$synch_with_server_option"); -} +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +$SV = $server->CreateProcess ("server_main", "-ORBdebuglevel $debug_level $synch_with_server_option"); -$SV->Spawn (); +$server_status = $SV->Spawn (); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -$server = $SV->WaitKill (60); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 45); -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } - exit $status; diff --git a/TAO/examples/CSD_Strategy/ThreadPool5/run_test.pl b/TAO/examples/CSD_Strategy/ThreadPool5/run_test.pl index ae0907cc07f..bdd96e9c7fb 100755 --- a/TAO/examples/CSD_Strategy/ThreadPool5/run_test.pl +++ b/TAO/examples/CSD_Strategy/ThreadPool5/run_test.pl @@ -6,11 +6,10 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; - $iorfname_prefix = "server"; $num_servants=1; $num_clients_per_servant=40; @@ -20,116 +19,169 @@ $collocated_test=0; $servant_cancellation_option=""; if ($ARGV[0] eq 'collocated') { - # 1 servant, 1 collocated client, 1 orb thread, 2 strategy working threads - $num_clients_per_servant=1; - $collocated_test=1; - $num_csd_threads=2; + # 1 servant, 1 collocated client, 1 orb thread, 2 strategy working threads + $num_clients_per_servant=1; + $collocated_test=1; + $num_csd_threads=2; } elsif ($ARGV[0] eq 'multiple_servants') { - # multiple servants and single orb thread. - # 10 servant, 40 client, 1 orb thread, 10 strategy working threads - $num_servants=10; - $num_csd_threads=10; - $num_clients_per_servant=4; + # multiple servants and single orb thread. + # 10 servant, 40 client, 1 orb thread, 10 strategy working threads + $num_servants=10; + $num_csd_threads=10; + $num_clients_per_servant=4; } elsif ($ARGV[0] eq 'multiple_orb_threads') { - # multiple servants and multiple orb threads. - # 10 servant, 40 client, 4 orb thread, 10 strategy working threads - $num_servants=10; - $num_csd_threads=10; - $num_clients_per_servant=4; - $num_orb_threads=4; + # multiple servants and multiple orb threads. + # 10 servant, 40 client, 4 orb thread, 10 strategy working threads + $num_servants=10; + $num_csd_threads=10; + $num_clients_per_servant=4; + $num_orb_threads=4; } elsif ($ARGV[0] eq 'cancel_servant') { - # Cancel one servant and leave the other alive. - # 2 servant, 10 client, 5 orb thread, 1 strategy working threads - $num_clients_per_servant=5; - $num_servants=2; - $num_csd_threads=2; - $num_orb_threads=5; - $servant_cancellation_option = " -d 1 "; + # Cancel one servant and leave the other alive. + # 2 servant, 10 client, 5 orb thread, 1 strategy working threads + $num_clients_per_servant=5; + $num_servants=2; + $num_csd_threads=2; + $num_orb_threads=5; + $servant_cancellation_option = " -d 1 "; } elsif ($ARGV[0] eq '') { - # default test - 1 servant, 40 clients , 1 orb thread, 1 csd thread + # default test - 1 servant, 40 clients , 1 orb thread, 1 csd thread } else { - print STDERR "ERROR: invalid parameter $ARGV[0] \n"; - exit 1; + print STDERR "ERROR: invalid parameter $ARGV[0] \n"; + exit 1; } -$num_clients=$num_servants * $num_clients_per_servant; +$debug_level = '0'; -#Delete old ior files. -for (my $i = 0; $i < $num_servants; $i++) { - $servant_id = sprintf("%02d", ($i + 1)); - $iorfile[$i] = PerlACE::LocalFile($iorfname_prefix . "_$servant_id.ior"); - - unlink $iorfile[$i]; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } } +$num_clients = $num_servants * $num_clients_per_servant; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server_main", - "-p $iorfname_prefix -s $num_servants " - . "-c $num_clients -t $num_orb_threads -n $num_csd_threads " - . "-l $collocated_test $servant_cancellation_option"); +$SV = $server->CreateProcess("server_main", + "-p $iorfname_prefix -s $num_servants ". + "-c $num_clients -t $num_orb_threads -n $num_csd_threads ". + "-l $collocated_test $servant_cancellation_option"); + +my @clients = (); +for ($i = 0; $i < $num_clients; $i++) { + $clients[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target $i+1 failed\n"; } -else { - $SV = new PerlACE::Process ("server_main", - "-p $iorfname_prefix -s $num_servants " - . "-c $num_clients -t $num_orb_threads -n $num_csd_threads " - . "-l $collocated_test $servant_cancellation_option"); + +#Delete old ior files. +my @iorfiles = (); +my @server_iorfiles = (); +for ($i = 0; $i < $num_servants; $i++) { + $servant_id = sprintf("%02d", ($i + 1)); + $iorfiles[$i] = $iorfname_prefix . "_$servant_id.ior"; + $server_iorfiles[$i] = $server->LocalFile($iorfiles[$i]); + $server->DeleteFile($iorfiles[$i]); } -$SV->Spawn (); -# Wait for the servant ior files created by server. -for (my $i = 0; $i < $num_servants; $i++) { - $servant_id = sprintf("%02d", ($i + 1)); - $iorfile[$i] = PerlACE::LocalFile($iorfname_prefix . "_$servant_id.ior"); - - if (PerlACE::waitforfile_timed ($iorfile[$i], - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile[$i]>\n"; - $SV->Kill (); $SV->TimedWait (1); +my @CLS = (); +my @clients_iorfile = (); +$count = 0; +for ($i = 0; $i < $num_servants; $i++) { + for ($j = 0; $j < $num_clients_per_servant; $j++) { + $clients_iorfile[$count] = $clients[$count]->LocalFile($iorfiles[$i]); + $clients[$count]->DeleteFile($iorfiles[$i]); + $CLS[$count] = $clients[$count]->CreateProcess ("client_main", + " -i file://$clients_iorfile[$count]"); + $count ++; + } +} + +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; - } +} + +# Wait for the servant ior files created by server. +for ($i = 0; $i < $num_servants; $i++) { + if ($server->WaitForFileTimed ($iorfiles[$i], + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfiles[$i]>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; + } +} + +for ($i = 0; $i < $num_servants; $i++) { + if ($server->GetFile ($iorfiles[$i]) == -1) { + print STDERR "ERROR: cannot retrieve $i-th file <$server_iorfiles[$i]>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; + } +} + +$count = 0; +for ($i = 0; $i < $num_servants; $i++) { + for ($j = 0; $j < $num_clients_per_servant; $j++) { + if ($clients[$count]->PutFile ($iorfiles[$i]) == -1) { + print STDERR "ERROR: client $count cannot set file <$clients_iorfile[$count]>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; + } + $count ++; + } } $count = 0; if ($collocated_test == 0) { - for (my $i = 0; $i < $num_servants; $i++) { - for ($j = 0; $j < $num_clients_per_servant; $j++) { - $CLS[$count] = new PerlACE::Process ("client_main", " -i file://$iorfile[$i]"); - $CLS[$count]->Spawn (); - $count ++; + for ($i = 0; $i < $num_servants; $i++) { + for ($j = 0; $j < $num_clients_per_servant; $j++) { + my $client_status = $CLS[$count]->Spawn(); + if ($client_status != 0) { + print STDERR "ERROR: client $count Spawn returned $client_status\n"; + $status = 1; + } + $count ++; + } } - } - for (my $i = 0; $i < $num_clients; $i++) { - $client = $CLS[$i]->WaitKill (60); + for ($i = 0; $i < $num_clients; $i++) { + my $client_status = $CLS[$i]->WaitKill ($clients[$i]->ProcessStartWaitInterval() + 45); - if ($client != 0) { - print STDERR "ERROR: client $i returned $client\n"; - $status = 1; + if ($client_status != 0) { + print STDERR "ERROR: client $i WaitKill returned $client_status\n"; + $status = 1; + } } - } } -$server = $SV->WaitKill (60); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 45); -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } + #Delete ior files generated by this run. -for (my $i = 0; $i < $num_servants; $i++) { - $servant_id = sprintf("%02d", ($i + 1)); - $iorfile[$i] = PerlACE::LocalFile($iorfname_prefix . "_$servant_id.ior"); - - unlink $iorfile[$i]; +for ($i = 0; $i < $num_servants; $i++) { + $server->DeleteFile($iorfiles[$i]); +} + +$count = 0; +for ($i = 0; $i < $num_servants; $i++) { + for ($j = 0; $j < $num_clients_per_servant; $j++) { + $clients[$count]->DeleteFile($iorfiles[$i]); + $count++; + } } exit $status; diff --git a/TAO/examples/CSD_Strategy/ThreadPool6/run_test.pl b/TAO/examples/CSD_Strategy/ThreadPool6/run_test.pl index 572f24d412a..bb914892a67 100755 --- a/TAO/examples/CSD_Strategy/ThreadPool6/run_test.pl +++ b/TAO/examples/CSD_Strategy/ThreadPool6/run_test.pl @@ -6,55 +6,94 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; -$iorfile = PerlACE::LocalFile ("server.ior"); -unlink $iorfile; $status = 0; +$debug_level = '0'; +$num_clients = 1; -$num_clients=1; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server_main", "-o $iorfile -n $num_clients"); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my @clients = (); +for ($i = 0; $i < $num_clients; $i++) { + $clients[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target $i+1 failed\n"; } -else { - $SV = new PerlACE::Process ("server_main", "-o $iorfile -n $num_clients"); + +my $iorbase = "server.ior"; + +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$SV = $server->CreateProcess ("server_main", "-ORBdebuglevel $debug_level ". + "-o $server_iorfile -n $num_clients"); + +my @CLS = (); +my @clients_iorfile = (); +for ($i = 0; $i < $num_clients; $i++) { + $clients_iorfile[$i] = $clients[$i]->LocalFile ($iorbase); + $clients[$i]->DeleteFile($iorbase); + $CLS[$i] = $clients[$i]->CreateProcess ("client_main", "-i file://$clients_iorfile[$i]"); } -$SV->Spawn (); +$server_status = $SV->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile, - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); $SV->TimedWait (1); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; -} +} -for ($i = 0; $i < $num_clients; $i++) { +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} - @CLS[$i] = new PerlACE::Process ("client_main", " -i file://$iorfile"); +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} - @CLS[$i]->Spawn (); +for ($i = 0; $i < $num_clients; $i++) { + if ($clients[$i]->PutFile ($iorbase) == -1) { + print STDERR "ERROR: client $i cannot set file <$clients_iorfile[$i]>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; + } } for ($i = 0; $i < $num_clients; $i++) { + my $client_status = $CLS[$i]->Spawn(); + if ($client_status != 0) { + print STDERR "ERROR: client $i Spawn returned $client_status\n"; + $status = 1; + } +} - $client = @CLS[$i]->WaitKill (60); +for ($i = 0; $i < $num_clients; $i++) { + my $client_status = $CLS[$i]->WaitKill ($clients[$i]->ProcessStartWaitInterval() + 45); - if ($client != 0) { - print STDERR "ERROR: client $i returned $client\n"; - $status = 1; - } + if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; + } } +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 45); -$server = $SV->WaitKill (60); - -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $iorfile; +$server->DeleteFile($iorbase); +for ($i = 0; $i < $num_clients; $i++) { + $clients[$i]->DeleteFile($iorbase); +} exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl index e2fa978cf93..4ede6d3629e 100755 --- a/TAO/orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl @@ -4,52 +4,100 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; +$status = 0; +$debug_level = '0'; -$TARGETHOSTNAME = "localhost"; -$def_port = 2809; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $srv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $cli = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; -$nsiorfile = PerlACE::LocalFile ("ns.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; +my $nsiorfile = "ns.ior"; -unlink $nsiorfile; +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $srv_nsiorfile = $srv->LocalFile ($nsiorfile); +my $cli_nsiorfile = $cli->LocalFile ($nsiorfile); +$ns->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); # start Naming Service $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$nsiorfile>\n"; - $NS->Kill(); +$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile"); +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-ORBInitRef NameService=file://$srv_nsiorfile"); +$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile"); + +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($srv->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($cli->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } # start MessengerServer -$S = new PerlACE::Process("MessengerServer", $arg_ns_ref); -$S->Spawn(); +$SRV_status = $SRV->Spawn (); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + exit 1; +} # start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); +$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()); -if ($C->SpawnWaitKill(15) != 0) { - print STDERR "ERROR: client failed\n"; - $S->Kill(); - $NS->Kill(); - exit 1; +if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $status = 1; } # clean-up +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); -$C->Kill(); -$S->Kill(); -$NS->Kill(); - -unlink $nsiorfile; +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; +} -exit 0; +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} +$ns->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl index 9070b8886ac..3e4fd9bf1d5 100755 --- a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl @@ -4,55 +4,100 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; +$status = 0; +$debug_level = '0'; -$TARGETHOSTNAME = "localhost"; -$def_port = 2809; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -$nsiorfile = PerlACE::LocalFile ("ns.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $srv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $cli = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; -unlink $nsiorfile; +my $nsiorfile = "ns.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $srv_nsiorfile = $srv->LocalFile ($nsiorfile); +my $cli_nsiorfile = $cli->LocalFile ($nsiorfile); +$ns->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); -# start Naming Service $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$nsiorfile>\n"; - $NS->Kill(); +$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile"); +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-ORBInitRef NameService=file://$srv_nsiorfile"); +$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile"); + +# start Naming Service +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($srv->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($cli->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } # start MessengerServer -$MessengerServer = "MessengerServer"; -$S = new PerlACE::Process($MessengerServer, $arg_ns_ref); -$S->Spawn(); +$SRV_status = $SRV->Spawn (); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + exit 1; +} # start MessengerClient -$MessengerClient = "MessengerClient"; -$C = new PerlACE::Process($MessengerClient, $arg_ns_ref ); +$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()); -if ($C->SpawnWaitKill(15) != 0) { - print STDERR "ERROR: client failed\n"; - $S->Kill(); - $NS->Kill(); - exit 1; +if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $status = 1; } - # clean-up +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); -$C->Kill(); -$S->Kill(); -$NS->Kill(); - -unlink $nsiorfile; +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; +} -exit 0; +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} +$ns->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp index e942c7b662b..eb1baab211b 100644 --- a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp @@ -4,21 +4,47 @@ #include "orbsvcs/CosNamingC.h" #include <iostream> #include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_input_file = ACE_TEXT("file://url.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior_input_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { try { // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - char url[200]; - std::ifstream iorFile( "url.ior" ); - iorFile >> url; - iorFile.close(); - - std::cout << "url: " << url << std::endl; + if (parse_args (argc, argv) != 0) + return 1; - // Find the Naming Service & the Message Server name in it - CORBA::Object_var obj = orb->string_to_object(url); + // Find the Naming Service & the Message Server name in it + CORBA::Object_var obj = orb->string_to_object(ior_input_file); // Narrow Messenger_var messenger = Messenger::_narrow(obj.in()); diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp index e08e6bba229..28716321e81 100644 --- a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp @@ -4,6 +4,48 @@ #include "orbsvcs/CosNamingC.h" #include <iostream> #include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("url.ior"); +const ACE_TCHAR *hostname = ACE_TEXT ("localhost"); +const ACE_TCHAR *port = ACE_TEXT ("2809"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:h:p:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case 'h': + hostname = get_opts.opt_arg (); + break; + + case 'p': + port = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile> " + "-h <host> " + "-p <port>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { @@ -11,6 +53,9 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + if (parse_args (argc, argv) != 0) + return 1; + //Get reference to Root POA CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); @@ -87,8 +132,15 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) return 1; } + ACE_CString base_address (":"); + base_address += ACE_TEXT_ALWAYS_CHAR (hostname); + base_address += ":"; + base_address += ACE_TEXT_ALWAYS_CHAR (port); + ACE_CString addr (""); + addr = base_address + "/key/str"; + // Create an URL string for application object. - CORBA::String_var address = CORBA::string_dup (":localhost:2809/key/str"); + CORBA::String_var address = CORBA::string_dup (addr.c_str()); std::cout << "call to_url(\"" << address.in() << "\"" << std::endl; std::cout << " ,\"" << str_simple.in() << "\")"<< std::endl; @@ -100,7 +152,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Write NS url to a file to let client read NS URL to get // NamingContext reference. - CORBA::String_var ns_addr = CORBA::string_dup(":localhost:2809"); + CORBA::String_var ns_addr = CORBA::string_dup(base_address.c_str()); std::cout << "call to_url(\"" <<ns_addr.in() << "\",\"" << str_simple.in() << "\")"<< std::endl; @@ -109,11 +161,11 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) std::cout << "to_url result: " << url.in() << std::endl; - std::ofstream iorFile("url.ior"); + std::ofstream iorFile(ACE_TEXT_ALWAYS_CHAR (ior_output_file)); iorFile << url.in() << std::endl; iorFile.close(); - std::cout << "Naming Service URL written to file url.ior" << std::endl; + std::cout << "Naming Service URL written to file " << ior_output_file << std::endl; // Accept requests orb->run(); diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl index eac00add5ad..959dd590ba7 100755 --- a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl @@ -4,53 +4,113 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; -$nsref="-ORBInitRef NameService=iiop://localhost:2809/NameService"; -$nsior = "ns.ior"; -$ior="url.ior"; -unlink $ior; +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $srv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $cli = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; + +my $nsiorfile = "ns.ior"; +my $srviorfile = "url.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $srv_srviorfile = $srv->LocalFile ($srviorfile); +my $cli_srviorfile = $cli->LocalFile ($srviorfile); +$ns->DeleteFile ($nsiorfile); +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); + +$hostname = $ns->HostName (); +$port = "2809"; -# start Naming Service -unlink($nsior); $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-ORBListenEndpoints iiop://localhost:2809 -o $nsior"); -$NS->Spawn(); +$NS = $ns->CreateProcess ($NameService, "-ORBListenEndpoints iiop://$hostname:$port ". + " -o $ns_nsiorfile"); +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $srv_srviorfile ". + "-h $hostname ". + "-p $port ". + "-ORBInitRef NameService=iiop://$hostname:$port/NameService"); +$CLI = $cli->CreateProcess ("MessengerClient", "-k file://$cli_srviorfile ". + "-ORBInitRef NameService=iiop://$hostname:$port/NameService"); -if (PerlACE::waitforfile_timed ($nsior, 10) == -1) { - print STDERR "ERROR: cannot find IOR file <$nsior>\n"; - $NS->Kill (); - exit 1; +# start Naming Service +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; } # start MessengerServer -$MessengerServer = "MessengerServer"; -$S = new PerlACE::Process($MessengerServer, $nsref ); -$S->Spawn(); -if (PerlACE::waitforfile_timed ($ior, 15) == -1) { - print STDERR "ERROR: cannot find file $ior\n"; - $NS->Kill(); - $S->Kill(); +$SRV_status = $SRV->Spawn (); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + exit 1; +} + +if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$srv_srviorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $SRV->Kill (); $SRV->TimedWait (1); + exit 1; +} + +if ($srv->GetFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $SRV->Kill (); $SRV->TimedWait (1); + exit 1; +} +if ($cli->PutFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_srviorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $SRV->Kill (); $SRV->TimedWait (1); exit 1; } # start MessengerClient -$C = new PerlACE::Process("MessengerClient", $nsref); -if ($C->SpawnWaitKill(15) != 0) { - print STDERR "ERROR: client failed\n"; - $S->Kill(); - $NS->Kill(); - exit 1; +$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()); + +if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client failed with status $CLI_status\n"; + $status = 1; } # clean-up -$S->Kill(); -$NS->Kill(); -unlink $ior; +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); -exit 0; +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; +} + +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} +$ns->DeleteFile ($nsiorfile); +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl index b622edee34d..3df6d8ec73d 100755 --- a/TAO/orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl @@ -4,31 +4,51 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; +$status = 0; +$debug_level = '0'; -$TARGETHOSTNAME = "localhost"; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $srv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $cli = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $tnd = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; + +$TARGETHOSTNAME = $ns->HostName (); $def_port = 2809; -my($nsiorfile) = "ns.ior"; -unlink($nsiorfile); +my $nsiorfile = "ns.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +$ns->DeleteFile ($nsiorfile); # start Naming Service $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-ORBListenEndpoints iiop://$TARGETHOSTNAME:$def_port -o $nsiorfile"); +$NS = $ns->CreateProcess ($NameService, " -ORBListenEndpoints iiop://$TARGETHOSTNAME:$def_port ". + "-o $ns_nsiorfile"); +$NS_status = $NS->Spawn (); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$nsiorfile>\n"; - $NS->Kill(); - exit 1; +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; } # File is only used to make sure the NS is fully running, so we can # remove it now. -unlink($nsiorfile); +$ns->DeleteFile ($nsiorfile); # List of tests to test corbaloc URL syntax. @corbaloc_servers = ( "-ORBDefaultInitRef corbaloc::$TARGETHOSTNAME", @@ -43,84 +63,105 @@ unlink($nsiorfile); @corbaloc_clients = ( "corbaloc::$TARGETHOSTNAME/NameService", "-ORBInitRef NameService=iiop://$TARGETHOSTNAME:$def_port/NameService corbaloc:rir:/NameService"); -@clients_comments = ( "Using the URL parameter: \n"); - "Using a corbaloc:rir form URL(must specify initial reference): \n", - - - +@clients_comments = ( "Using the URL parameter: \n", + "Using a corbaloc:rir form URL(must specify initial reference): \n"); $MessengerServer= "MessengerServer"; $MessengerClient= "MessengerClient"; +$nsdel = "$ENV{ACE_ROOT}/bin/tao_nsdel"; $test_number = 0; foreach $o (@corbaloc_servers) { - # Run messenger server for each test. - #print "Start $MessengerServer $o \n"; - $SR = new PerlACE::Process($MessengerServer, $o); - $SR->Spawn(); - - #print "Start $MessengerClient \n"; - $CL = new PerlACE::Process($MessengerClient, "-ORBDefaultInitRef iiop://$TARGETHOSTNAME:$def_port"); - $test_number++; - - if ($CL->SpawnWaitKill(15) != 0) { - print STDERR "ERROR: client failed\n"; - $SR->Kill(); - $NS->Kill(); - exit 1; - } - - print "======================================\n"; - print "Finish Test $test_number: $servers_comments[$test_number] \n"; - print " $MessengerServer $o\n"; - print "======================================\n\n"; - - $SR->Kill(1); - - # remove ns entry... - $nsdel = "$ENV{ACE_ROOT}/bin/tao_nsdel"; - $NSDEL = new PerlACE::Process($nsdel, "--quiet --name example/Messenger -ORBInitRef NameService=corbaloc::$TARGETHOSTNAME:$def_port/NameService"); - if ($NSDEL->SpawnWaitKill(15) != 0) { - print STDERR "ERROR: tao_nsdel failed\n"; - $NS->Kill(); - exit 1; - } + # Run messenger server for each test. + #print "Start $MessengerServer $o \n"; + $SRV = $srv->CreateProcess ($MessengerServer, "-ORBdebuglevel $debug_level ". + "$o"); + $SRV->Spawn(); + if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + exit 1; + } + + #print "Start $MessengerClient \n"; + $CLI = $cli->CreateProcess ($MessengerClient, "-ORBDefaultInitRef iiop://$TARGETHOSTNAME:$def_port"); + $test_number++; + + $CLI_status = $CLI->SpawnWaitKill($cli->ProcessStartWaitInterval()); + if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $SRV->Kill(); $SRV->TimedWait (1); + $NS->Kill(); $NS->TimedWait (1); + exit 1; + } + + print "======================================\n"; + print "Finish Test $test_number: $servers_comments[$test_number] \n"; + print " $MessengerServer $o\n"; + print "======================================\n\n"; + + $SRV->Kill(); $SRV->TimedWait (1); + + # remove ns entry... + $TND = $tnd->CreateProcess ($nsdel, "--quiet ". + "--name example/Messenger ". + "-ORBInitRef NameService=corbaloc::$TARGETHOSTNAME:$def_port/NameService"); + $TND_status = $TND->SpawnWaitKill($tnd->ProcessStartWaitInterval()); + if ($TND_status != 0) { + print STDERR "ERROR: tao_nsdel failed with status $TND_status\n"; + $NS->Kill(); $NS->TimedWait (1); + exit 1; + } } #print "Start $MessengerServer \n"; -$SR = new PerlACE::Process($MessengerServer, "-ORBDefaultInitRef iiop://$TARGETHOSTNAME:$def_port"); -$SR->Spawn(); +$SRV = $srv->CreateProcess ($MessengerServer, "-ORBdebuglevel $debug_level ". + "-ORBDefaultInitRef iiop://$TARGETHOSTNAME:$def_port"); +$SRV->Spawn(); +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + exit 1; +} $i = 0; foreach $o (@corbaloc_clients) { - - # Run the client for each test. - #print "Start $MessengerClient $o \n"; - $CL = new PerlACE::Process($MessengerClient, $o); + # Run the client for each test. + #print "Start $MessengerClient $o \n"; + $CLI = $cli->CreateProcess ($MessengerClient, "$o"); + + $CLI_status = $CLI->SpawnWaitKill($cli->ProcessStartWaitInterval()); + if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $SRV->Kill(); $SRV->TimedWait (1); + $NS->Kill(); $NS->TimedWait (1); + exit 1; + } + + $test_number++; + print "======================================\n"; + print "Finish Test $test_number: $clients_comments[$i]\n"; + print " $MessengerClient $o"; + print "\n======================================\n\n"; + + $i ++; +} - if ($CL->SpawnWaitKill(15) != 0) { - print STDERR "ERROR: client failed\n"; - $SR->Kill(); - $NS->Kill(); - exit 1; - } - $test_number++; - print "======================================\n"; - print "Finish Test $test_number: $clients_comments[$i]\n"; - print " $MessengerClient $o"; - print "\n======================================\n\n"; +# clean up +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); - $i ++; +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; } +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); -# clean up - -$SR->Kill(); -$NS->Kill(); +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} -exit 0; +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp index 694c87d02e5..cbea180cda8 100644 --- a/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp @@ -4,12 +4,45 @@ #include "orbsvcs/CosNamingC.h" #include <iostream> #include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *output_file = ACE_TEXT ("MessengerServer.ready"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <outputfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { try { // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + if (parse_args (argc, argv) != 0) + return 1; + //Get reference to Root POA CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); @@ -52,7 +85,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) std::cout << "Messenger object bound in Naming Service" << std::endl; // Write a file to let the run_test.pl script know we are ready. - std::ofstream iorFile( "MessengerServer.ready" ); + std::ofstream iorFile( ACE_TEXT_ALWAYS_CHAR(output_file) ); iorFile << "Ready" << std::endl; iorFile.close(); diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl index 90faf119c93..650780eb90c 100755 --- a/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl @@ -4,43 +4,68 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $srv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $cli = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; $TARGETHOSTNAME = "localhost"; $def_port = 2809; -$nsior = "ns.ior"; + +$nsiorfile = "ns.ior"; $msfile = "MessengerServer.ready"; +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $srv_msfile = $srv->LocalFile ($msfile); +$ns->DeleteFile ($nsiorfile); +$srv->DeleteFile ($msfile); + # start Naming Service -unlink($nsior); $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-ORBListenEndpoints iiop://$TARGETHOSTNAME:$def_port -o $nsior"); -$NS->Spawn(); +$NS = $ns->CreateProcess ($NameService, " -ORBListenEndpoints iiop://$TARGETHOSTNAME:$def_port ". + "-o $ns_nsiorfile"); +$NS_status = $NS->Spawn (); -if (PerlACE::waitforfile_timed ($nsior, 10) == -1) { - print STDERR "ERROR: cannot find IOR file <$nsior>\n"; - $NS->Kill (); - exit 1; +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; } # start the server -unlink($msfile); print "Start Messenger Server \n"; -$SR = new PerlACE::Process("MessengerServer", - "-ORBInitRef NameService=iiop://$TARGETHOSTNAME:$def_port/NameService"); -$SR->Spawn(); - -if (PerlACE::waitforfile_timed ($msfile, 10) == -1) { - print STDERR "ERROR: cannot find file <$msfile>\n"; - $SR->Kill (); - $NS->Kill (); - exit 1; +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $srv_msfile ". + "-ORBInitRef NameService=iiop://$TARGETHOSTNAME:$def_port/NameService"); +$SRV->Spawn(); +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($srv->WaitForFileTimed ($msfile,$srv->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$srv_msfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + exit 1; } -unlink($msfile); - @corbaname_clients = ("corbaname:iiop:$TARGETHOSTNAME:2809#example/Messenger", "corbaname::$TARGETHOSTNAME:2809#example/Messenger", @@ -54,28 +79,43 @@ unlink($msfile); # Run the client for each of the corbaname test. $test_number = 0; +$MessengerClient = "MessengerClient"; foreach $o (@corbaname_clients) { - - $CL = new PerlACE::Process("MessengerClient", $o); - - if ($CL->SpawnWaitKill(15) != 0) { - print STDERR "ERROR: client failed\n"; - $SR->Kill(); - $NS->Kill(); - exit 1; - } - - $test_number++; - print "======================================\n"; - print "Finish Test $test_number: $clients_comments[$test_number]\n"; - print " $CL_NAME $o\n"; - print "======================================\n\n"; + $CLI = $cli->CreateProcess ($MessengerClient, "$o"); + + $CLI_status = $CLI->SpawnWaitKill($cli->ProcessStartWaitInterval()); + if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $SRV->Kill(); $SRV->TimedWait (1); + $NS->Kill(); $NS->TimedWait (1); + exit 1; + } + + $test_number++; + print "======================================\n"; + print "Finish Test $test_number: $clients_comments[$test_number]\n"; + print " $MessengerClient $o\n"; + print "======================================\n\n"; } # clean up -$SR->Kill (); -$NS->Kill (); +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; +} + +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} + +$ns->DeleteFile ($nsiorfile); +$srv->DeleteFile ($msfile); -exit 0; +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp index eeea6d8701a..e2ef6e68a4b 100644 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp @@ -3,6 +3,35 @@ #include "MessengerC.h" #include "orbsvcs/CosNamingC.h" #include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT("file://Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) { @@ -11,7 +40,10 @@ int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - CORBA::Object_var obj = orb->string_to_object("file://Messenger.ior"); + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var obj = orb->string_to_object(ior); if (CORBA::is_nil(obj.in())) { std::cerr << "Nil Messenger reference" << std::endl; return 1; diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp index e0ff009ea28..ca1ef264102 100644 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp @@ -4,6 +4,30 @@ #include "Messenger_i.h" #include <iostream> #include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ; + } + // Indicates sucessful parsing of the command line + return 0; +} int ACE_TMAIN (int argc, ACE_TCHAR *argv []) @@ -12,6 +36,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv []) { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + if (parse_args (argc, argv) != 0) + return 1; + CORBA::Object_var obj = orb->resolve_initial_references("NameService"); CosNaming::NamingContextExt_var rootNC = CosNaming::NamingContextExt::_narrow(obj.in()); @@ -27,10 +54,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv []) obj = poa->id_to_reference(oid.in()); CORBA::String_var str = orb->object_to_string (obj.in()); - std::ofstream iorFile ("Messenger.ior"); + std::ofstream iorFile (ACE_TEXT_ALWAYS_CHAR(ior_output_file)); iorFile << str.in() << std::endl; iorFile.close(); - std::cout << "IOR written to file Messenger.ior " << std::endl; + std::cout << "IOR written to file " << ior_output_file << std::endl; orb->run(); orb->destroy(); diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl index b787dd9f8c8..737f4ab9046 100755 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl @@ -4,74 +4,199 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$notify_ior = PerlACE::LocalFile("notify.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; + +$nsiorfile = "ns.ior"; +$srviorfile = "Messenger.ior"; +$nfsiorfile = "notify.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile); +my $srv_nsiorfile = $srv->LocalFile ($nsiorfile); +my $con_nsiorfile = $con->LocalFile ($nsiorfile); +my $cli_nsiorfile = $cli->LocalFile ($nsiorfile); +my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile); +my $srv_srviorfile = $srv->LocalFile ($srviorfile); +my $cli_srviorfile = $cli->LocalFile ($srviorfile); +$ns->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nfsiorfile); +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); -# start Naming Service $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); +$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile"); + + +$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; +$NFS = $nfs->CreateProcess ($NotifyService, "-ORBInitRef NameService=file://$nfs_nsiorfile ". + "-IORoutput $nfs_nfsiorfile"); +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $srv_srviorfile ". + "-ORBInitRef NameService=file://$srv_nsiorfile"); +$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile"); +$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile ". + "-k file://$cli_srviorfile"); + +# start Naming Service +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($nfs->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($srv->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($con->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$con_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($cli->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } # start Notification Service +$NFS_status = $NFS->Spawn (); -$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; -$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior"); -$NFS->Spawn(); -# the ior file is only used to wait for the service to start -if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $notify_ior\n"; - $NS->Kill (); - $NFS->Kill (); - exit 1; +if ($NFS_status != 0) { + print STDERR "ERROR: Notify Service returned $NFS_status\n"; + exit 1; +} + +if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; } # start MessengerServer -$S = new PerlACE::Process("MessengerServer", $arg_ns_ref); -$S->Spawn(); +$SRV_status = $SRV->Spawn (); + +if ($SRV_status != 0) { + print STDERR "ERROR: Server returned $SRV_status\n"; + exit 1; +} -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - $NFS->Kill (); - exit 1; +if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; +} + +if ($srv->GetFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; } +if ($cli->PutFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; +} + # start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref); -$MC->Spawn(); +$CON_status = $CON->Spawn (); + +if ($CON_status != 0) { + print STDERR "ERROR: Consumer returned $CON_status\n"; + exit 1; +} # start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NFS->Kill(); - $NS->Kill(); - exit (1); +$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()); + +if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $CON->Kill (); $CON->TimedWait (1); + $SRV->Kill (); $SRV->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $status = 1; +} + +$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval()); + +if ($CON_status != 0) { + print STDERR "ERROR: Messenger Consumer returned $CON_status\n"; + $status = 1; } -$MC->Kill(); -$S->Kill(); -$NFS->Kill(); -$NS->Kill(); +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; +} +$NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval()); + +if ($NFS_status != 0) { + print STDERR "ERROR: Notification Service returned $NFS_status\n"; + $status = 1; +} + +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; +$ns->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nfsiorfile); +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); -exit 0; +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl index 7a52de8ba1d..3332eeb8e15 100755 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl @@ -4,74 +4,180 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$notify_ior = PerlACE::LocalFile("notify.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; + +$nsiorfile = "ns.ior"; +$srviorfile = "Messenger.ior"; +$nfsiorfile = "notify.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile); +my $srv_nsiorfile = $srv->LocalFile ($nsiorfile); +my $con_nsiorfile = $con->LocalFile ($nsiorfile); +my $cli_nsiorfile = $cli->LocalFile ($nsiorfile); +my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile); +my $srv_srviorfile = $srv->LocalFile ($srviorfile); +$ns->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nfsiorfile); +$srv->DeleteFile ($srviorfile); -# start Naming Service $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); +$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile"); + +$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; +$NFS = $nfs->CreateProcess ($NotifyService, "-ORBInitRef NameService=file://$nfs_nsiorfile ". + "-IORoutput $nfs_nfsiorfile"); +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $srv_srviorfile ". + "-ORBInitRef NameService=file://$srv_nsiorfile"); +$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile"); +$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile "); + +# start Naming Service +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($nfs->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($srv->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($con->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$con_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($cli->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } # start Notification Service +$NFS_status = $NFS->Spawn (); -$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; -$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior"); -$NFS->Spawn(); -# the ior file is only used to wait for the service to start -if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $notify_ior\n"; - $NS->Kill (); - $NFS->Kill (); - exit 1; +if ($NFS_status != 0) { + print STDERR "ERROR: Notify Service returned $NFS_status\n"; + exit 1; +} + +if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; } # start MessengerServer -$S = new PerlACE::Process("MessengerServer", "$arg_ns_ref -o $messiorfile"); -$S->Spawn(); +$SRV_status = $SRV->Spawn (); -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - $NFS->Kill (); - exit 1; +if ($SRV_status != 0) { + print STDERR "ERROR: Server returned $SRV_status\n"; + exit 1; } + +if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; +} + # start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref); -$MC->Spawn(); +$CON_status = $CON->Spawn (); + +if ($CON_status != 0) { + print STDERR "ERROR: Consumer returned $CON_status\n"; + exit 1; +} # start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NFS->Kill(); - $NS->Kill(); - exit (1); +$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()); + +if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $CON->Kill (); $CON->TimedWait (1); + $SRV->Kill (); $SRV->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $status = 1; +} + +$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval()); + +if ($CON_status != 0) { + print STDERR "ERROR: Messenger Consumer returned $CON_status\n"; + $status = 1; +} + +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; +} +$NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval()); + +if ($NFS_status != 0) { + print STDERR "ERROR: Notification Service returned $NFS_status\n"; + $status = 1; +} + +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; } -$MC->Kill(); -$S->Kill(); -$NFS->Kill(); -$NS->Kill(); +$ns->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nfsiorfile); +$srv->DeleteFile ($srviorfile); -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; +exit $status; -exit 0; diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp index 226fd6b54c6..789bd3b575f 100644 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp @@ -3,6 +3,35 @@ #include "MessengerC.h" #include "orbsvcs/CosNamingC.h" #include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT("file://Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) { @@ -10,7 +39,11 @@ int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) { // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - CORBA::Object_var obj = orb->string_to_object( "file://Messenger.ior" ); + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var obj = orb->string_to_object( ior ); if (CORBA::is_nil(obj.in())) { std::cerr << "Nil Messenger reference" << std::endl; return 1; diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp index f375895feb6..3413f093c09 100644 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp @@ -4,6 +4,31 @@ #include "Messenger_i.h" #include <iostream> #include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ; + } + // Indicates sucessful parsing of the command line + return 0; +} + int ACE_TMAIN (int argc, ACE_TCHAR *argv []) { @@ -11,6 +36,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv []) { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + if (parse_args (argc, argv) != 0) + return 1; + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); PortableServer::POAManager_var mgr = poa->the_POAManager(); @@ -22,10 +50,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv []) CORBA::Object_var messenger_obj = poa->id_to_reference (oid.in ()); CORBA::String_var str = orb->object_to_string (messenger_obj.in()); - std::ofstream iorFile ("Messenger.ior"); + std::ofstream iorFile (ACE_TEXT_ALWAYS_CHAR(ior_output_file)); iorFile << str.in () << std::endl; iorFile.close (); - std::cout << "IOR written to file Messenger.ior " << std::endl; + std::cout << "IOR written to file " << ior_output_file << std::endl; orb->run (); orb->destroy (); diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl index b787dd9f8c8..737f4ab9046 100755 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl @@ -4,74 +4,199 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$notify_ior = PerlACE::LocalFile("notify.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; + +$nsiorfile = "ns.ior"; +$srviorfile = "Messenger.ior"; +$nfsiorfile = "notify.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile); +my $srv_nsiorfile = $srv->LocalFile ($nsiorfile); +my $con_nsiorfile = $con->LocalFile ($nsiorfile); +my $cli_nsiorfile = $cli->LocalFile ($nsiorfile); +my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile); +my $srv_srviorfile = $srv->LocalFile ($srviorfile); +my $cli_srviorfile = $cli->LocalFile ($srviorfile); +$ns->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nfsiorfile); +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); -# start Naming Service $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); +$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile"); + + +$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; +$NFS = $nfs->CreateProcess ($NotifyService, "-ORBInitRef NameService=file://$nfs_nsiorfile ". + "-IORoutput $nfs_nfsiorfile"); +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $srv_srviorfile ". + "-ORBInitRef NameService=file://$srv_nsiorfile"); +$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile"); +$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile ". + "-k file://$cli_srviorfile"); + +# start Naming Service +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($nfs->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($srv->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($con->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$con_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($cli->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } # start Notification Service +$NFS_status = $NFS->Spawn (); -$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; -$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior"); -$NFS->Spawn(); -# the ior file is only used to wait for the service to start -if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $notify_ior\n"; - $NS->Kill (); - $NFS->Kill (); - exit 1; +if ($NFS_status != 0) { + print STDERR "ERROR: Notify Service returned $NFS_status\n"; + exit 1; +} + +if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; } # start MessengerServer -$S = new PerlACE::Process("MessengerServer", $arg_ns_ref); -$S->Spawn(); +$SRV_status = $SRV->Spawn (); + +if ($SRV_status != 0) { + print STDERR "ERROR: Server returned $SRV_status\n"; + exit 1; +} -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - $NFS->Kill (); - exit 1; +if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; +} + +if ($srv->GetFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; } +if ($cli->PutFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; +} + # start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref); -$MC->Spawn(); +$CON_status = $CON->Spawn (); + +if ($CON_status != 0) { + print STDERR "ERROR: Consumer returned $CON_status\n"; + exit 1; +} # start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NFS->Kill(); - $NS->Kill(); - exit (1); +$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()); + +if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $CON->Kill (); $CON->TimedWait (1); + $SRV->Kill (); $SRV->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $status = 1; +} + +$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval()); + +if ($CON_status != 0) { + print STDERR "ERROR: Messenger Consumer returned $CON_status\n"; + $status = 1; } -$MC->Kill(); -$S->Kill(); -$NFS->Kill(); -$NS->Kill(); +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; +} +$NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval()); + +if ($NFS_status != 0) { + print STDERR "ERROR: Notification Service returned $NFS_status\n"; + $status = 1; +} + +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; +$ns->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nfsiorfile); +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); -exit 0; +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp index e8f21aa8af4..b0fff2d36e8 100644 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp @@ -4,6 +4,31 @@ #include "Messenger_i.h" #include <iostream> #include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ; + } + // Indicates sucessful parsing of the command line + return 0; +} + int ACE_TMAIN (int argc, ACE_TCHAR *argv []) { @@ -11,6 +36,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv []) { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + if (parse_args (argc, argv) != 0) + return 1; + CORBA::Object_var rootObj = orb->resolve_initial_references("NameService"); CosNaming::NamingContext_var rootNC = @@ -39,10 +67,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv []) rootNC->rebind(name, messenger.in()); CORBA::String_var str = orb->object_to_string (messenger.in()); - std::ofstream iorFile ("Messenger.ior"); + std::ofstream iorFile (ACE_TEXT_ALWAYS_CHAR(ior_output_file)); iorFile << str.in () << std::endl; iorFile.close (); - std::cout << "IOR written to file Messenger.ior " << std::endl; + std::cout << "IOR written to file " << ior_output_file << std::endl; // Accept requests orb->run(); diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl index b787dd9f8c8..fa81c4c1f62 100755 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl @@ -4,74 +4,180 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$notify_ior = PerlACE::LocalFile("notify.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; + +$nsiorfile = "ns.ior"; +$srviorfile = "Messenger.ior"; +$nfsiorfile = "notify.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile); +my $srv_nsiorfile = $srv->LocalFile ($nsiorfile); +my $con_nsiorfile = $con->LocalFile ($nsiorfile); +my $cli_nsiorfile = $cli->LocalFile ($nsiorfile); +my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile); +my $srv_srviorfile = $srv->LocalFile ($srviorfile); +$ns->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nfsiorfile); +$srv->DeleteFile ($srviorfile); -# start Naming Service $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); +$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile"); + + +$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; +$NFS = $nfs->CreateProcess ($NotifyService, "-ORBInitRef NameService=file://$nfs_nsiorfile ". + "-IORoutput $nfs_nfsiorfile"); +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $srv_srviorfile ". + "-ORBInitRef NameService=file://$srv_nsiorfile"); +$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile"); +$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile "); + +# start Naming Service +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($nfs->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($srv->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($con->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$con_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($cli->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } # start Notification Service +$NFS_status = $NFS->Spawn (); -$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; -$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior"); -$NFS->Spawn(); -# the ior file is only used to wait for the service to start -if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $notify_ior\n"; - $NS->Kill (); - $NFS->Kill (); - exit 1; +if ($NFS_status != 0) { + print STDERR "ERROR: Notify Service returned $NFS_status\n"; + exit 1; +} + +if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; } # start MessengerServer -$S = new PerlACE::Process("MessengerServer", $arg_ns_ref); -$S->Spawn(); +$SRV_status = $SRV->Spawn (); -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - $NFS->Kill (); - exit 1; +if ($SRV_status != 0) { + print STDERR "ERROR: Server returned $SRV_status\n"; + exit 1; } + +if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; +} + # start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref); -$MC->Spawn(); +$CON_status = $CON->Spawn (); + +if ($CON_status != 0) { + print STDERR "ERROR: Consumer returned $CON_status\n"; + exit 1; +} # start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NFS->Kill(); - $NS->Kill(); - exit (1); +$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()); + +if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $CON->Kill (); $CON->TimedWait (1); + $SRV->Kill (); $SRV->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $status = 1; +} + +$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval()); + +if ($CON_status != 0) { + print STDERR "ERROR: Messenger Consumer returned $CON_status\n"; + $status = 1; +} + +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; +} +$NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval()); + +if ($NFS_status != 0) { + print STDERR "ERROR: Notification Service returned $NFS_status\n"; + $status = 1; } -$MC->Kill(); -$S->Kill(); -$NFS->Kill(); -$NS->Kill(); +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; +$ns->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nfsiorfile); +$srv->DeleteFile ($srviorfile); -exit 0; +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp index 21c6615ea95..9593e561210 100644 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp @@ -3,7 +3,35 @@ #include "MessengerC.h" #include "orbsvcs/CosNamingC.h" #include <iostream> +#include "ace/Get_Opt.h" +const ACE_TCHAR *ior = ACE_TEXT("file://Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) { try @@ -11,7 +39,10 @@ int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - CORBA::Object_var obj = orb->string_to_object( "file://Messenger.ior" ); + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var obj = orb->string_to_object( ior ); if (CORBA::is_nil(obj.in())) { std::cerr << "Nil Messenger reference" << std::endl; return 1; diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp index 9cc7b95420f..072bf111c29 100644 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp @@ -5,6 +5,30 @@ #include <iostream> #include <fstream> #include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ; + } + // Indicates sucessful parsing of the command line + return 0; +} int ACE_TMAIN (int argc, ACE_TCHAR *argv []) @@ -13,6 +37,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv []) { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + if (parse_args (argc, argv) != 0) + return 1; + CORBA::Object_var rootObj = orb->resolve_initial_references("NameService"); CosNaming::NamingContext_var rootNC = CosNaming::NamingContext::_narrow(rootObj.in()); @@ -28,10 +55,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv []) CORBA::Object_var messenger_obj = poa->id_to_reference (oid.in ()); CORBA::String_var str = orb->object_to_string (messenger_obj.in()); - std::ofstream iorFile ("Messenger.ior"); + std::ofstream iorFile (ACE_TEXT_ALWAYS_CHAR(ior_output_file)); iorFile << str.in () << std::endl; iorFile.close (); - std::cout << "IOR written to file Messenger.ior " << std::endl; + std::cout << "IOR written to file " << ior_output_file << std::endl; orb->run (); orb->destroy (); diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl index b787dd9f8c8..737f4ab9046 100755 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl @@ -4,74 +4,199 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$notify_ior = PerlACE::LocalFile("notify.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; + +$nsiorfile = "ns.ior"; +$srviorfile = "Messenger.ior"; +$nfsiorfile = "notify.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile); +my $srv_nsiorfile = $srv->LocalFile ($nsiorfile); +my $con_nsiorfile = $con->LocalFile ($nsiorfile); +my $cli_nsiorfile = $cli->LocalFile ($nsiorfile); +my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile); +my $srv_srviorfile = $srv->LocalFile ($srviorfile); +my $cli_srviorfile = $cli->LocalFile ($srviorfile); +$ns->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nfsiorfile); +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); -# start Naming Service $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); +$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile"); + + +$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; +$NFS = $nfs->CreateProcess ($NotifyService, "-ORBInitRef NameService=file://$nfs_nsiorfile ". + "-IORoutput $nfs_nfsiorfile"); +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $srv_srviorfile ". + "-ORBInitRef NameService=file://$srv_nsiorfile"); +$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile"); +$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile ". + "-k file://$cli_srviorfile"); + +# start Naming Service +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($nfs->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($srv->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($con->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$con_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($cli->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } # start Notification Service +$NFS_status = $NFS->Spawn (); -$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; -$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior"); -$NFS->Spawn(); -# the ior file is only used to wait for the service to start -if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $notify_ior\n"; - $NS->Kill (); - $NFS->Kill (); - exit 1; +if ($NFS_status != 0) { + print STDERR "ERROR: Notify Service returned $NFS_status\n"; + exit 1; +} + +if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; } # start MessengerServer -$S = new PerlACE::Process("MessengerServer", $arg_ns_ref); -$S->Spawn(); +$SRV_status = $SRV->Spawn (); + +if ($SRV_status != 0) { + print STDERR "ERROR: Server returned $SRV_status\n"; + exit 1; +} -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - $NFS->Kill (); - exit 1; +if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; +} + +if ($srv->GetFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; } +if ($cli->PutFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; +} + # start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref); -$MC->Spawn(); +$CON_status = $CON->Spawn (); + +if ($CON_status != 0) { + print STDERR "ERROR: Consumer returned $CON_status\n"; + exit 1; +} # start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NFS->Kill(); - $NS->Kill(); - exit (1); +$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()); + +if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $CON->Kill (); $CON->TimedWait (1); + $SRV->Kill (); $SRV->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $status = 1; +} + +$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval()); + +if ($CON_status != 0) { + print STDERR "ERROR: Messenger Consumer returned $CON_status\n"; + $status = 1; } -$MC->Kill(); -$S->Kill(); -$NFS->Kill(); -$NS->Kill(); +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; +} +$NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval()); + +if ($NFS_status != 0) { + print STDERR "ERROR: Notification Service returned $NFS_status\n"; + $status = 1; +} + +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; +$ns->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nfsiorfile); +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); -exit 0; +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp index 226fd6b54c6..789bd3b575f 100644 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp @@ -3,6 +3,35 @@ #include "MessengerC.h" #include "orbsvcs/CosNamingC.h" #include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT("file://Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) { @@ -10,7 +39,11 @@ int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) { // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - CORBA::Object_var obj = orb->string_to_object( "file://Messenger.ior" ); + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var obj = orb->string_to_object( ior ); if (CORBA::is_nil(obj.in())) { std::cerr << "Nil Messenger reference" << std::endl; return 1; diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp index 8d6f28b5ae5..39b64f2faae 100644 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp @@ -10,6 +10,30 @@ #include "Priorities.h" #include <iostream> #include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *output_file = ACE_TEXT ("MessengerConsumer.ready"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ; + } + // Indicates sucessful parsing of the command line + return 0; +} int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) @@ -18,6 +42,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + if (parse_args (argc, argv) != 0) + return 1; + CORBA::Object_var naming_obj = orb->resolve_initial_references ("NameService"); @@ -166,7 +193,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) poa_manager->activate(); // Write a file to let the run_test.pl script know we are ready. - std::ofstream iorFile( "MessengerConsumer.ready" ); + std::ofstream iorFile( ACE_TEXT_ALWAYS_CHAR(output_file) ); iorFile << "Ready" << std::endl; iorFile.close(); diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp index f375895feb6..3413f093c09 100644 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp @@ -4,6 +4,31 @@ #include "Messenger_i.h" #include <iostream> #include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ; + } + // Indicates sucessful parsing of the command line + return 0; +} + int ACE_TMAIN (int argc, ACE_TCHAR *argv []) { @@ -11,6 +36,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv []) { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + if (parse_args (argc, argv) != 0) + return 1; + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); PortableServer::POAManager_var mgr = poa->the_POAManager(); @@ -22,10 +50,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv []) CORBA::Object_var messenger_obj = poa->id_to_reference (oid.in ()); CORBA::String_var str = orb->object_to_string (messenger_obj.in()); - std::ofstream iorFile ("Messenger.ior"); + std::ofstream iorFile (ACE_TEXT_ALWAYS_CHAR(ior_output_file)); iorFile << str.in () << std::endl; iorFile.close (); - std::cout << "IOR written to file Messenger.ior " << std::endl; + std::cout << "IOR written to file " << ior_output_file << std::endl; orb->run (); orb->destroy (); diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl index eaaceb005b9..227d221bab4 100755 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl @@ -4,89 +4,212 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$notify_ior = PerlACE::LocalFile("notify.ior"); -$consumerfile = PerlACE::LocalFile("MessengerConsumer.ready"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; -unlink $consumerfile; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; + +$nsiorfile = "ns.ior"; +$srviorfile = "Messenger.ior"; +$nfsiorfile = "notify.ior"; +$confile = "MessengerConsumer.ready"; +$conconf = "notify.conf"; +$nscliconf = "nsclient.conf"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile); +my $srv_nsiorfile = $srv->LocalFile ($nsiorfile); +my $con_nsiorfile = $con->LocalFile ($nsiorfile); +my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile); +my $srv_srviorfile = $srv->LocalFile ($srviorfile); +my $cli_srviorfile = $cli->LocalFile ($srviorfile); +my $con_confile = $con->LocalFile ($confile); +my $con_conconf = $con->LocalFile ($conconf); +my $srv_nscliconf = $srv->LocalFile ($nscliconf); +my $con_nscliconf = $con->LocalFile ($nscliconf); +$ns->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nfsiorfile); +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); +$con->DeleteFile ($confile); -# start Naming Service $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); +$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile"); + + +$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; +$NFS = $nfs->CreateProcess ($NotifyService, "-ORBInitRef NameService=file://$nfs_nsiorfile ". + "-IORoutput $nfs_nfsiorfile ". + "-ORBSvcConf $con_conconf"); +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $srv_srviorfile ". + "-ORBInitRef NameService=file://$srv_nsiorfile ". + "-ORBSvcConf $srv_nscliconf"); +$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile ". + "-ORBSvcConf $con_nscliconf ". + "-o $con_confile"); +$CLI = $cli->CreateProcess ("MessengerClient", "-k file://$cli_srviorfile"); + +# start Naming Service +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($nfs->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($srv->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($con->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$con_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } # start Notification Service +$NFS_status = $NFS->Spawn (); -$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; -$NFS = new PerlACE::Process($NotifyService, - "$arg_ns_ref -IORoutput $notify_ior " . - "-ORBSvcConf notify.conf"); -$NFS->Spawn(); -# the ior file is only used to wait for the service to start -if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $notify_ior\n"; - $NS->Kill (); - $NFS->Kill (); - exit 1; +if ($NFS_status != 0) { + print STDERR "ERROR: Notify Service returned $NFS_status\n"; + exit 1; +} + +if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; } # start MessengerServer -$S = new PerlACE::Process("MessengerServer", - "$arg_ns_ref -ORBSvcConf nsclient.conf"); -$S->Spawn(); - -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 15) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - $NFS->Kill (); - exit 1; +$SRV_status = $SRV->Spawn (); + +if ($SRV_status != 0) { + print STDERR "ERROR: Server returned $SRV_status\n"; + exit 1; +} + +if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; } + +if ($srv->GetFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; +} +if ($cli->PutFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; +} + # start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", - "$arg_ns_ref -ORBSvcConf nsclient.conf"); -$MC->Spawn(); -if (PerlACE::waitforfile_timed ($consumerfile, 15) == -1) { - print STDERR "ERROR: Timed out waiting for $consumerfile\n"; - $MC->Kill(); - $S->Kill(); - $NS->Kill(); - $NFS->Kill(); - exit 1; +$CON_status = $CON->Spawn (); + +if ($CON_status != 0) { + print STDERR "ERROR: Consumer returned $CON_status\n"; + exit 1; +} + +if ($con->WaitForFileTimed ($confile,$con->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$con_confile>\n"; + $CON->Kill (); $CON->TimedWait (1); + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; } # start MessengerClient -$C = new PerlACE::Process("MessengerClient", ""); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NFS->Kill(); - $NS->Kill(); - exit (1); -} - -$MC->Kill(); -$S->Kill(); -$NFS->Kill(); -$NS->Kill(); - -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; -unlink $consumerfile; - -exit 0; +$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()); + +if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $CON->Kill (); $CON->TimedWait (1); + $SRV->Kill (); $SRV->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $status = 1; +} + +$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval()); + +if ($CON_status != 0) { + print STDERR "ERROR: Messenger Consumer returned $CON_status\n"; + $status = 1; +} + +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; +} +$NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval()); + +if ($NFS_status != 0) { + print STDERR "ERROR: Notification Service returned $NFS_status\n"; + $status = 1; +} + +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} + +$ns->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$nfs->DeleteFile ($nfsiorfile); +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); +$con->DeleteFile ($confile); + +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp index f557611910b..48fa393279e 100644 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp @@ -4,6 +4,31 @@ #include "Messenger_i.h" #include <iostream> #include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ; + } + // Indicates sucessful parsing of the command line + return 0; +} + int ACE_TMAIN (int argc, ACE_TCHAR *argv []) { @@ -12,6 +37,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv []) // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + if (parse_args (argc, argv) != 0) + return 1; + // Find the Naming Service. CORBA::Object_var rootObj = orb->resolve_initial_references("NameService"); CosNaming::NamingContext_var rootNC = @@ -41,10 +69,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv []) rootNC->rebind(name, messenger_obj.in()); CORBA::String_var str = orb->object_to_string (messenger_obj.in()); - std::ofstream iorFile ("Messenger.ior"); + std::ofstream iorFile (ACE_TEXT_ALWAYS_CHAR(ior_output_file)); iorFile << str.in () << std::endl; iorFile.close (); - std::cout << "IOR written to file Messenger.ior " << std::endl; + std::cout << "IOR written to file " << ior_output_file << std::endl; // Accept requests orb->run(); diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl index f0656a34a6c..45e2954e5d8 100755 --- a/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl @@ -4,55 +4,140 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $srv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $con = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $cli = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; + +$nsiorfile = "ns.ior"; +$srviorfile = "Messenger.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $srv_nsiorfile = $srv->LocalFile ($nsiorfile); +my $con_nsiorfile = $con->LocalFile ($nsiorfile); +my $cli_nsiorfile = $cli->LocalFile ($nsiorfile); +my $srv_srviorfile = $srv->LocalFile ($srviorfile); +$ns->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +$srv->DeleteFile ($srviorfile); -# start Naming Service $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); +$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile"); + +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $srv_srviorfile ". + "-ORBInitRef NameService=file://$srv_nsiorfile"); +$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile"); +$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile "); + +# start Naming Service +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($srv->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($con->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$con_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($cli->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } # start MessengerServer -$S = new PerlACE::Process("MessengerServer", $arg_ns_ref); -$S->Spawn(); +$SRV_status = $SRV->Spawn (); + +if ($SRV_status != 0) { + print STDERR "ERROR: Server returned $SRV_status\n"; + exit 1; +} -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - exit 1; +if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + exit 1; } + # start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref); -$MC->Spawn(); +$CON_status = $CON->Spawn (); + +if ($CON_status != 0) { + print STDERR "ERROR: Consumer returned $CON_status\n"; + exit 1; +} # start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NS->Kill(); - exit (1); +$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()); + +if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $CON->Kill (); $CON->TimedWait (1); + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $status = 1; } -$MC->Kill(); -$S->Kill(); -$NS->Kill(); +$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval()); + +if ($CON_status != 0) { + print STDERR "ERROR: Messenger Consumer returned $CON_status\n"; + $status = 1; +} + +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; +} + +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} -unlink $nsiorfile; -unlink $messiorfile; +$ns->DeleteFile ($nsiorfile); +$srv->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +$srv->DeleteFile ($srviorfile); -exit 0; +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl b/TAO/orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl index 56c57b64a40..98129a9a765 100755 --- a/TAO/orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl @@ -4,44 +4,86 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; -$nsiorfile = PerlACE::LocalFile ("ns.ior"); -unlink $nsiorfile; +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; + +$nsiorfile = "ns.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +$ns->DeleteFile ($nsiorfile); + +$hostname = $ns->HostName (); $PORT=9876; -# start Naming Service $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile -ORBListenEndpoints iiop://localhost:$PORT"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); +$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile ". + "-ORBListenEndpoints iiop://$hostname:$PORT"); + +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-ORBInitRef NameService=iioploc://$hostname:$PORT/NameService"); + +$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=iioploc://$hostname:$PORT/NameService "); + +# start Naming Service +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; exit 1; } -# start MessengerServer -$IREF = "-ORBInitRef NameService=iioploc://localhost:$PORT/NameService"; +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} # start MessengerServer -$S = new PerlACE::Process("MessengerServer", $IREF); -$S->Spawn(); +$SRV_status = $SRV->Spawn (); + +if ($SRV_status != 0) { + print STDERR "ERROR: Server returned $SRV_status\n"; + exit 1; +} # start MessengerClient -$C = new PerlACE::Process("MessengerClient", $IREF); -if ($C->SpawnWaitKill(15) != 0) { - $S->Kill(); - $NS->Kill(); - exit(1); +$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()); + +if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $status = 1; } + # clean-up +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); -$S->Kill(); -$NS->Kill(); +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; +} -exit 0; +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} +$ns->DeleteFile ($nsiorfile); +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp index d5ac902909d..585dbb67dd9 100644 --- a/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp +++ b/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp @@ -76,33 +76,39 @@ // static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" // +const ACE_TCHAR *ior = ACE_TEXT("file://Messenger.ior"); int which = 0; int parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt get_opts (argc, argv, "e:"); + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("e:k:")); int c; while ((c = get_opts ()) != -1) switch (c) { + case 'k': + ior = get_opts.opt_arg (); + break; case 'e': which = ACE_OS::atoi(get_opts.optarg); if(which < 1 || 2 < which) ACE_ERROR_RETURN ((LM_ERROR, "Usage: %s " - "-e [12]" + "-e [12] " + "-k <ior>" "\n", argv [0]), -1); break; - case '?': + case '?': default: ACE_ERROR_RETURN ((LM_ERROR, "Usage: %s " - "-e [12]" + "-e [12] " + "-k <ior>" "\n", argv [0]), -1); @@ -119,14 +125,14 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - CORBA::Object_var obj = - orb->string_to_object( "file://Messenger.ior" ); - if (parse_args (argc, argv) != 0) return 1; else if(which < 1 || 2 < which) return 1; + CORBA::Object_var obj = + orb->string_to_object( ior ); + Security::QOP qop; CORBA::Any protection; Security::EstablishTrust establish_trust; diff --git a/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp index 430cd575761..4bdbd816ed2 100644 --- a/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp +++ b/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp @@ -3,6 +3,30 @@ #include "Messenger_i.h" #include <iostream> #include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ; + } + // Indicates sucessful parsing of the command line + return 0; +} int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { @@ -10,6 +34,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + if (parse_args (argc, argv) != 0) + return 1; + //Get reference to Root POA CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); @@ -27,10 +54,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) poa->activate_object( messenger_servant.in() ); CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() ); CORBA::String_var str = orb->object_to_string( messenger_obj.in() ); - std::ofstream iorFile( "Messenger.ior" ); + std::ofstream iorFile( ACE_TEXT_ALWAYS_CHAR(ior_output_file) ); iorFile << str.in() << std::endl; iorFile.close(); - std::cout << "IOR written to file Messenger.ior" << std::endl; + std::cout << "IOR written to file " << ior_output_file << std::endl; // Accept requests orb->run(); diff --git a/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl b/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl index 1e1ac789af7..bb6201a9af4 100755 --- a/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl @@ -4,66 +4,149 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; -$file = PerlACE::LocalFile("Messenger.ior"); +$status = 0; +$debug_level = '0'; -unlink $file; - -$ENV{'SSL_CERT_FILE'} = 'cacert.pem'; - -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", - "-ORBSvcConf server.conf"); +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -$S1 = new PerlACE::Process("MessengerServer", - "-ORBSvcConf server1.conf"); +my $srv = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $cli = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $srv1 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $cli1 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; + +$srviorfile = "Messenger.ior"; +$srvconf = "server.conf"; +$srv1conf = "server1.conf"; +$cliconf = "client.conf"; +$cli1conf = "client1.conf"; + +my $srv_srviorfile = $srv->LocalFile ($srviorfile); +my $cli_srviorfile = $cli->LocalFile ($srviorfile); +my $srv1_srviorfile = $srv1->LocalFile ($srviorfile); +my $cli1_srviorfile = $cli1->LocalFile ($srviorfile); +my $srv_srvconf = $srv->LocalFile ($srvconf); +my $srv_srv1conf = $srv->LocalFile ($srv1conf); +my $cli_cliconf = $srv->LocalFile ($cliconf); +my $cli_cli1conf = $srv->LocalFile ($cli1conf); +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); +$srv1->DeleteFile ($srviorfile); +$cli1->DeleteFile ($srviorfile); -$C = new PerlACE::Process("MessengerClient", - "-e 1 -ORBSvcConf client.conf"); +$ENV{'SSL_CERT_FILE'} = 'cacert.pem'; -$C1 = new PerlACE::Process("MessengerClient", - "-e 2 -ORBSvcConf client1.conf"); +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $srv_srviorfile ". + "-ORBSvcConf $srv_srvconf"); +$SRV1 = $srv1->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $srv1_srviorfile ". + "-ORBSvcConf $srv_srv1conf"); +$CLI = $cli->CreateProcess ("MessengerClient", "-e 1 ". + "-k file://$cli_srviorfile ". + "-ORBSvcConf $cli_cliconf"); +$CLI1 = $cli1->CreateProcess ("MessengerClient", "-e 2 ". + "-k file://$cli1_srviorfile ". + "-ORBSvcConf $cli_cli1conf"); +# start MessengerServer print STDERR "\n\nSecurity Policy Controlling Application Examples\n"; print STDERR "------------------------------------------------\n"; print STDERR "Starting Messenger Server, example 1...\n\n"; -$S->Spawn(); -if (PerlACE::waitforfile_timed ($file, 5) == -1) { - print STDERR "ERROR: cannot find file <$file>\n"; - $SV->Kill (); +$SRV_status = $SRV->Spawn (); + +if ($SRV_status != 0) { + print STDERR "ERROR: Server returned $SRV_status\n"; + exit 1; +} + +if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + exit 1; +} + +if ($srv->GetFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + exit 1; +} +if ($cli->PutFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); exit 1; } print STDERR "\nStarting MessengerClient, example 1...\n\n"; -if ($C->SpawnWaitKill(10) != 0) { - $S->Kill(); - exit (1); +$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()); + +if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $SRV->Kill (); $SRV->TimedWait (1); + exit 1; } -unlink $file; -$S->Kill(); +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + exit 1; +} + +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); + print STDERR "\nStarting Messenger Server, example 2...\n\n"; -$S1->Spawn(); -if (PerlACE::waitforfile_timed ($file, 5) == -1) { - print STDERR "ERROR: cannot find file <$file>\n"; - $SV->Kill (); +$SRV_status = $SRV1->Spawn (); + +if ($SRV_status != 0) { + print STDERR "ERROR: Server returned $SRV_status\n"; + exit 1; +} + +if ($srv1->WaitForFileTimed ($srviorfile,$srv1->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$srv1_srviorfile>\n"; + $SRV1->Kill (); $SRV1->TimedWait (1); + exit 1; +} + +if ($srv1->GetFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$srv1_srviorfile>\n"; + $SRV1->Kill (); $SRV1->TimedWait (1); + exit 1; +} +if ($cli1->PutFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli1_srviorfile>\n"; + $SRV1->Kill (); $SRV1->TimedWait (1); exit 1; } print STDERR "\nStarting MessengerClient, example 2...\n\n"; -if ($C1->SpawnWaitKill(10) != 0) { - $S->Kill(); - exit (1); +$CLI_status = $CLI1->SpawnWaitKill ($cli1->ProcessStartWaitInterval()); + +if ($CLI_status != 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $SRV1->Kill (); $SRV1->TimedWait (1); + $status = 1; } -# clean-up -$S1->Kill(); +$SRV_status = $SRV1->TerminateWaitKill ($srv1->ProcessStopWaitInterval()); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + $status = 1; +} -exit 0; +$srv1->DeleteFile ($srviorfile); +$cli1->DeleteFile ($srviorfile); +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp index 76f812e7cff..a7ac2d75343 100644 --- a/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp +++ b/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp @@ -2,14 +2,47 @@ #include "MessengerC.h" #include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT("file://Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { try { // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + if (parse_args (argc, argv) != 0) + return 1; + // Destringify ior - CORBA::Object_var obj = orb->string_to_object( "file://Messenger.ior" ); + CORBA::Object_var obj = orb->string_to_object( ior ); if (CORBA::is_nil(obj.in())) { std::cerr << "Nil Messenger reference" << std::endl; return 1; diff --git a/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp index e0d7bfe827b..cb99ce025d7 100644 --- a/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp +++ b/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp @@ -3,6 +3,31 @@ #include "Messenger_i.h" #include <iostream> #include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ; + } + // Indicates sucessful parsing of the command line + return 0; +} + int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { @@ -10,6 +35,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + if (parse_args (argc, argv) != 0) + return 1; + //Get reference to Root POA CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); @@ -27,10 +55,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) poa->activate_object( messenger_servant.in() ); CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() ); CORBA::String_var str = orb->object_to_string( messenger_obj.in() ); - std::ofstream iorFile( "Messenger.ior" ); + std::ofstream iorFile( ACE_TEXT_ALWAYS_CHAR(ior_output_file) ); iorFile << str.in() << std::endl; iorFile.close(); - std::cout << "IOR written to file Messenger.ior" << std::endl; + std::cout << "IOR written to file "<< ior_output_file << std::endl; // Accept requests orb->run(); diff --git a/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl b/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl index 0b3a2b0446e..1ccc9ab5cbf 100755 --- a/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl @@ -4,61 +4,132 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; -$file = PerlACE::LocalFile("Messenger.ior"); +$status = 0; +$debug_level = '0'; -unlink $file; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $srv = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $cli = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $cli1 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $cli2 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; + +$srviorfile = "Messenger.ior"; +$srvconf = "server.conf"; +$cliconf = "client.conf"; +$cli1conf = "client1.conf"; + +my $srv_srviorfile = $srv->LocalFile ($srviorfile); +my $cli_srviorfile = $cli->LocalFile ($srviorfile); +my $cli1_srviorfile = $cli1->LocalFile ($srviorfile); +my $cli2_srviorfile = $cli2->LocalFile ($srviorfile); +my $srv_srvconf = $srv->LocalFile ($srvconf); +my $cli_cliconf = $srv->LocalFile ($cliconf); +my $cli_cli1conf = $srv->LocalFile ($cli1conf); +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); +$cli1->DeleteFile ($srviorfile); +$cli2->DeleteFile ($srviorfile); $ENV{'SSL_CERT_FILE'} = 'cacert.pem'; -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", - "-ORBSvcConf server.conf"); +$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $srv_srviorfile ". + "-ORBSvcConf $srv_srvconf"); +$CLI = $cli->CreateProcess ("MessengerClient", "-k file://$cli_srviorfile "); +$CLI1 = $cli1->CreateProcess ("MessengerClient", "-k file://$cli_srviorfile ". + "-ORBSvcConf $cli_cliconf"); +$CLI2 = $cli2->CreateProcess ("MessengerClient", "-k file://$cli1_srviorfile ". + "-ORBSvcConf $cli_cli1conf"); +# start MessengerServer print STDERR "\n\nSecurity Unaware Application Examples\n"; print STDERR "-------------------------------------\n"; print STDERR "Starting Messenger Server...\n\n"; -$S->Spawn(); -if (PerlACE::waitforfile_timed ($file, 5) == -1) { - print STDERR "ERROR: cannot find file <$file>\n"; - $SV->Kill (); +$SRV_status = $SRV->Spawn (); + +if ($SRV_status != 0) { + print STDERR "ERROR: Server returned $SRV_status\n"; exit 1; } -# start MessengerClient -$C = new PerlACE::Process("MessengerClient"); +if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + exit 1; +} -$C1 = new PerlACE::Process("MessengerClient", - "-ORBSvcConf client.conf"); +if ($srv->GetFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + exit 1; +} +if ($cli->PutFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + exit 1; +} +if ($cli1->PutFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli1_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + exit 1; +} +if ($cli2->PutFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli2_srviorfile>\n"; + $SRV->Kill (); $SRV->TimedWait (1); + exit 1; +} -$C2 = new PerlACE::Process("MessengerClient", - "-ORBSvcConf client1.conf"); +# start MessengerClient print STDERR "\nStarting MessengerClient, example 1...\n\n"; -if ($C->SpawnWaitKill(10) == 0) { - $S->Kill(); - exit (1); +$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()); + +if ($CLI_status == 0) { + print STDERR "ERROR: Messenger Client returned $CLI_status\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $status = 1; } print STDERR "\nStarting MessengerClient, example 2...\n\n"; -if ($C1->SpawnWaitKill(10) != 0) { - $S->Kill(); - exit (1); +$CLI1_status = $CLI1->SpawnWaitKill ($cli1->ProcessStartWaitInterval()); + +if ($CLI1_status != 0) { + print STDERR "ERROR: Messenger Client1 returned $CLI1_status\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $status = 1; } $ENV{'SSL_CERT_FILE'} = ''; print STDERR "\nStarting MessengerClient, example 3...\n\n"; -if ($C2->SpawnWaitKill(10) != 0) { - $S->Kill(); - exit (1); +$CLI2_status = $CLI2->SpawnWaitKill ($cli2->ProcessStartWaitInterval()); + +if ($CLI2_status != 0) { + print STDERR "ERROR: Messenger Client2 returned $CLI2_status\n"; + $SRV->Kill (); $SRV->TimedWait (1); + $status = 1; } # clean-up -$S->Kill(); +$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval()); + +if ($SRV_status != 0) { + print STDERR "ERROR: Messenger Server returned $SRV_status\n"; + exit 1; +} + +$srv->DeleteFile ($srviorfile); +$cli->DeleteFile ($srviorfile); +$cli1->DeleteFile ($srviorfile); +$cli2->DeleteFile ($srviorfile); -exit 0; +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp index 099ad96ad48..c80e78b1ec9 100644 --- a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp +++ b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp @@ -3,7 +3,6 @@ // This supplier requires that the Notify_Service is started with // -IOROutput notify.ior -channel -nonamesvc // at minimum. -const char* notify_ior = "corbaloc::localhost:8888/NotifyEventChannelFactory"; #include "Event_i.h" @@ -16,8 +15,39 @@ const char* notify_ior = "corbaloc::localhost:8888/NotifyEventChannelFactory"; #include <iostream> #include <stdexcept> +#include "ace/Get_Opt.h" -const char* ec_ior_output_file = "ec.ior"; +const ACE_TCHAR *ec_ior_output_file = ACE_TEXT ("ec.ior"); +const ACE_TCHAR *hostname = ACE_TEXT ("localhost"); +const ACE_TCHAR *port = ACE_TEXT("8888"); +//const char* notify_ior = "corbaloc::localhost:8888/NotifyEventChannelFactory"; + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:h:p:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ec_ior_output_file = get_opts.opt_arg (); + break; + case 'h': + hostname = get_opts.opt_arg (); + break; + case 'p': + port = get_opts.opt_arg (); + break; + + case '?': + default: + ; + } + // Indicates sucessful parsing of the command line + return 0; +} class TestConsumer : public POA_CosEventComm::PushConsumer { @@ -135,6 +165,9 @@ int ACE_TMAIN (int ac, ACE_TCHAR* av[]) { try { CORBA::ORB_var orb = CORBA::ORB_init(ac, av); + if (parse_args (ac, av) != 0) + return 1; + CORBA::ValueFactoryBase_var factory = new MyEventFactory; CORBA::String_var id = _tc_MyEvent->id(); orb->register_value_factory(id.in(), factory.in()); @@ -144,7 +177,14 @@ int ACE_TMAIN (int ac, ACE_TCHAR* av[]) { PortableServer::POA::_unchecked_narrow(obj.in()); PortableServer::POAManager_var mgr = poa->the_POAManager(); - obj = orb->string_to_object(notify_ior); + // "corbaloc::localhost:8888/NotifyEventChannelFactory" + ACE_CString notify_ior ("corbaloc::"); + notify_ior += ACE_TEXT_ALWAYS_CHAR (hostname); + notify_ior += ":"; + notify_ior += ACE_TEXT_ALWAYS_CHAR (port); + notify_ior += "/NotifyEventChannelFactory"; + + obj = orb->string_to_object(notify_ior.c_str()); CosNotifyChannelAdmin::EventChannelFactory_var ecf = CosNotifyChannelAdmin::EventChannelFactory::_unchecked_narrow(obj.in()); diff --git a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl index 285f3b3df0c..4f096515287 100755 --- a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl @@ -6,28 +6,58 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # $Id$ # -*- perl -*- -use Env(ACE_ROOT); -use Env (TAO_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; -my $ec_ior = PerlACE::LocalFile ("ec.ior"); -my $notifyior = PerlACE::LocalFile ("notify.ior"); -my $notify_conf = PerlACE::LocalFile ("notify$PerlACE::svcconf_ext"); +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; -my $TS = new PerlACE::Process ("$TAO_ROOT/orbsvcs/Notify_Service/Notify_Service", - "-boot -orblistenendpoints iiop://:8888 -NoNameSvc -IORoutput $notifyior -ORBSvcConf " . - "$notify_conf"); -my $SUP = new PerlACE::Process ("supplier"); -my $CONS = new PerlACE::Process ("consumer"); +$status = 0; +$debug_level = '0'; -unlink $ec_ior; -unlink $notifyior; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -$TS->Spawn (); +my $nfs = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $sup = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $con = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; + +$conf = $PerlACE::svcconf_ext; +$hostname = $nfs->HostName(); +$port = "8888"; + +my $eciorfile = "ec.ior"; +my $nfsiorfile = "notify.ior"; +my $nfsconf = "notify$conf"; + +my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile); +my $con_eciorfile = $con->LocalFile ($eciorfile); +my $sup_eciorfile = $sup->LocalFile ($eciorfile); +my $nfs_nfsconf = $nfs->LocalFile ($nfsconf); +$nfs->DeleteFile ($nfsiorfile); +$con->DeleteFile ($eciorfile); +$sup->DeleteFile ($eciorfile); + +$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; +$NFS = $nfs->CreateProcess ($NotifyService, " -boot ". + "-orblistenendpoints iiop://:$port ". + "-NoNameSvc ". + "-IORoutput $nfs_nfsiorfile ". + "-ORBSvcConf $nfs_nfsconf"); +$SUP = $sup->CreateProcess ("supplier", "-k $sup_eciorfile -h $hostname -p $port"); +$CON = $con->CreateProcess ("consumer", "-o $con_eciorfile -h $hostname -p $port"); + +$NFS_status = $NFS->Spawn (); + +if ($NFS_status != 0) { + print STDERR "ERROR: Notify Service returned $NFS_status\n"; + exit 1; +} -if (PerlACE::waitforfile_timed ($notifyior, $PerlACE::wait_interval_for_process_creation) == -1) { - $TS->Kill (); +if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n"; + $NFS->Kill (); $NFS->TimedWait (1); exit 1; } @@ -36,17 +66,31 @@ print "****** Running consumer ******\n"; ## The consumer takes one argument indicating ## how many events to receive before disconnecting. -$CONS->Arguments("5"); -my $client = $CONS->Spawn(); -if ($client != 0) { - $TS->Kill (); - exit 1; +$CON->Arguments("5"); +$CON_status = $CON->Spawn (); + +if ($CON_status != 0) { + print STDERR "ERROR: Consumer returned $CON_status\n"; + exit 1; +} + +if ($con->WaitForFileTimed ($eciorfile,$con->ProcessStartWaitInterval()+5) == -1) { + print STDERR "ERROR: cannot find file <$con_eciorfile>\n"; + $CON->Kill (); $CON->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; } -## The supplier needs wait after the consumer creates the event channel. -if (PerlACE::waitforfile_timed ($ec_ior, 20) == -1) { - $TS->Kill (); - $client->Kill (); +if ($con->GetFile ($eciorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$con_eciorfile>\n"; + $CON->Kill (); $CON->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); + exit 1; +} +if ($sup->PutFile ($eciorfile) == -1) { + print STDERR "ERROR: cannot set file <$sup_eciorfile>\n"; + $CON->Kill (); $CON->TimedWait (1); + $NFS->Kill (); $NFS->TimedWait (1); exit 1; } @@ -57,25 +101,31 @@ if (PerlACE::waitforfile_timed ($ec_ior, 20) == -1) { print "****** Running supplier ******\n"; $SUP->Arguments("10 5"); -my $server = $SUP->Spawn(); -if ($server != 0) { - $TS->Kill(); - $CONS->Kill(); - exit 1; +$SUP_status = $SUP->Spawn (); + +if ($SUP_status != 0) { + print STDERR "ERROR: Supplier returned $SUP_status\n"; + $status = 1; } -$CONS->WaitKill(30); +$CON_status = $CON->WaitKill ($con->ProcessStopWaitInterval()+15); +if ($CON_status != 0) { + print STDERR "ERROR: Consumer returned $CON_status\n"; + $status = 1; +} + +$SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval()+15); -$server = $SUP->WaitKill(30); -if ($server != 0) { - $TS->Kill(); - $CONS->Kill(); - exit 1; +if ($SUP_status != 0) { + print STDERR "ERROR: Supplier returned $SUP_status\n"; + $status = 1; } -$TS->Kill (); +$NFS->Kill (); $NFS->TimedWait (1); + +$nfs->DeleteFile ($nfsiorfile); +$con->DeleteFile ($eciorfile); +$sup->DeleteFile ($eciorfile); -unlink $ec_ior; -unlink $notifyior; -exit 0; +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/supplier.cpp b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/supplier.cpp index 97bbb208c9a..06759c263d5 100644 --- a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/supplier.cpp +++ b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/supplier.cpp @@ -3,7 +3,6 @@ // This supplier requires that the Notify_Service is started with // -IOROutput notify.ior -channel -nonamesvc // at minimum. -const char* notify_ior = "corbaloc::localhost:8888/NotifyEventChannelFactory"; #include "Event_i.h" @@ -18,13 +17,51 @@ const char* notify_ior = "corbaloc::localhost:8888/NotifyEventChannelFactory"; #include "ace/Event_Handler.h" #include <iostream> #include <stdexcept> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ec_ior = ACE_TEXT("file://ec.ior"); +const ACE_TCHAR *hostname = ACE_TEXT("localhost"); +const ACE_TCHAR *port = ACE_TEXT("8888"); +//const char* notify_ior = "corbaloc::localhost:8888/NotifyEventChannelFactory"; + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:h:p:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ec_ior = get_opts.opt_arg (); + break; + case 'h': + hostname = get_opts.opt_arg (); + break; + case 'p': + port = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ec_ior> " + "-h <host> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + const ACE_Time_Value EVENT_DELAY(0, 10 * 1000); static MyEvent_var event_; -const char* ec_ior = "file://ec.ior"; - class TestSupplier : public POA_CosEventComm::PushSupplier , public ACE_Event_Handler @@ -159,6 +196,9 @@ int ACE_TMAIN (int ac, ACE_TCHAR* av[]) { CORBA::ORB_var orb = CORBA::ORB_init(ac, av); + if (parse_args (ac, av) != 0) + return 1; + CORBA::ValueFactoryBase_var vfb = new MyEventFactory; CORBA::String_var id = _tc_MyEvent->id(); orb->register_value_factory(id.in(), vfb); @@ -167,8 +207,15 @@ int ACE_TMAIN (int ac, ACE_TCHAR* av[]) { PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); PortableServer::POAManager_var mgr = poa->the_POAManager(); - - obj = orb->string_to_object(notify_ior); + + // "corbaloc::localhost:8888/NotifyEventChannelFactory" + ACE_CString notify_ior ("corbaloc::"); + notify_ior += ACE_TEXT_ALWAYS_CHAR (hostname); + notify_ior += ":"; + notify_ior += ACE_TEXT_ALWAYS_CHAR (port); + notify_ior += "/NotifyEventChannelFactory"; + + obj = orb->string_to_object(notify_ior.c_str()); CosNotifyChannelAdmin::EventChannelFactory_var ecf = CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj.in()); if (CORBA::is_nil(ecf.in())) diff --git a/TAO/orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test.pl b/TAO/orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test.pl index 30bfb1cb72d..05096ee23c4 100755 --- a/TAO/orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test.pl +++ b/TAO/orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test.pl @@ -6,7 +6,25 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $es = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $ce1 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $ce2 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $co1 = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; +my $co2 = PerlACE::TestTarget::create_target (6) || die "Create target 6 failed\n"; +my $su1 = PerlACE::TestTarget::create_target (7) || die "Create target 7 failed\n"; +my $su2 = PerlACE::TestTarget::create_target (8) || die "Create target 8 failed\n"; #event count $ev_count = 20; @@ -24,9 +42,25 @@ $CosEC1_params = "-n cosec1 -e 21 -o 6 -p \"5 20\""; # for SupplierQOS: EventID = 21, SourceID = 6. $CosEC2_params = "-n cosec2 -e 20 -o 5 -p \"6 21\""; -$nsior = PerlACE::LocalFile ("ns.ior"); - -unlink $nsior; +$nsiorfile = "ns.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $es_nsiorfile = $es->LocalFile ($nsiorfile); +my $ce1_nsiorfile = $ce1->LocalFile ($nsiorfile); +my $ce2_nsiorfile = $ce2->LocalFile ($nsiorfile); +my $co1_nsiorfile = $co1->LocalFile ($nsiorfile); +my $co2_nsiorfile = $co2->LocalFile ($nsiorfile); +my $su1_nsiorfile = $su1->LocalFile ($nsiorfile); +my $su2_nsiorfile = $su2->LocalFile ($nsiorfile); + +$ns->DeleteFile ($nsiorfile); +$es->DeleteFile ($nsiorfile); +$ce1->DeleteFile ($nsiorfile); +$ce2->DeleteFile ($nsiorfile); +$co1->DeleteFile ($nsiorfile); +$co2->DeleteFile ($nsiorfile); +$su1->DeleteFile ($nsiorfile); +$su2->DeleteFile ($nsiorfile); # Parse the arguments @@ -41,138 +75,226 @@ for ($i = 0; $i <= $#ARGV; $i++) { } } -$NS = new PerlACE::Process ("../../../../../Naming_Service/Naming_Service", - "-o $nsior"); - -$EC = new PerlACE::Process ("../../../../../Event_Service/Event_Service", - "-t new -ORBInitRef NameService=file://$nsior"); - -$CE1 = new PerlACE::Process ("../../bin/RtEC_Based_CosEC", - "-ORBInitRef NameService=file://$nsior $CosEC1_params"); - -$CE2 = new PerlACE::Process ("../../bin/RtEC_Based_CosEC", - "-ORBInitRef NameService=file://$nsior $CosEC2_params"); - -$CO1 = new PerlACE::Process ("Consumer", - "-ORBInitRef NameService=file://$nsior -n cosec1 -c $ev_count"); - -$SU1 = new PerlACE::Process ("Supplier", - "-ORBInitRef NameService=file://$nsior -n cosec2 -c $ev_count"); - -$CO2 = new PerlACE::Process ("Consumer", - "-ORBInitRef NameService=file://$nsior -n cosec2 -c $ev_count"); - -$SU2 = new PerlACE::Process ("Supplier", - "-ORBInitRef NameService=file://$nsior -n cosec1 -c $ev_count"); +$NS = $ns->CreateProcess ($ENV{"TAO_ROOT"}."/orbsvcs/Naming_Service/Naming_Service", + "-o $ns_nsiorfile"); + +$ES = $es->CreateProcess ($ENV{"TAO_ROOT"}."/orbsvcs/Event_Service/Event_Service", + "-t new -ORBInitRef NameService=file://$es_nsiorfile"); + +$CE1 = $ce1->CreateProcess ("../../bin/RtEC_Based_CosEC", + "-ORBInitRef NameService=file://$ce1_nsiorfile $CosEC1_params"); + +$CE2 = $ce2->CreateProcess ("../../bin/RtEC_Based_CosEC", + "-ORBInitRef NameService=file://$ce2_nsiorfile $CosEC2_params"); + +$CO1 = $co1->CreateProcess ("Consumer", + "-ORBInitRef NameService=file://$co1_nsiorfile -n cosec1 -c $ev_count"); + +$CO2 = $co2->CreateProcess ("Consumer", + "-ORBInitRef NameService=file://$co2_nsiorfile -n cosec2 -c $ev_count"); + +$SU1 = $su1->CreateProcess ("Supplier", + "-ORBInitRef NameService=file://$su1_nsiorfile -n cosec2 -c $ev_count"); + +$SU2 = $su2->CreateProcess ("Supplier", + "-ORBInitRef NameService=file://$su2_nsiorfile -n cosec1 -c $ev_count"); # first start the Naming service.. -$NS->Spawn (); +$NS_status = $NS->Spawn (); -sleep 10; +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($es->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$es_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($ce1->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$ce1_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($ce2->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$ce2_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($co1->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$co1_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($co2->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$co2_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($su1->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$su1_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($su2->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$su2_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} # now start the Rt EC.. -$EC->Spawn (); +$ES_status = $ES->Spawn (); -sleep 10; +if ($ES_status != 0) { + print STDERR "ERROR: Event Service returned $ES_status\n"; + exit 1; +} +sleep 10; # now start the CosEC1.. -$CE1->Spawn (); +$CE1_status = $CE1->Spawn (); + +if ($CE1_status != 0) { + print STDERR "ERROR: RtEC_Based_CosEC 1 returned $CE1_status\n"; + exit 1; +} sleep 10; # now start the CosEC2.. -$CE2->Spawn (); +$CE2_status = $CE2->Spawn (); + +if ($CE2_status != 0) { + print STDERR "ERROR: RtEC_Based_CosEC 2 returned $CE2_status\n"; + exit 1; +} sleep 10; # start 1 consumer that uses CosEC1 to receive events -$CO1->Spawn (); +$CO1_status = $CO1->Spawn (); + +if ($CO1_status != 0) { + print STDERR "ERROR: Consumer 1 returned $CO1_status\n"; + exit 1; +} sleep 10; # start 1 supplier that uses CosEC2 to send events -$SU1->Spawn (); +$SU1_status = $SU1->Spawn (); + +if ($SU1_status != 0) { + print STDERR "ERROR: Supplier 1 returned $SU1_status\n"; + exit 1; +} sleep 10; # wait for the supplier to finish -$supplier = $SU1->WaitKill (60); +$SU1_status = $SU1->WaitKill ($su1->ProcessStopWaitInterval()+45); -if ($supplier != 0) { - print STDERR "ERROR: supplier returned $supplier\n"; +if ($SU1_status != 0) { + print STDERR "ERROR: Supplier 1 returned $SU1_status\n"; $status = 1; } # wait for the consumer to finish -$consumer = $CO1->WaitKill (60); +$CO1_status = $CO1->WaitKill ($co1->ProcessStopWaitInterval()+45); -if ($consumer != 0) { - print STDERR "ERROR: consumer returned $consumer\n"; +if ($CO1_status != 0) { + print STDERR "ERROR: Consumer 1 returned $CO1_status\n"; $status = 1; } #---------- # start 1 consumer that uses CosEC1 to receive events -$CO2->Spawn (); +$CO2_status = $CO2->Spawn (); + +if ($CO2_status != 0) { + print STDERR "ERROR: Consumer 2 returned $CO2_status\n"; + exit 1; +} sleep 10; # start 1 supplier that uses CosEC2 to send events -$SU2->Spawn (); +$SU2_status = $SU2->Spawn (); + +if ($SU2_status != 0) { + print STDERR "ERROR: Supplier 2 returned $SU2_status\n"; + exit 1; +} sleep 10; # wait for the supplier to finish -$supplier = $SU2->WaitKill (60); +$SU2_status = $SU2->WaitKill ($su2->ProcessStopWaitInterval()+45); -if ($supplier != 0) { - print STDERR "ERROR: supplier returned $supplier\n"; +if ($SU2_status != 0) { + print STDERR "ERROR: Supplier 2 returned $SU2_status\n"; $status = 1; } # wait for the consumer to finish +$CO2_status = $CO2->WaitKill ($co2->ProcessStopWaitInterval()+45); -$consumer = $CO2->WaitKill (60); - -if ($consumer != 0) { - print STDERR "ERROR: consumer returned $consumer\n"; +if ($CO2_status != 0) { + print STDERR "ERROR: Consumer 2 returned $CO2_status\n"; $status = 1; } - #---------- # cleanup.. +$CE2_status = $CE2->TerminateWaitKill ($ce2->ProcessStopWaitInterval()); -$server = $CE2->TerminateWaitKill (5); - -if ($server != 0) { - print STDERR "ERROR: CosEC2 returned $server\n"; +if ($CE2_status != 0) { + print STDERR "ERROR: RtEC_Basic_CosEC 2 returned $CE2_status\n"; $status = 1; } -$CE1->TerminateWaitKill (5); +$CE1_status = $CE1->TerminateWaitKill ($ce1->ProcessStopWaitInterval()); -if ($server != 0) { - print STDERR "ERROR: CosEC1 returned $server\n"; +if ($CE1_status != 0) { + print STDERR "ERROR: RtEC_Basic_CosEC 1 returned $CE1_status\n"; $status = 1; } -$EC->TerminateWaitKill (5); +$ES_status = $ES->TerminateWaitKill ($es->ProcessStopWaitInterval()); -if ($server != 0) { - print STDERR "ERROR: EC returned $server\n"; +if ($ES_status != 0) { + print STDERR "ERROR: Event Service returned $ES_status\n"; $status = 1; } -$NS->TerminateWaitKill (5); +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); -if ($server != 0) { - print STDERR "ERROR: NS returned $server\n"; +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; $status = 1; } -unlink $nsior; +$ns->DeleteFile ($nsiorfile); +$es->DeleteFile ($nsiorfile); +$ce1->DeleteFile ($nsiorfile); +$ce2->DeleteFile ($nsiorfile); +$co1->DeleteFile ($nsiorfile); +$co2->DeleteFile ($nsiorfile); +$su1->DeleteFile ($nsiorfile); +$su2->DeleteFile ($nsiorfile); exit $status; diff --git a/TAO/orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test2.pl b/TAO/orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test2.pl index 98c7a388ae0..2a49b37fb6b 100755 --- a/TAO/orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test2.pl +++ b/TAO/orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test2.pl @@ -6,16 +6,40 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $es = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $ce = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $co = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; +my $su = PerlACE::TestTarget::create_target (7) || die "Create target 7 failed\n"; $con_count = 10; $sup_count = 10; $ev_count = 8; -$status = 0; -$nsior = PerlACE::LocalFile ("ns.ior"); +$nsiorfile = "ns.ior"; -unlink $nsior; +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $es_nsiorfile = $es->LocalFile ($nsiorfile); +my $ce_nsiorfile = $ce->LocalFile ($nsiorfile); +my $co_nsiorfile = $co->LocalFile ($nsiorfile); +my $su_nsiorfile = $su->LocalFile ($nsiorfile); + +$ns->DeleteFile ($nsiorfile); +$es->DeleteFile ($nsiorfile); +$ce->DeleteFile ($nsiorfile); +$co->DeleteFile ($nsiorfile); +$su->DeleteFile ($nsiorfile); # Parse the arguments @@ -38,96 +62,153 @@ for ($i = 0; $i <= $#ARGV; $i++) { } } -$NS = new PerlACE::Process ("../../../../../Naming_Service/Naming_Service", - "-o $nsior"); - -$EC = new PerlACE::Process ("../../../../../Event_Service/Event_Service", - "-t new -ORBInitRef NameService=file://$nsior"); - -$CE1 = new PerlACE::Process ("../../bin/RtEC_Based_CosEC", - "-ORBInitRef NameService=file://$nsior"); +$NS = $ns->CreateProcess ($ENV{"TAO_ROOT"}."/orbsvcs/Naming_Service/Naming_Service", + "-o $ns_nsiorfile"); + +$ES = $es->CreateProcess ($ENV{"TAO_ROOT"}."/orbsvcs/Event_Service/Event_Service", + "-t new -ORBInitRef NameService=file://$es_nsiorfile"); + +$CE = $ce->CreateProcess ("../../bin/RtEC_Based_CosEC", + "-ORBInitRef NameService=file://$ce_nsiorfile"); for ($cntr1 = 0; $cntr1 < $con_count ; ++$cntr1) { - push @CONS, (new PerlACE::Process ("Consumer", "-ORBInitRef NameService=file://$nsior -c $ev_count")); + push @CONS, ($co->CreateProcess ("Consumer", "-ORBInitRef NameService=file://$co_nsiorfile -c $ev_count")); } for ($cntr2 = 0; $cntr2 < $con_count ; ++$cntr2) { - push @SUPS, (new PerlACE::Process ("Supplier", "-ORBInitRef NameService=file://$nsior -c $ev_count")); + push @SUPS, ($su->CreateProcess ("Supplier", "-ORBInitRef NameService=file://$su_nsiorfile -c $ev_count")); } # first start the Naming service.. -$NS->Spawn (); +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($es->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$es_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($ce->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$ce_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($co->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$co_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($su->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$su_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} sleep 10; # now start the Rt EC.. -$EC->Spawn (); +$ES_status = $ES->Spawn (); + +if ($ES_status != 0) { + print STDERR "ERROR: Event Service returned $ES_status\n"; + exit 1; +} sleep 10; # now start the CosEC1.. -$CE1->Spawn (); +$CE_status = $CE->Spawn (); + +if ($CE_status != 0) { + print STDERR "ERROR: RtEC_Based_CosEC returned $CE_status\n"; + exit 1; +} sleep 10; # now start the consumers -foreach $co (@CONS) { +foreach $CO (@CONS) { print "creating consumer# $cntr1\n"; - $co->Spawn (); + $CO_status = $CO->Spawn (); + if ($CO_status != 0) { + print STDERR "ERROR: Consumer $cntr1 returned $CO_status\n"; + exit 1; + } sleep 10; } # now start the suppliers -foreach $su (@SUPS) { +foreach $SU (@SUPS) { print "creating supplier# $cntr2\n"; - $su->Spawn (); + $SU_status = $SU->Spawn (); + if ($SU_status != 0) { + print STDERR "ERROR: Supplier $cntr2 returned $SU_status\n"; + exit 1; + } sleep 10; } print "waiting for the suppliers to finish\n"; -foreach $su (@SUPS) { - $supplier = $su->WaitKill (60); - - if ($supplier != 0) { - print STDERR "ERROR: A supplier returned $supplier\n"; +foreach $SU (@SUPS) { + $SU_status = $SU->WaitKill ($su->ProcessStopWaitInterval()+45); + if ($SU_status != 0) { + print STDERR "ERROR: A Supplier returned $SU_status\n"; $status = 1; } } - print "waiting for the last consumer to finish\n"; -foreach $co (@CONS) { - $consumer = $co->WaitKill (60); - - if ($consumer != 0) { - print STDERR "ERROR: A consumer returned $consumer\n"; +foreach $CO (@CONS) { + $CO_status = $CO->WaitKill ($co->ProcessStopWaitInterval()+45); + + if ($CO_status != 0) { + print STDERR "ERROR: A Consumer returned $CO_status\n"; $status = 1; } } print "cleanup...\n"; -$CE1->TerminateWaitKill (5); +$CE_status = $CE->TerminateWaitKill ($ce->ProcessStopWaitInterval()); -if ($server != 0) { - print STDERR "ERROR: CosEC1 returned $server\n"; +if ($CE_status != 0) { + print STDERR "ERROR: RtEC_Basic_CosEC returned $CE_status\n"; $status = 1; } -$EC->TerminateWaitKill (5); +$ES_status = $ES->TerminateWaitKill ($es->ProcessStopWaitInterval()); -if ($server != 0) { - print STDERR "ERROR: EC returned $server\n"; +if ($ES_status != 0) { + print STDERR "ERROR: Event Service returned $ES_status\n"; $status = 1; } -$NS->TerminateWaitKill (5); +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); -if ($server != 0) { - print STDERR "ERROR: NS returned $server\n"; +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; $status = 1; } print "done!.\n"; -unlink $nsior; +$ns->DeleteFile ($nsiorfile); +$es->DeleteFile ($nsiorfile); +$ce->DeleteFile ($nsiorfile); +$co->DeleteFile ($nsiorfile); +$su->DeleteFile ($nsiorfile); exit $status; diff --git a/TAO/orbsvcs/examples/CosEC/TypedSimple/Consumer.cpp b/TAO/orbsvcs/examples/CosEC/TypedSimple/Consumer.cpp index 3c28e70d596..6477e58705e 100644 --- a/TAO/orbsvcs/examples/CosEC/TypedSimple/Consumer.cpp +++ b/TAO/orbsvcs/examples/CosEC/TypedSimple/Consumer.cpp @@ -4,6 +4,35 @@ #include "orbsvcs/CosTypedEventChannelAdminC.h" #include "Country_i.h" #include "ace/OS_NS_stdio.h" +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT("Consumer.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <ior_output_file> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} ACE_RCSID (CosEC_Examples, Consumer, @@ -19,6 +48,9 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + if (parse_args (argc, argv) != 0) + return 1; + CORBA::Object_var poa_obj = orb->resolve_initial_references ("RootPOA"); PortableServer::POA_var poa = @@ -61,13 +93,12 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) CORBA::String_var str = orb->object_to_string (typed_consumer.in ()); - const ACE_TCHAR* ior_file_name = ACE_TEXT("Consumer.ior"); - FILE *output_file= ACE_OS::fopen (ior_file_name, + FILE *output_file= ACE_OS::fopen (ACE_TEXT_ALWAYS_CHAR(ior_output_file), ACE_TEXT("w")); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s", - ior_file_name), + ior_output_file), 1); ACE_OS::fprintf (output_file, "%s", str.in ()); diff --git a/TAO/orbsvcs/examples/CosEC/TypedSimple/run_test.pl b/TAO/orbsvcs/examples/CosEC/TypedSimple/run_test.pl index 36d52fd5758..3fe92494b75 100755 --- a/TAO/orbsvcs/examples/CosEC/TypedSimple/run_test.pl +++ b/TAO/orbsvcs/examples/CosEC/TypedSimple/run_test.pl @@ -6,113 +6,218 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; +$debug_level = '0'; -$nsiorfile = PerlACE::LocalFile ("ns.ior"); -$ifriorfile = PerlACE::LocalFile ("ifr.ior"); -$eciorfile = PerlACE::LocalFile ("ec.ior"); -$consiorfile = PerlACE::LocalFile ("Consumer.ior"); +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -unlink $nsiorfile; -unlink $ifriorfile; -unlink $eciorfile; -unlink $consiorfile; +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $ces = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $ifr = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $ti = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $sup = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; +my $con = PerlACE::TestTarget::create_target (6) || die "Create target 6 failed\n"; + +$nsiorfile = "ns.ior"; +$ifriorfile = "ifr.ior"; +$cesiorfile = "ec.ior"; +$coniorfile = "Consumer.ior"; +$idl = "Country.idl"; + +my $ifr_ifriorfile = $ifr->LocalFile ($ifriorfile); +my $ti_ifriorfile = $ti->LocalFile ($ifriorfile); +my $ces_ifriorfile = $ces->LocalFile ($ifriorfile); +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $ces_nsiorfile = $ces->LocalFile ($nsiorfile); +my $sup_nsiorfile = $sup->LocalFile ($nsiorfile); +my $con_nsiorfile = $con->LocalFile ($nsiorfile); +my $ces_cesiorfile = $ces->LocalFile ($cesiorfile); +my $con_coniorfile = $con->LocalFile ($coniorfile); +my $ti_idl = $ti->LocalFile ($idl); + +$ifr->DeleteFile ($ifrorfile); +$ti->DeleteFile ($ifriorfile); +$ces->DeleteFile ($ifriorfile); +$ns->DeleteFile ($nsiorfile); +$ces->DeleteFile ($nsiorfile); +$sup->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$ces->DeleteFile ($cesiorfile); +$con->DeleteFile ($coniorfile); + + +$IFR = $ifr->CreateProcess ($ENV{"TAO_ROOT"}."/orbsvcs/IFR_Service/IFR_Service", + " -o $ifr_ifriorfile"); +$TI = $ti->CreateProcess ($ENV{"ACE_ROOT"}."/bin/tao_ifr", + " -ORBInitRef InterfaceRepository=file://$ti_ifriorfile ". + "-I".$ENV{"TAO_ROOT"}."/orbsvcs $ti_idl"); +$NS = $ns->CreateProcess ($ENV{"TAO_ROOT"}."/orbsvcs/Naming_Service/Naming_Service", + "-o $ns_nsiorfile"); +$CES = $ces->CreateProcess ($ENV{"TAO_ROOT"}."/orbsvcs/CosEvent_Service/CosEvent_Service", + "-n CountryEventChannel -r -t -d -o $ces_cesiorfile ". + "-ORBInitRef InterfaceRepository=file://$ces_ifriorfile ". + "-ORBInitRef NameService=file://$ces_nsiorfile "); +$CON = $con->CreateProcess ("Consumer", + "-o $con_coniorfile ". + "-ORBInitRef NameService=file://$con_nsiorfile "); +$SUP = $sup->CreateProcess ("Supplier", + "-ORBInitRef NameService=file://$sup_nsiorfile "); + +$IFR_status = $IFR->Spawn (); + +if ($IFR_status != 0) { + print STDERR "ERROR: IFR_Service returned $IFR_status\n"; + exit 1; +} +if ($ifr->WaitForFileTimed ($ifriorfile,$ifr->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ifr_ifriorfile>\n"; + $IFR->Kill (); $IFR->TimedWait (1); + exit 1; +} + +if ($ifr->GetFile ($ifriorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ifr_ifriorfile>\n"; + $IFR->Kill (); $IFR->TimedWait (1); + exit 1; +} +if ($ti->PutFile ($ifriorfile) == -1) { + print STDERR "ERROR: cannot set file <$ti_ifriorfile>\n"; + $IFR->Kill (); $IFR->TimedWait (1); + exit 1; +} +if ($ces->PutFile ($ifriorfile) == -1) { + print STDERR "ERROR: cannot set file <$ces_ifriorfile>\n"; + $IFR->Kill (); $IFR->TimedWait (1); + exit 1; +} -$IF = new PerlACE::Process ($ENV{"TAO_ROOT"}."/orbsvcs/IFR_Service/IFR_Service", - "-o $ifriorfile"); -$TI = new PerlACE::Process ($ENV{"ACE_ROOT"}."/bin/tao_ifr", - "-ORBInitRef InterfaceRepository=file://$ifriorfile " . - "-I".$ENV{"TAO_ROOT"}."/orbsvcs Country.idl"); -$NS = new PerlACE::Process ($ENV{"TAO_ROOT"}."/orbsvcs/Naming_Service/Naming_Service", - "-o $nsiorfile"); -$CE = new PerlACE::Process ($ENV{"TAO_ROOT"}."/orbsvcs/CosEvent_Service/CosEvent_Service", - "-n CountryEventChannel -r -t -d -o $eciorfile " . - "-ORBInitRef InterfaceRepository=file://$ifriorfile " . - "-ORBInitRef NameService=file://$nsiorfile "); -$C = new PerlACE::Process ("Consumer", "-ORBInitRef NameService=file://$nsiorfile "); -$S = new PerlACE::Process ("Supplier", "-ORBInitRef NameService=file://$nsiorfile "); -$IF->Spawn (); +$TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval()+45); -if (PerlACE::waitforfile_timed ($ifriorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ifriorfile>\n"; - $IF->Kill (); +if ($TI_status != 0) { + print STDERR "ERROR: tao_idl returned $TI_status\n"; + $IFR->Kill (); $IFR->TimedWait (1); exit 1; } -$TI->SpawnWaitKill (60); +$NS_status = $NS->Spawn (); -$NS->Spawn (); +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} -if (PerlACE::waitforfile_timed ($nsiorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$nsiorfile>\n"; - $IF->Kill (); - $NS->Kill (); +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } -$CE->Spawn (); +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($ces->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$ces_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $IFR->Kill (); $IFR->TimedWait (1); + exit 1; +} +if ($sup->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$sup_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $IFR->Kill (); $IFR->TimedWait (1); + exit 1; +} +if ($con->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$con_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $IFR->Kill (); $IFR->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($eciorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$eciorfile>\n"; - $IF->Kill (); - $NS->Kill (); - $CE->Kill (); +$CES_status = $CES->Spawn (); + +if ($CES_status != 0) { + print STDERR "ERROR: CosEvent Service returned $CES_status\n"; + exit 1; +} + +if ($ces->WaitForFileTimed ($cesiorfile,$ces->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ces_cesiorfile>\n"; + $CES->Kill (); $CES->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $IFR->Kill (); $IFR->TimedWait (1); exit 1; } -$C->Spawn (); +$CON_status = $CON->Spawn (); + +if ($CON_status != 0) { + print STDERR "ERROR: Consumer returned $CON_status\n"; + exit 1; +} -if (PerlACE::waitforfile_timed ($consiorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$consiorfile>\n"; - $IF->Kill (); - $NS->Kill (); - $CE->Kill (); - $C->Kill (); +if ($con->WaitForFileTimed ($coniorfile,$con->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$con_coniorfile>\n"; + $CON->Kill (); $CON->TimedWait (1); + $CES->Kill (); $CES->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $IFR->Kill (); $IFR->TimedWait (1); exit 1; } -$supplier = $S->SpawnWaitKill (120); +$SUP_status = $SUP->SpawnWaitKill ($sup->ProcessStartWaitInterval()+105); -if ($supplier != 0) { - print STDERR "ERROR: supplier returned $supplier\n"; +if ($SUP_status != 0) { + print STDERR "ERROR: Supplier returned $SUP_status\n"; $status = 1; } -$server = $C->WaitKill (15); +$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval()); -if ($server != 0) { - print STDERR "ERROR: consumer returned $server\n"; +if ($CON_status != 0) { + print STDERR "ERROR: Consumer returned $CON_status\n"; $status = 1; } -$server = $CE->WaitKill (15); +$CES_status = $CES->TerminateWaitKill ($ces->ProcessStopWaitInterval()); -if ($server != 0) { - print STDERR "ERROR: CosEvent_Service returned $server\n"; +if ($CES_status != 0) { + print STDERR "ERROR: CosEvent Service returned $CES_status\n"; $status = 1; } -$server = $NS->TerminateWaitKill (15); +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); -if ($server != 0) { - print STDERR "ERROR: name service returned $server\n"; +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; $status = 1; } -$server = $IF->TerminateWaitKill (15); +$IFR_status = $IFR->TerminateWaitKill ($ifr->ProcessStopWaitInterval()); -if ($server != 0) { - print STDERR "ERROR: IFR_Service returned $server\n"; +if ($IFR_status != 0) { + print STDERR "ERROR: IFR_Service returned $IFR_status\n"; $status = 1; } -unlink $nsiorfile; -unlink $ifriorfile; -unlink $eciorfile; -unlink $consiorfile; +$ifr->DeleteFile ($ifrorfile); +$ti->DeleteFile ($ifriorfile); +$ces->DeleteFile ($ifriorfile); +$ns->DeleteFile ($nsiorfile); +$ces->DeleteFile ($nsiorfile); +$sup->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$ces->DeleteFile ($cesiorfile); +$con->DeleteFile ($coniorfile); exit $status; diff --git a/TAO/orbsvcs/examples/LoadBalancing/run_test.pl b/TAO/orbsvcs/examples/LoadBalancing/run_test.pl index 1872a919d37..ae728b8f090 100755 --- a/TAO/orbsvcs/examples/LoadBalancing/run_test.pl +++ b/TAO/orbsvcs/examples/LoadBalancing/run_test.pl @@ -6,100 +6,244 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; -$iorfile = PerlACE::LocalFile ("obj.ior"); -unlink $iorfile; +$status = 0; +$debug_level = '0'; -$lm_ior = "lm.ior"; -unlink $lm_ior; -$ns_ior = "ns.ior"; -unlink $ns_ior; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -$status = 0; +my $lm = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $ns = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $sv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $sr = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $cl = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; +my $cr = PerlACE::TestTarget::create_target (6) || die "Create target 6 failed\n"; + +$srviorfile = "obj.ior"; +$lmiorfile = "lm.ior"; +$nsiorfile = "ns.ior"; + +my $lm_lmiorfile = $lm->LocalFile ($lmiorfile); +my $sv_lmiorfile = $sv->LocalFile ($lmiorfile); +my $sr_lmiorfile = $sr->LocalFile ($lmiorfile); +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $sv_nsiorfile = $sv->LocalFile ($nsiorfile); +my $sr_nsiorfile = $sr->LocalFile ($nsiorfile); +my $cl_nsiorfile = $cl->LocalFile ($nsiorfile); +my $cr_nsiorfile = $cr->LocalFile ($nsiorfile); +my $sv_srviorfile = $sv->LocalFile ($srviorfile); +my $cl_srviorfile = $cl->LocalFile ($srviorfile); +my $sr_srviorfile = $sr->LocalFile ($srviorfile); +my $cr_srviorfile = $cr->LocalFile ($srviorfile); +$lm->DeleteFile ($lmiorfile); +$sv->DeleteFile ($lmiorfile); +$sr->DeleteFile ($lmiorfile); +$ns->DeleteFile ($nsiorfile); +$sv->DeleteFile ($nsiorfile); +$sr->DeleteFile ($nsiorfile); +$cl->DeleteFile ($nsiorfile); +$cr->DeleteFile ($nsiorfile); +$sv->DeleteFile ($srviorfile); +$cl->DeleteFile ($srviorfile); +$sr->DeleteFile ($srviorfile); +$cr->DeleteFile ($srviorfile); + +$LM = $lm->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/LoadBalancer/LoadManager", + " -o $lm_lmiorfile"); +$NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service", + " -o $ns_nsiorfile"); +$SV = $sv->CreateProcess ("server", + "-o $sv_srviorfile ". + " -ORBInitRef LoadManager=file://$sv_lmiorfile ". + " -n 1 ". + "-ORBInitRef NameService=file://$sv_nsiorfile ". + " -s LeastLoaded ". + " -r 9000 -c 10300 -d 0.1 "); +$SR = $sr->CreateProcess ("server", + "-o $sr_srviorfile ". + "-ORBInitRef LoadManager=file://$sr_lmiorfile ". + " -n 2 ". + "-ORBInitRef NameService=file://sr_nsiorfile ". + " -s LeastLoaded ". + "-r 9000 -c 10300 -d 0.1 "); +$CL = $cl->CreateProcess ("client", + "-k file://$cl_srviorfile ". + " -i 5 -n 1 ". + "-ORBInitRef NameService=file://cl_nsiorfile "); +$CR = $cr->CreateProcess ("client", + "-k file://$cr_srviorfile ". + "-i 5 -n 2 ". + "-ORBInitRef NameService=file://cr_nsiorfile "); + +$LM_status = $LM->Spawn (); + +if ($LM_status != 0) { + print STDERR "ERROR: Load Manager returned $LM_status\n"; + exit 1; +} -$init_ref = "-ORBInitRef LoadManager=file://lm.ior -n 1 -ORBInitRef NameService=file://ns.ior -s LeastLoaded -r 9000 -c 10300 -d 0.1 "; -$init_ref_backup = "-ORBInitRef LoadManager=file://lm.ior -n 2 -ORBInitRef NameService=file://ns.ior -s LeastLoaded -r 9000 -c 10300 -d 0.1 "; +if ($lm->WaitForFileTimed ($lmiorfile,$lm->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$lm_lmiorfile>\n"; + $LM->Kill (); $LM->TimedWait (1); + exit 1; +} -$init_client_ref = "-k file://$iorfile -i 5 -n 1 -ORBInitRef NameService=file://ns.ior "; -$init_client_ref_backup = "-k file://$iorfile -i 5 -n 2 -ORBInitRef NameService=file://ns.ior "; +if ($lm->GetFile ($lmiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$lm_lmiorfile>\n"; + $LM->Kill (); $LM->TimedWait (1); + exit 1; +} +if ($sv->PutFile ($lmiorfile) == -1) { + print STDERR "ERROR: cannot set file <$sv_lmiorfile>\n"; + $LM->Kill (); $LM->TimedWait (1); + exit 1; +} +if ($sr->PutFile ($lmiorfile) == -1) { + print STDERR "ERROR: cannot set file <$sr_lmiorfile>\n"; + $LM->Kill (); $LM->TimedWait (1); + exit 1; +} -$LM = new PerlACE::Process ("../../LoadBalancer/LoadManager", "-o lm.ior"); -$NS = new PerlACE::Process ("../../Naming_Service/Naming_Service", "-o ns.ior"); -$SV = new PerlACE::Process ("server", $init_ref); -$SR = new PerlACE::Process ("server", $init_ref_backup); -$CL = new PerlACE::Process ("client", $init_client_ref); -$CR = new PerlACE::Process ("client", $init_client_ref_backup); -$LM->Spawn (); +$NS_status = $NS->Spawn (); -if (PerlACE::waitforfile_timed ("lm.ior", $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file LoadManager IOR: lm.ior\n"; - $SV->Kill (); $SV->TimedWait (1); +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; exit 1; } -$NS->Spawn (); +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ("ns.ior", $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file NameService IOR: ns.ior\n"; +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($sv->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$sv_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($sr->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$sr_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($cl->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$cl_nsiorfile>\n"; $NS->Kill (); $NS->TimedWait (1); exit 1; } +if ($cr->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$cr_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + -$SV->Spawn (); +$SV_status = $SV->Spawn (); + +if ($SV_status != 0) { + print STDERR "ERROR: Server returned $SV_status\n"; + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find server file <$iorfile>\n"; +if ($sv->WaitForFileTimed ($srviorfile,$sv->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$sv_srviorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($sv->GetFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$sv_srviorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($cl->PutFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot set file <$cl_srviorfile>\n"; $SV->Kill (); $SV->TimedWait (1); exit 1; } +$sv->DeleteFile ($srviorfile); -$SR->Spawn (); +$SR_status = $SR->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find server file <$iorfile>\n"; - $SR->Kill (); $SR->TimedWait (1); +if ($SR_status != 0) { + print STDERR "ERROR: Server returned $SR_status\n"; exit 1; } -$client = $CL->SpawnWaitKill (100); +if ($sr->WaitForFileTimed ($srviorfile,$sr->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$sr_srviorfile>\n"; + $SR->Kill (); $SR->TimedWait (1); + exit 1; +} -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; +if ($sr->GetFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$sr_srviorfile>\n"; + $SR->Kill (); $SR->TimedWait (1); + exit 1; +} +if ($cr->PutFile ($srviorfile) == -1) { + print STDERR "ERROR: cannot set file <$cr_srviorfile>\n"; + $SR->Kill (); $SR->TimedWait (1); + exit 1; } +$sr->DeleteFile ($srviorfile); -$clientbackup = $CR->SpawnWaitKill (100); -if ($clientbackup != 0) { - print STDERR "ERROR: client returned $client\n"; +$CL_status = $CL->SpawnWaitKill ($cl->ProcessStartWaitInterval()+85); +if ($CL_status != 0) { + print STDERR "ERROR: client returned $CL_status\n"; $status = 1; } -$server = $SV->WaitKill (10); +$CR_status = $CR->SpawnWaitKill ($cr->ProcessStartWaitInterval()+85); +if ($CR_status != 0) { + print STDERR "ERROR: client returned $CR_status\n"; + $status = 1; +} -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$SV_status = $SV->WaitKill ($sv->ProcessStartWaitInterval()); +if ($SV_status != 0) { + print STDERR "ERROR: server returned $SV_status\n"; $status = 1; } -$load_manager = $LM->TerminateWaitKill (10); +$LM_status = $LM->TerminateWaitKill ($lm->ProcessStopWaitInterval()); -if ($load_manager != 0) { - print STDERR "ERROR: LoadManager returned $load_manager\n"; +if ($LM_status != 0) { + print STDERR "ERROR: LoadManager returned $LM_status\n"; $status = 1; } -$name_service = $NS->TerminateWaitKill (10); +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); -if ($name_service != 0) { - print STDERR "ERROR: NameService returned $name_service\n"; +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; $status = 1; } -unlink $iorfile; -unlink $lm_ior; -unlink $ns_ior; +$lm->DeleteFile ($lmiorfile); +$sv->DeleteFile ($lmiorfile); +$sr->DeleteFile ($lmiorfile); +$ns->DeleteFile ($nsiorfile); +$sv->DeleteFile ($nsiorfile); +$sr->DeleteFile ($nsiorfile); +$cl->DeleteFile ($nsiorfile); +$cr->DeleteFile ($nsiorfile); +$sv->DeleteFile ($srviorfile); +$cl->DeleteFile ($srviorfile); +$sr->DeleteFile ($srviorfile); +$cr->DeleteFile ($srviorfile); exit $status; diff --git a/TAO/orbsvcs/examples/Log/Basic/run_test.pl b/TAO/orbsvcs/examples/Log/Basic/run_test.pl index e03afeccb4e..7b49ee1b3d6 100755 --- a/TAO/orbsvcs/examples/Log/Basic/run_test.pl +++ b/TAO/orbsvcs/examples/Log/Basic/run_test.pl @@ -6,32 +6,79 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; +$debug_level = '0'; -$nsior = PerlACE::LocalFile ("ns.ior"); +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $ls = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $cli = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; -unlink $nsior; +$nsiorfile = "ns.ior"; -$NS = new PerlACE::Process ("../../../Naming_Service/Naming_Service", "-o $nsior"); -$LS = new PerlACE::Process ("../../../Logging_Service/Basic_Logging_Service/Basic_Logging_Service", "-ORBInitRef NameService=file://$nsior"); -$CLIENT = new PerlACE::Process ("client", "-ORBInitRef NameService=file://$nsior"); +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $ls_nsiorfile = $ls->LocalFile ($nsiorfile); +my $cli_nsiorfile = $cli->LocalFile ($nsiorfile); +$ns->DeleteFile ($nsiorfile); +$ls->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); +$NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service", + " -o $ns_nsiorfile"); +$LS = $ls->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Logging_Service/Basic_Logging_Service/Basic_Logging_Service", + " -ORBInitRef NameService=file://$ls_nsiorfile"); +$CLI = $cli->CreateProcess ("client", + "-ORBInitRef NameService=file://$cli_nsiorfile"); + print STDERR "Starting Naming Service\n"; -$NS->Spawn (); +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} -if (PerlACE::waitforfile_timed ($nsior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find naming service IOR file\n"; - $NS->Kill (); - exit 1; +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($ls->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$ls_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($cli->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; } print STDERR "Starting Logging Service\n"; -$LS->Spawn (); +$LS_status = $LS->Spawn (); + +if ($LS_status != 0) { + print STDERR "ERROR: LOgging Service returned $LS_status\n"; + $LS->Kill (); $LS->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} # Give time for logging service to initialize and install its object # reference in the nameing service. @@ -39,19 +86,34 @@ sleep (5); print STDERR "Starting client\n"; -$CLIENT->Spawn (); +$CLI_status = $CLI->Spawn (); +if ($CLI_status != 0) { + print STDERR "ERROR: Client returned $CLI_status\n"; + $status = 1; +} -$client = $CLIENT->WaitKill (10); +$CLI_status = $CLI->WaitKill ($cli->ProcessStopWaitInterval()); +if ($CLI_status != 0) { + print STDERR "ERROR: Client returned $CLI_status\n"; + $status = 1; +} + +$LS_status = $LS->TerminateWaitKill ($ls->ProcessStopWaitInterval()); -$NS->Kill (); +if ($LS_status != 0) { + print STDERR "ERROR: Logging Service returned $LS_status\n"; + $status = 1; +} -$LS->Kill (); +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; } -unlink $nsior; +$ns->DeleteFile ($nsiorfile); +$ls->DeleteFile ($nsiorfile); +$cli->DeleteFile ($nsiorfile); exit $status; diff --git a/TAO/orbsvcs/examples/Log/Event/run_test.pl b/TAO/orbsvcs/examples/Log/Event/run_test.pl index 85852eb8cba..ccc55677401 100755 --- a/TAO/orbsvcs/examples/Log/Event/run_test.pl +++ b/TAO/orbsvcs/examples/Log/Event/run_test.pl @@ -6,33 +6,87 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; +$debug_level = '0'; -$nsior = PerlACE::LocalFile ("ns.ior"); - -unlink $nsior; - -$NS = new PerlACE::Process ("../../../Naming_Service/Naming_Service", "-o $nsior"); -$LS = new PerlACE::Process ("../../../Logging_Service/Event_Logging_Service/Event_Logging_Service", "-ORBInitRef NameService=file://$nsior"); -$consumer = new PerlACE::Process ("Event_Consumer", "-ORBInitRef NameService=file://$nsior"); -$supplier = new PerlACE::Process ("Event_Supplier", "-ORBInitRef NameService=file://$nsior"); +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $ls = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $con = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $sup = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; + +$nsiorfile = "ns.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $ls_nsiorfile = $ls->LocalFile ($nsiorfile); +my $con_nsiorfile = $con->LocalFile ($nsiorfile); +my $sup_nsiorfile = $sup->LocalFile ($nsiorfile); +$ns->DeleteFile ($nsiorfile); +$ls->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$sup->DeleteFile ($nsiorfile); + +$NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service", + " -o $ns_nsiorfile"); +$LS = $ls->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Logging_Service/Event_Logging_Service/Event_Logging_Service", + " -ORBInitRef NameService=file://$ls_nsiorfile"); +$CON = $con->CreateProcess ("Event_Consumer", + "-ORBInitRef NameService=file://$con_nsiorfile"); +$SUP = $sup->CreateProcess ("Event_Supplier", + "-ORBInitRef NameService=file://$sup_nsiorfile"); print STDERR "Starting Naming Service\n"; +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} -$NS->Spawn (); +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($nsior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find naming service IOR file\n"; - $NS->Kill (); - exit 1; +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($ls->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$ls_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($con->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$con_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($sup->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$sup_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; } print STDERR "Starting Logging Service\n"; -$LS->Spawn (); +$LS_status = $LS->Spawn (); + +if ($LS_status != 0) { + print STDERR "ERROR: Logging Service returned $LS_status\n"; + $LS->Kill (); $LS->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} # Give time for logging service to initialize and install its object # reference in the naming service. @@ -40,28 +94,56 @@ sleep (5); print STDERR "Starting Consumer\n"; -$consumer->Spawn (); +$CON_status = $CON->Spawn (); +if ($CON_status != 0) { + print STDERR "ERROR: Event Consumer returned $CON_status\n"; + $CON->Kill (); $CON->TimedWait (1); + $LS->Kill (); $LS->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} sleep (1); print STDERR "Starting Supplier\n"; -$supplier->Spawn (); +$SUP_status = $SUP->Spawn (); +if ($SUP_status != 0) { + print STDERR "ERROR: Event Supplier returned $SUP_status\n"; + $status = 1; +} +$SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval()); +if ($SUP_status != 0) { + print STDERR "ERROR: Event Supplier returned $SUP_status\n"; + $status = 1; +} -$supplier->WaitKill (10); +$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval()); -$consumer->Kill (); +if ($CON_status != 0) { + print STDERR "ERROR: Event Consumer returned $CON_status\n"; + $status = 1; +} -$NS->Kill (); +$LS_status = $LS->TerminateWaitKill ($ls->ProcessStopWaitInterval()); -$LS->Kill (); +if ($LS_status != 0) { + print STDERR "ERROR: Logging Service returned $LS_status\n"; + $status = 1; +} + +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} -#if ($client != 0) { -# print STDERR "ERROR: client returned $client\n"; -# $status = 1; -#} -unlink $nsior; +$ns->DeleteFile ($nsiorfile); +$ls->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$sup->DeleteFile ($nsiorfile); exit $status; diff --git a/TAO/orbsvcs/examples/Log/Notify/run_test.pl b/TAO/orbsvcs/examples/Log/Notify/run_test.pl index 0d67a899dab..693467fbb40 100755 --- a/TAO/orbsvcs/examples/Log/Notify/run_test.pl +++ b/TAO/orbsvcs/examples/Log/Notify/run_test.pl @@ -6,33 +6,87 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; +$debug_level = '0'; -$nsior = PerlACE::LocalFile ("ns.ior"); - -unlink $nsior; - -$NS = new PerlACE::Process ("../../../Naming_Service/Naming_Service", "-o $nsior"); -$LS = new PerlACE::Process ("../../../Logging_Service/Notify_Logging_Service/Notify_Logging_Service", "-ORBInitRef NameService=file://$nsior"); -$consumer = new PerlACE::Process ("Notify_Consumer", "-ORBInitRef NameService=file://$nsior"); -$supplier = new PerlACE::Process ("Notify_Supplier", "-ORBInitRef NameService=file://$nsior"); +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $ls = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $con = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $sup = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; + +$nsiorfile = "ns.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $ls_nsiorfile = $ls->LocalFile ($nsiorfile); +my $con_nsiorfile = $con->LocalFile ($nsiorfile); +my $sup_nsiorfile = $sup->LocalFile ($nsiorfile); +$ns->DeleteFile ($nsiorfile); +$ls->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$sup->DeleteFile ($nsiorfile); + +$NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service", + " -o $ns_nsiorfile"); +$LS = $ls->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Logging_Service/Notify_Logging_Service/Notify_Logging_Service", + " -ORBInitRef NameService=file://$ls_nsiorfile"); +$CON = $con->CreateProcess ("Notify_Consumer", + "-ORBInitRef NameService=file://$con_nsiorfile"); +$SUP = $sup->CreateProcess ("Notify_Supplier", + "-ORBInitRef NameService=file://$sup_nsiorfile"); print STDERR "Starting Naming Service\n"; +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} -$NS->Spawn (); +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($nsior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find naming service IOR file\n"; - $NS->Kill (); - exit 1; +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($ls->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$ls_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($con->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$con_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($sup->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$sup_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; } print STDERR "Starting Logging Service\n"; -$LS->Spawn (); +$LS_status = $LS->Spawn (); + +if ($LS_status != 0) { + print STDERR "ERROR: Logging Service returned $LS_status\n"; + $LS->Kill (); $LS->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} # Give time for logging service to initialize and install its object # reference in the naming service. @@ -40,28 +94,56 @@ sleep (5); print STDERR "Starting Consumer\n"; -$consumer->Spawn (); +$CON_status = $CON->Spawn (); +if ($CON_status != 0) { + print STDERR "ERROR: Notify Consumer returned $CON_status\n"; + $CON->Kill (); $CON->TimedWait (1); + $LS->Kill (); $LS->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} sleep (1); print STDERR "Starting Supplier\n"; -$supplier->Spawn (); +$SUP_status = $SUP->Spawn (); +if ($SUP_status != 0) { + print STDERR "ERROR: Notify Supplier returned $SUP_status\n"; + $status = 1; +} +$SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval()); +if ($SUP_status != 0) { + print STDERR "ERROR: Notify Supplier returned $SUP_status\n"; + $status = 1; +} -$supplier->WaitKill (10); +$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval()); -$consumer->Kill (); +if ($CON_status != 0) { + print STDERR "ERROR: Notify Consumer returned $CON_status\n"; + $status = 1; +} -$NS->Kill (); +$LS_status = $LS->TerminateWaitKill ($ls->ProcessStopWaitInterval()); -$LS->Kill (); +if ($LS_status != 0) { + print STDERR "ERROR: Logging Service returned $LS_status\n"; + $status = 1; +} + +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} -#if ($client != 0) { -# print STDERR "ERROR: client returned $client\n"; -# $status = 1; -#} -unlink $nsior; +$ns->DeleteFile ($nsiorfile); +$ls->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$sup->DeleteFile ($nsiorfile); exit $status; diff --git a/TAO/orbsvcs/examples/Log/RTEvent/run_test.pl b/TAO/orbsvcs/examples/Log/RTEvent/run_test.pl index 16ce7e6c81a..10e1252164c 100755 --- a/TAO/orbsvcs/examples/Log/RTEvent/run_test.pl +++ b/TAO/orbsvcs/examples/Log/RTEvent/run_test.pl @@ -6,33 +6,87 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; +$debug_level = '0'; -$nsior = PerlACE::LocalFile ("ns.ior"); - -unlink $nsior; - -$NS = new PerlACE::Process ("../../../Naming_Service/Naming_Service", "-o $nsior"); -$LS = new PerlACE::Process ("../../../Logging_Service/RTEvent_Logging_Service/RTEvent_Logging_Service", "-ORBInitRef NameService=file://$nsior"); -$consumer = new PerlACE::Process ("RTEvent_Consumer", "-ORBInitRef NameService=file://$nsior"); -$supplier = new PerlACE::Process ("RTEvent_Supplier", "-ORBInitRef NameService=file://$nsior"); +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $ls = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $con = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $sup = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; + +$nsiorfile = "ns.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $ls_nsiorfile = $ls->LocalFile ($nsiorfile); +my $con_nsiorfile = $con->LocalFile ($nsiorfile); +my $sup_nsiorfile = $sup->LocalFile ($nsiorfile); +$ns->DeleteFile ($nsiorfile); +$ls->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$sup->DeleteFile ($nsiorfile); + +$NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service", + " -o $ns_nsiorfile"); +$LS = $ls->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Logging_Service/RTEvent_Logging_Service/RTEvent_Logging_Service", + " -ORBInitRef NameService=file://$ls_nsiorfile"); +$CON = $con->CreateProcess ("RTEvent_Consumer", + "-ORBInitRef NameService=file://$con_nsiorfile"); +$SUP = $sup->CreateProcess ("RTEvent_Supplier", + "-ORBInitRef NameService=file://$sup_nsiorfile"); print STDERR "Starting Naming Service\n"; +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} -$NS->Spawn (); +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($nsior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find naming service IOR file\n"; - $NS->Kill (); - exit 1; +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($ls->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$ls_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($con->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$con_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($sup->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$sup_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; } print STDERR "Starting Logging Service\n"; -$LS->Spawn (); +$LS_status = $LS->Spawn (); + +if ($LS_status != 0) { + print STDERR "ERROR: Logging Service returned $LS_status\n"; + $LS->Kill (); $LS->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} # Give time for logging service to initialize and install its object # reference in the naming service. @@ -40,28 +94,56 @@ sleep (5); print STDERR "Starting Consumer\n"; -$consumer->Spawn (); +$CON_status = $CON->Spawn (); +if ($CON_status != 0) { + print STDERR "ERROR: RTEvent Consumer returned $CON_status\n"; + $CON->Kill (); $CON->TimedWait (1); + $LS->Kill (); $LS->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} sleep (1); print STDERR "Starting Supplier\n"; -$supplier->Spawn (); +$SUP_status = $SUP->Spawn (); +if ($SUP_status != 0) { + print STDERR "ERROR: RTEvent Supplier returned $SUP_status\n"; + $status = 1; +} +$SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval()); +if ($SUP_status != 0) { + print STDERR "ERROR: RTEvent Supplier returned $SUP_status\n"; + $status = 1; +} -$supplier->WaitKill (10); +$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval()); -$consumer->Kill (); +if ($CON_status != 0) { + print STDERR "ERROR: RTEvent Consumer returned $CON_status\n"; + $status = 1; +} -$NS->Kill (); +$LS_status = $LS->TerminateWaitKill ($ls->ProcessStopWaitInterval()); -$LS->Kill (); +if ($LS_status != 0) { + print STDERR "ERROR: Logging Service returned $LS_status\n"; + $status = 1; +} + +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} -#if ($client != 0) { -# print STDERR "ERROR: client returned $client\n"; -# $status = 1; -#} -unlink $nsior; +$ns->DeleteFile ($nsiorfile); +$ls->DeleteFile ($nsiorfile); +$con->DeleteFile ($nsiorfile); +$sup->DeleteFile ($nsiorfile); exit $status; diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.cpp index 328fc7fea58..06b8431f84c 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.cpp @@ -13,7 +13,8 @@ IFR_DII_Client::IFR_DII_Client (void) interface_name (CORBA::string_dup ("inventory")), op_name (CORBA::string_dup ("getCDinfo")), lookup_by_name_ (false), - debug_ (false) + debug_ (false), + ior_output_file_(ACE_TEXT("file://iorfile")) { } @@ -27,26 +28,25 @@ IFR_DII_Client::init (int argc, { this->orb_ = CORBA::ORB_init (argc, argv); + if (this->parse_args (argc, argv) == -1) + { + return -1; + } // In a reall application, we would get the scoped or // local name from the Interface Repository and use that // to get the object reference of the target via the Naming // Service. Since we're not testing the Naming Service here, // we just use the IOR which is stored in a file by the server. - this->target_ = this->orb_->string_to_object ("file://iorfile"); + this->target_ = this->orb_->string_to_object (ior_output_file_); if (CORBA::is_nil (this->target_.in ())) { ACE_ERROR_RETURN (( LM_ERROR, - "Unable to find interface repository in: file://iorfile\n"), + "Unable to find interface repository in: %s\n", ior_output_file_), -1); } - if (this->parse_args (argc, argv) == -1) - { - return -1; - } - return 0; } @@ -86,9 +86,9 @@ IFR_DII_Client::run (void) int IFR_DII_Client::parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt opts (argc, argv, ACE_TEXT("dn")); + ACE_Get_Opt opts (argc, argv, ACE_TEXT("k:nd")); int c; - + while ((c = opts ()) != -1) switch (c) { @@ -98,6 +98,10 @@ IFR_DII_Client::parse_args (int argc, ACE_TCHAR *argv[]) case 'n': // Select lookup by name. this->lookup_by_name_ = true; break; + case 'k': + this->ior_output_file_ = opts.opt_arg (); + break; + case '?': default: ACE_ERROR_RETURN ((LM_ERROR, diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.h b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.h index 91a47639adb..05ee08d24c8 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.h +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.h @@ -79,6 +79,8 @@ private: bool debug_; // Display results and debugging info? + + const ACE_TCHAR *ior_output_file_; }; #endif /* IFR_DII_CLIENT_H */ diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl index cb021a458d8..f6cf5572cce 100755 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl @@ -1,112 +1,208 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; +$debug_level = '0'; -$ifr_iorfile= "if_repo.ior"; -$svr_iorfile = "iorfile"; -$test_idl = PerlACE::LocalFile ("test.idl"); +$test_idl = "test.idl"; -$lookup_by_name = ""; -$other = ""; - -for ($i = 0; $i <= $#ARGV; $i++) { - if ($ARGV[$i] eq "-n") { - $lookup_by_name = "-n"; - } - else { - $other .= $ARGV[$i]; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; } } -$TAO_IFR = new PerlACE::Process ("$ENV{ACE_ROOT}/bin/tao_ifr"); - # We want the tao_ifr executable to be found exactly in the path # given, without being modified by the value of -ExeSubDir. # So, we tell its Process object to ignore the setting of -ExeSubDir. -$TAO_IFR->IgnoreExeSubDir (1); +my $server1 = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $server2 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $server3 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $client = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; + +my $ior1file = "if_repo.ior"; +my $ior2file = "iorfile"; + +#Files which used by server1 +my $server1_ior1file = $server1->LocalFile ($ior1file); +$server1->DeleteFile($ior1file); + +#Files which used by server2 +my $server2_ior1file = $server2->LocalFile ($ior1file); +my $server2_ior2file = $server2->LocalFile ($ior2file); +$server2->DeleteFile($ior1file); +$server2->DeleteFile($ior2file); + +#Files which used by server3 +my $server3_ior1file = $server3->LocalFile ($ior1file); +$server3->DeleteFile($ior1file); +my $server3_test_idl = $server3->LocalFile ($test_idl); + +#Files which used by client +my $client_ior1file = $client->LocalFile ($ior1file); +my $client_ior2file = $client->LocalFile ($ior2file); +$client->DeleteFile($ior1file); +$client->DeleteFile($ior2file); + +$SV1 = $server1->CreateProcess ("../../../IFR_Service/IFR_Service", + "-o $server1_ior1file"); + + +$SV2 = $server2->CreateProcess ("server", + "-ORBdebuglevel $debug_level " . + "-ORBInitRef InterfaceRepository=file://$server2_ior1file " . + "-o $server2_ior2file"); + +$SV3 = $server3->CreateProcess ("$ENV{ACE_ROOT}/bin/tao_ifr", + "-ORBInitRef InterfaceRepository=file://$server3_ior1file $server3_test_idl"); -$IFR = new PerlACE::Process ("../../../IFR_Service/IFR_Service", " -o $ifr_iorfile"); -$SV = new PerlACE::Process ("server", "-ORBInitRef InterfaceRepository=file://$ifr_iorfile"); -$CL = new PerlACE::Process ("client", "-ORBInitRef InterfaceRepository=file://$ifr_iorfile" - . " $lookup_by_name"); -$CL2 = new PerlACE::Process ("client", "-ORBInitRef InterfaceRepository=file://$ifr_iorfile -n"); -unlink $ifr_iorfile; -unlink $svr_iorfile; +$CL = $client->CreateProcess ("client", + "-ORBInitRef InterfaceRepository=file://$client_ior1file " . + "-k file://$client_ior2file"); -$IFR->Spawn (); +print STDOUT "Start IFR Service\n"; -if (PerlACE::waitforfile_timed ($ifr_iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ifr_iorfile>\n"; - $IFR->Kill (); +$server_status = $SV1->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server1->WaitForFileTimed ($ior1file, + $server1->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server1_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); exit 1; } -$SV->Spawn (); +if ($server1->GetFile ($ior1file) == -1) { + print STDERR "ERROR: cannot retrieve file <$server1_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($svr_iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$svr_iorfile>\n"; - $IFR->Kill (); - $SV->Kill (); +if ($server2->PutFile ($ior1file) == -1) { + print STDERR "ERROR: cannot set file <$server2_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); exit 1; } -$TAO_IFR->Arguments ("-ORBInitRef InterfaceRepository=file://$ifr_iorfile $test_idl"); +if ($server3->PutFile ($ior1file) == -1) { + print STDERR "ERROR: cannot set file <$server3_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); + exit 1; +} -$tresult = $TAO_IFR->SpawnWaitKill (30); +if ($client->PutFile ($ior1file) == -1) { + print STDERR "ERROR: cannot set file <$client_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); + exit 1; +} -if ($tresult != 0) { - print STDERR "ERROR: tao_ifr (test.idl) returned $tresult\n"; - $status = 1; +sub KillServers{ + $SV1->Kill (); $SV1->TimedWait (1); + $SV2->Kill (); $SV2->TimedWait (1); } -$client = $CL->SpawnWaitKill (60); +print STDOUT "Start server\n"; -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; +$server_status = $SV2->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server2->WaitForFileTimed ($ior2file, + $server2->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server2_ior2file>\n"; + KillServers (); + exit 1; +} + +if ($server2->GetFile ($ior2file) == -1) { + print STDERR "ERROR: cannot retrieve file <$server2_ior2file>\n"; + KillServers (); + exit 1; +} + +if ($client->PutFile ($ior2file) == -1) { + print STDERR "ERROR: cannot set file <$client_ior2file>\n"; + KillServers (); + exit 1; } -$TAO_IFR->Arguments ("-ORBInitRef InterfaceRepository=file://$ifr_iorfile -r $test_idl"); +$SV3->IgnoreExeSubDir (1); + +$server_status = $SV3->SpawnWaitKill ($server3->ProcessStartWaitInterval()); -$tresult = $TAO_IFR->SpawnWaitKill (30); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + KillServers (); + exit 1; +} +print STDOUT "Start client 1\n"; +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45); -if ($tresult != 0) { - print STDERR "ERROR: tao_ifr (-r test.idl) returned $tresult\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } # Do another lookup to check it really has been removed. -$client = $CL2->SpawnWaitKill (60); +$SV3->Arguments ("-ORBInitRef InterfaceRepository=file://$server3_ior1file -r $server3_test_idl"); + +$server_status = $SV3->SpawnWaitKill ($server3->ProcessStartWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + KillServers (); + exit 1; +} -if ($client == 0) { - print STDERR "ERROR: second client run returned $client\n"; - $status = 1; +$CL->Arguments ("-ORBInitRef InterfaceRepository=file://$client_ior1file " . + "-k file://$client_ior2file -n"); + +print STDOUT "Start client 2\n"; + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45); + +if ($client_status == 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; } -$server = $SV->TerminateWaitKill (5); +$server_status = $SV2->TerminateWaitKill ($server2->ProcessStopWaitInterval()); if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -$server = $IFR->TerminateWaitKill (5); + +print STDERR "Stopping IFR\n"; + +$server_status = $SV1->TerminateWaitKill ($server1->ProcessStopWaitInterval()); if ($server != 0) { - print STDERR "ERROR: IFR returned $server\n"; + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $ifr_iorfile; -unlink $svr_iorfile; +$server1->DeleteFile($ior1file); +$server2->DeleteFile($ior1file); +$server2->DeleteFile($ior2file); +$server3->DeleteFile($ior1file); +$client->DeleteFile($ior1file); +$client->DeleteFile($ior2file); exit $status; diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp index 1b10ffa023a..9407a53a1da 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp @@ -4,11 +4,38 @@ #include "test_i.h" #include "ace/OS_NS_stdio.h" #include "orbsvcs/Shutdown_Utilities.h" +#include "ace/Get_Opt.h" ACE_RCSID(Application_Test, server, "$Id$") static const ACE_TCHAR *ior_output_file = ACE_TEXT("iorfile"); +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + class Service_Shutdown_Functor : public Shutdown_Functor { public: @@ -65,6 +92,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + if (parse_args (argc, argv) != 0) + return 1; + Service_Shutdown_Functor killer (orb.in ()); Service_Shutdown kill_contractor (killer); diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Bug_3200_Regression/run_test.pl b/TAO/orbsvcs/tests/InterfaceRepo/Bug_3200_Regression/run_test.pl index e69a89a3611..ba4780cedca 100755 --- a/TAO/orbsvcs/tests/InterfaceRepo/Bug_3200_Regression/run_test.pl +++ b/TAO/orbsvcs/tests/InterfaceRepo/Bug_3200_Regression/run_test.pl @@ -1,20 +1,57 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; +$status = 0; +$debug_level = '0'; + +$nice = ""; $locking = ""; -$iorfile = "if_repo.ior"; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -$status = 0; +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $client2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; + +my $ior1file = "if_repo.ior"; + +#Files which used by server1 +my $server_ior1file = $server->LocalFile ($ior1file); +$server->DeleteFile($ior1file); + +#Files which used by client1 +my $client1_ior1file = $client1->LocalFile ($ior1file); +$client1->DeleteFile($ior1file); + +#Files which used by client2 +my $client2_ior1file = $client2->LocalFile ($ior1file); +$client2->DeleteFile($ior1file); + +$SV = $server->CreateProcess ("../../../IFR_Service/IFR_Service", + "-ORBdebuglevel $debug_level " . + "$nice " . + "-o $server_ior1file " . + "$locking"); + +$CL1 = $client1->CreateProcess ("$ENV{ACE_ROOT}/bin/tao_ifr", + "-ORBdebuglevel $debug_level " . + "-ORBInitRef InterfaceRepository=file://$client1_ior1file b1.idl"); + +$CL2 = $client2->CreateProcess ("$ENV{ACE_ROOT}/bin/tao_ifr", + "-ORBdebuglevel $debug_level " . + "-ORBInitRef InterfaceRepository=file://$client2_ior1file b2.idl"); -$nice = ""; print <<EOF; ********** IMPORTANT NOTE *********** @@ -28,44 +65,61 @@ updated so that it properly detects success/failure of tao_ifr. ****************************************************************** EOF -unlink $iorfile; +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($ior1file, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_ior1file>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -$SV = new PerlACE::Process ("../../../IFR_Service/IFR_Service", " $nice " . " -o $iorfile" . " $locking"); -$CL1 = new PerlACE::Process ("$ENV{ACE_ROOT}/bin/tao_ifr", - "-ORBInitRef InterfaceRepository=file://$iorfile b1.idl"); -$CL2 = new PerlACE::Process ("$ENV{ACE_ROOT}/bin/tao_ifr", - "-ORBInitRef InterfaceRepository=file://$iorfile b2.idl"); +if ($server->GetFile ($ior1file) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_ior1file>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -$SV->Spawn (); +if ($client1->PutFile ($ior1file) == -1) { + print STDERR "ERROR: cannot set file <$client1_ior1file>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($client2->PutFile ($ior1file) == -1) { + print STDERR "ERROR: cannot set file <$client2_ior1file>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -$client1 = $CL1->SpawnWaitKill (60); +$client_status = $CL1->SpawnWaitKill ($client1->ProcessStartWaitInterval() + 45); -if ($client1 != 0) { - print STDERR "ERROR: client returned $client1\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$client2 = $CL2->SpawnWaitKill (60); +$client_status = $CL2->SpawnWaitKill ($client2->ProcessStartWaitInterval() + 45); -if ($client2 != 0) { - print STDERR "ERROR: client returned $client2\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$server = $SV->TerminateWaitKill (5); +$server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval()); -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $iorfile; +$server->DeleteFile($ior1file); +$client1->DeleteFile($ior1file); +$client2->DeleteFile($ior1file); exit $status; - diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Bug_3495_Regression/run_test.pl b/TAO/orbsvcs/tests/InterfaceRepo/Bug_3495_Regression/run_test.pl index 6864b4f6997..5573c301189 100755 --- a/TAO/orbsvcs/tests/InterfaceRepo/Bug_3495_Regression/run_test.pl +++ b/TAO/orbsvcs/tests/InterfaceRepo/Bug_3495_Regression/run_test.pl @@ -6,86 +6,172 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; $debug_level = '0'; +$test_idl = "Test.idl"; + foreach $i (@ARGV) { if ($i eq '-debug') { $debug_level = '10'; } } -$ifr_iorfile = PerlACE::LocalFile ("if_repo.ior"); -$test_idl = PerlACE::LocalFile ("Test.idl"); -$iorfile = PerlACE::LocalFile ("server.ior"); +my $server1 = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $server2 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $server3 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $client = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; + +my $ior1file = "if_repo.ior"; +my $ior2file = "server.ior"; + +#Files which used by server1 +my $server1_ior1file = $server1->LocalFile ($ior1file); +$server1->DeleteFile($ior1file); + +#Files which used by server2 +my $server2_ior1file = $server2->LocalFile ($ior1file); +my $server2_ior2file = $server2->LocalFile ($ior2file); +$server2->DeleteFile($ior1file); +$server2->DeleteFile($ior2file); + +#Files which used by server3 +my $server3_ior1file = $server3->LocalFile ($ior1file); +$server3->DeleteFile($ior1file); + +#Files which used by client +my $client_ior1file = $client->LocalFile ($ior1file); +my $client_ior2file = $client->LocalFile ($ior2file); +$client->DeleteFile($ior1file); +$client->DeleteFile($ior2file); + + +$SV1 = $server1->CreateProcess ("../../../IFR_Service/IFR_Service", + "-ORBdebuglevel $debug_level " . + "-o $server1_ior1file"); + + +$SV2 = $server2->CreateProcess ("server", + "-ORBdebuglevel $debug_level " . + "-ORBInitRef InterfaceRepository=file://$server2_ior1file " . + "-o $server2_ior2file"); + +$SV3 = $server3->CreateProcess ("$ENV{ACE_ROOT}/bin/tao_ifr", + "-ORBdebuglevel $debug_level " . + "-ORBInitRef InterfaceRepository=file://$server3_ior1file $test_idl"); + + +$CL = $client->CreateProcess ("client", + "-ORBInitRef InterfaceRepository=file://$client_ior1file " . + "-k file://$client_ior2file"); + +$server_status = $SV1->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -unlink $ifr_iorfile; -unlink $iorfile; +if ($server1->WaitForFileTimed ($ior1file, + $server1->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server1_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); + exit 1; +} -$TAO_IFR = new PerlACE::Process ("$ENV{ACE_ROOT}/bin/tao_ifr"); -$TAO_IFR->IgnoreExeSubDir (1); +if ($server1->GetFile ($ior1file) == -1) { + print STDERR "ERROR: cannot retrieve file <$server1_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); + exit 1; +} -$IFR = new PerlACE::Process ("../../../IFR_Service/IFR_Service", " -o $ifr_iorfile"); +if ($server2->PutFile ($ior1file) == -1) { + print STDERR "ERROR: cannot set file <$server2_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); + exit 1; +} -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-ORBInitRef InterfaceRepository=file://if_repo.ior -ORBDebuglevel $debug_level -o server.ior"); +if ($server3->PutFile ($ior1file) == -1) { + print STDERR "ERROR: cannot set file <$server3_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); + exit 1; } -else { - $SV = new PerlACE::Process ("server", "-ORBInitRef InterfaceRepository=file://$ifr_iorfile -ORBdebuglevel $debug_level -o $iorfile"); + +if ($client->PutFile ($ior1file) == -1) { + print STDERR "ERROR: cannot set file <$client_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); + exit 1; } -$CL = new PerlACE::Process ("client", "-ORBInitRef InterfaceRepository=file://$ifr_iorfile -k file://$iorfile"); +sub KillServers{ + $SV1->Kill (); $SV1->TimedWait (1); + $SV2->Kill (); $SV2->TimedWait (1); +} -$IFR->Spawn (); +$server_status = $SV2->Spawn (); -if (PerlACE::waitforfile_timed ($ifr_iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ifr_iorfile>\n"; - $IFR->Kill (); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; } -$SV->Spawn (); +if ($server2->WaitForFileTimed ($ior2file, + $server2->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server2_ior2file>\n"; + KillServers (); + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $IFR->Kill (); - $SV->Kill (); +if ($server2->GetFile ($ior2file) == -1) { + print STDERR "ERROR: cannot retrieve file <$server2_ior2file>\n"; + KillServers (); exit 1; } -$TAO_IFR->Arguments ("-ORBInitRef InterfaceRepository=file://$ifr_iorfile $test_idl"); +if ($client->PutFile ($ior2file) == -1) { + print STDERR "ERROR: cannot set file <$client_ior2file>\n"; + KillServers (); + exit 1; +} -$tresult = $TAO_IFR->SpawnWaitKill (30); +$server_status = $SV3->SpawnWaitKill ($server3->ProcessStartWaitInterval()); -if ($tresult != 0) { - print STDERR "ERROR: tao_ifr (test.idl) returned $tresult\n"; - $status = 1; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + KillServers (); + exit 1; } -$client = $CL->SpawnWaitKill (60); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$server = $SV->TerminateWaitKill (10); +print STDERR "Stopping IFR\n"; + +$server_status = $SV2->TerminateWaitKill ($server2->ProcessStopWaitInterval()); if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -$server = $IFR->TerminateWaitKill (5); +$server_status = $SV1->TerminateWaitKill ($server1->ProcessStopWaitInterval()); if ($server != 0) { - print STDERR "ERROR: IFR returned $server\n"; + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $ifr_iorfile; -unlink $iorfile; +$server1->DeleteFile($ior1file); +$server2->DeleteFile($ior1file); +$server2->DeleteFile($ior2file); +$server3->DeleteFile($ior1file); +$client->DeleteFile($ior1file); +$client->DeleteFile($ior2file); exit $status; diff --git a/TAO/orbsvcs/tests/InterfaceRepo/IDL3_Test/run_test.pl b/TAO/orbsvcs/tests/InterfaceRepo/IDL3_Test/run_test.pl index b79148a0024..4f5376f4174 100755 --- a/TAO/orbsvcs/tests/InterfaceRepo/IDL3_Test/run_test.pl +++ b/TAO/orbsvcs/tests/InterfaceRepo/IDL3_Test/run_test.pl @@ -1,79 +1,114 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; -$status = 0; - -$ifr_iorfile= "if_repo.ior"; -$test_idl = PerlACE::LocalFile ("test.idl"); $includes = "-I ../../../.. -I ../../../../orbsvcs"; -for ($i = 0; $i <= $#ARGV; $i++) { - if ($ARGV[$i] eq "-d") { - $debug = "-d"; +$status = 0; +$debug_level = '0'; +$debug_client = ''; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; } - else { - $other .= $ARGV[$i]; + if ($i eq '-d') { + $debug_client = "-n"; } } -if ($^O eq "MSWin32") -{ - $tao_ifr = "$ENV{ACE_ROOT}/bin/tao_ifr"; -} -else -{ - $tao_ifr = "../../../IFR_Service/tao_ifr"; -} +my $server1 = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $server2 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $client = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; + +my $ior1file = "ifr.ior"; + +#Files which used by server1 +my $server1_ior1file = $server1->LocalFile ($ior1file); +$server1->DeleteFile($ior1file); + +#Files which used by server2 +my $server2_ior1file = $server2->LocalFile ($ior1file); +$server2->DeleteFile($ior1file); + +#Files which used by client +my $client_ior1file = $client->LocalFile ($ior1file); +$client->DeleteFile($ior1file); + + +$SV1 = $server1->CreateProcess ("../../../IFR_Service/IFR_Service", + "-ORBdebuglevel $debug_level " . + "-o $server1_ior1file"); -$TAO_IFR = new PerlACE::Process ("$tao_ifr"); -$IFR = new PerlACE::Process ("../../../../orbsvcs/IFR_Service/IFR_Service", " -o $ifr_iorfile"); -$CL = new PerlACE::Process ("IDL3_Test", "-ORBInitRef InterfaceRepository=file://$ifr_iorfile" - . " $debug"); +$SV2 = $server2->CreateProcess ("$ENV{ACE_ROOT}/bin/tao_ifr", + "-ORBdebuglevel $debug_level " . + "-ORBInitRef InterfaceRepository=file://$server1_ior1file $includes test.idl"); -unlink $ifr_iorfile; +$CL = $client->CreateProcess ("IDL3_Test", + "-ORBInitRef InterfaceRepository=file://$client_ior1file " . + "$debug_client"); -$ifspawn = $IFR->Spawn (); -if ($ifspawn != 0) { - print STDERR "ERROR: Can't spawn IFR Service $ifspawn\n"; +$server_status = $SV1->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; } -if (PerlACE::waitforfile_timed ($ifr_iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ifr_iorfile>\n"; - $IFR->Kill (); +if ($server1->WaitForFileTimed ($ior1file, + $server1->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server1_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); exit 1; } -$TAO_IFR->Arguments ("-ORBInitRef InterfaceRepository=file://$ifr_iorfile $includes $test_idl"); +if ($server1->GetFile ($ior1file) == -1) { + print STDERR "ERROR: cannot retrieve file <$server1_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); + exit 1; +} -$tresult = $TAO_IFR->SpawnWaitKill (30); +if ($server2->PutFile ($ior1file) == -1) { + print STDERR "ERROR: cannot set file <$server2_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); + exit 1; +} -if ($tresult != 0) { - print STDERR "ERROR: tao_ifr (test.idl) returned $tresult\n"; - $status = 1; +if ($client->PutFile ($ior1file) == -1) { + print STDERR "ERROR: cannot set file <$client_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); + exit 1; +} + +$server_status = $SV2->SpawnWaitKill ($server2->ProcessStartWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; } -$client = $CL->SpawnWaitKill (60); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$server = $IFR->TerminateWaitKill (15); +$server_status = $SV1->TerminateWaitKill ($server1->ProcessStopWaitInterval()); -if ($server != 0) { - print STDERR "ERROR: IFR returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $ifr_iorfile; +$server1->DeleteFile($ior1file); +$server2->DeleteFile($ior1file); +$client->DeleteFile($ior1file); exit $status; diff --git a/TAO/orbsvcs/tests/Notify/Bug_3646c_Regression/run_test.pl b/TAO/orbsvcs/tests/Notify/Bug_3646c_Regression/run_test.pl index 9f84ed86058..9fe284199bd 100755 --- a/TAO/orbsvcs/tests/Notify/Bug_3646c_Regression/run_test.pl +++ b/TAO/orbsvcs/tests/Notify/Bug_3646c_Regression/run_test.pl @@ -1,62 +1,113 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; PerlACE::add_lib_path ('../lib'); -use strict; +$status = 0; +$debug_level = '0'; -my $status = 0; -my $port = 3000; -my $namingior = PerlACE::LocalFile("naming.ior"); -my $notifyior = PerlACE::LocalFile("notify.ior"); -my $NS = new PerlACE::Process("../../../Naming_Service/Naming_Service", - "-ORBEndpoint iiop://localhost:$port " . - "-o $namingior"); -my $TS = new PerlACE::Process("server", - "-ORBInitRef NameService=iioploc://" . - "localhost:$port/NameService " . - "-IORoutput $notifyior"); -my $STC1 = new PerlACE::Process("Consumer", - "-ORBInitRef NameService=iioploc://" . - "localhost:$port/NameService"); -unlink($notifyior, $namingior); +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server1 = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $server2 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $client = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; + +my $ior1file = "naming.ior"; +my $ior2file = "notify.ior"; + +#Files which used by server1 +my $server1_ior1file = $server1->LocalFile ($ior1file); +$server1->DeleteFile($ior1file); + +#Files which used by server2 +my $server2_ior2file = $server2->LocalFile ($ior2file); +$server2->DeleteFile($ior2file); +my $server2_ior1file = $server2->LocalFile ($ior1file); +$server2->DeleteFile($ior1file); + +$hostname = $server1->HostName (); +$port = $server1->RandomPort (); + + +$SV1 = $server1->CreateProcess ("../../../Naming_Service/Naming_Service", + "-ORBdebuglevel $debug_level " . + "-ORBEndpoint iiop://$hostname:$port " . + "-o $server1_ior1file"); + +$SV2 = $server2->CreateProcess ("server", + "-h $hostname " . + "-p $port " . + "-o $server2_ior2file"); + +$CL = $client->CreateProcess ("Consumer", + "-ORBdebuglevel $debug_level " . + "-ORBInitRef NameService=iioploc://$hostname:$port/NameService"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed($namingior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: waiting for the naming service to start\n"; - $NS->Kill(); - exit(1); +$server_status = $SV1->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + + +if ($server1->WaitForFileTimed ($ior1file, + $server1->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server1_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); + exit 1; +} + +if ($server1->GetFile ($ior1file) == -1) { + print STDERR "ERROR: cannot retrieve file <$server1_ior1file>\n"; + $SV1->Kill (); $SV1->TimedWait (1); + exit 1; } -$TS->Spawn(); -if (PerlACE::waitforfile_timed($notifyior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: waiting for the notify service to start\n"; - $TS->Kill(); - $NS->Kill(); - exit(1); +if ($server2->PutFile ($ior1file) == -1) { + print STDERR "ERROR: cannot set file <$server2_ior1file>\n"; + $SV2->Kill (); $SV2->TimedWait (1); + exit 1; } -$STC1->Spawn(); +$server_status = $SV2->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server2->WaitForFileTimed ($ior2file, + $server2->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server2_ior2file>\n"; + $SV2->Kill (); $SV2->TimedWait (1); + exit 1; +} -sleep(2); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); -my $client = $STC1->WaitKill(5); -if ($client != 0) { - $status = 1; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; } -$TS->Kill(); -$NS->Kill(); +$SV1->Kill (); +$SV2->Kill (); -unlink($notifyior, $namingior); +$server1->DeleteFile($ior1file); +$server2->DeleteFile($ior2file); -exit($status); +exit $status; diff --git a/TAO/orbsvcs/tests/Notify/Bug_3646c_Regression/server.cpp b/TAO/orbsvcs/tests/Notify/Bug_3646c_Regression/server.cpp index f259b97eac9..14f05c84232 100644 --- a/TAO/orbsvcs/tests/Notify/Bug_3646c_Regression/server.cpp +++ b/TAO/orbsvcs/tests/Notify/Bug_3646c_Regression/server.cpp @@ -4,29 +4,89 @@ #include "orbsvcs/Notify_Service/Notify_Service.h" #include "orbsvcs/CosNotifyChannelAdminC.h" #include "orbsvcs/CosNamingC.h" +#include "ace/Get_Opt.h" #include "DllORB.h" char const * const scpc_orbId = "testDllOrb"; -ACE_TCHAR const * const scpc_loadOrb = ACE_DYNAMIC_SERVICE_DIRECTIVE( +const int max_length = 1000; + +ACE_TCHAR scpc_loadOrb[max_length] = ACE_DYNAMIC_SERVICE_DIRECTIVE( "testDllOrb", "bug3646c", "_make_DllORB", - "testDllOrb -ORBDebugLevel 0 -ORBId testDllOrb -ORBDottedDecimalAddresses 1 -ORBInitRef NameService=iioploc://localhost:3000/NameService" + "testDllOrb -ORBDebugLevel 0 -ORBId testDllOrb -ORBDottedDecimalAddresses 1 -ORBInitRef NameService=iioploc://%s:%s/NameService" ); ACE_TCHAR const * const scpc_unloadOrb = ACE_REMOVE_SERVICE_DIRECTIVE("testDllOrb"); -ACE_TCHAR const * const scpc_loadNotifyService = ACE_DYNAMIC_SERVICE_DIRECTIVE( +ACE_TCHAR scpc_loadNotifyService[max_length] = ACE_DYNAMIC_SERVICE_DIRECTIVE( "testNotifyService", "TAO_Notify_Service", "_make_TAO_Notify_Service_Driver", - "-Channel -ChannelName Channel1 -ChannelName Channel2 -RunThreads 0 -ORBInitRef NameService=iioploc://localhost:3000/NameService -IORoutput notify.ior" + "-Channel -ChannelName Channel1 -ChannelName Channel2 -RunThreads 0 -ORBInitRef NameService=iioploc://%s:%s/NameService -IORoutput %s" ); ACE_TCHAR const * const scpc_unloadNotifyService = ACE_REMOVE_SERVICE_DIRECTIVE("testNotifyService"); +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("h:p:o:")); + int c; + + ACE_TCHAR *hostname = 0; + ACE_TCHAR *port = 0; + ACE_TCHAR *ior_file = 0; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'h': + hostname = get_opts.opt_arg (); + break; + case 'p': + port = get_opts.opt_arg (); + break; + case 'o': + ior_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-h <hostname> " + "-p <port> " + "-o <ior> " + "\n", + argv [0]),-1); + } +// Indicates successful parsing of the command line +if ( hostname == 0 || port == 0 || ior_file == 0){ + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-h <hostname> " + "-p <port> " + "-o <ior> " + "\n", + argv [0]),-1); +} + +ACE_TCHAR str[max_length]; + +ACE_OS::strcpy(str, scpc_loadNotifyService); +ACE_OS::sprintf(scpc_loadNotifyService, str, hostname, port, ior_file); + +ACE_OS::strcpy(str, scpc_loadOrb); +ACE_OS::sprintf(scpc_loadOrb, str, hostname, port); + +return 0; +} + + + void loadunloadcycle() { int result = 0; @@ -36,7 +96,7 @@ void loadunloadcycle() ACE_TEXT ("(%P|%t) loadunloadcycle - loading\n") )); - result = ACE_Service_Config::process_directive(scpc_loadOrb); + result = ACE_Service_Config::process_directive(ACE_TEXT_ALWAYS_CHAR(scpc_loadOrb)); ACE_DEBUG(( LM_DEBUG, ACE_TEXT ("(%P|%t) loadunloadcycle - loading ORB done\n") @@ -65,7 +125,7 @@ void loadunloadcycle() ACE_TEXT ("(%P|%t) loadunloadcycle - v_rootPOA OK\n") )); - result = ACE_Service_Config::process_directive(scpc_loadNotifyService); + result = ACE_Service_Config::process_directive(ACE_TEXT_ALWAYS_CHAR(scpc_loadNotifyService)); ACE_DEBUG(( LM_DEBUG, ACE_TEXT ("(%P|%t) loadunloadcycle - loading NotifyService done\n") @@ -101,12 +161,16 @@ void loadunloadcycle() ACE_TEXT ("(%P|%t) loadunloadcycle - unloading ORB done\n") )); } -int ACE_TMAIN (int , ACE_TCHAR **) + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_DEBUG(( LM_DEBUG, ACE_TEXT ("(%P|%t) main - entered\n") )); + + if (parse_args (argc, argv) != 0) + return 1; for (int cnt = 0, max = 2; cnt < max; ++cnt) { diff --git a/TAO/performance-tests/Latency/Single_Threaded/default_configuration.pl b/TAO/performance-tests/Latency/Single_Threaded/default_configuration.pl index 4456b3e6d79..d86844ea406 100755 --- a/TAO/performance-tests/Latency/Single_Threaded/default_configuration.pl +++ b/TAO/performance-tests/Latency/Single_Threaded/default_configuration.pl @@ -1,51 +1,82 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); -$defaultconf = PerlACE::LocalFile ("default$PerlACE::svcconf_ext"); +$debug_level = '0'; -print STDERR "================ Single-threaded (default) Latency Test\n"; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -unlink $iorfile; +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; -$SV = new PerlACE::Process ("server", - "-ORBSvcConf $defaultconf" - . " -o $iorfile"); +my $iterations = 25000; +my $server_defaultconf = $server->LocalFile ("default$PerlACE::svcconf_ext"); +my $client_defaultconf = $client->LocalFile ("default$PerlACE::svcconf_ext"); +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); -$CL = new PerlACE::Process ("client", - "-ORBSvcConf $defaultconf" - . " -k file://$iorfile" - . " -i 250000"); +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level ". + "-ORBSvcConf $server_defaultconf -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-ORBSvcConf $client_defaultconf ". + "-k file://$client_iorfile -i $iterations"); + +print STDERR "================ Single-threaded (default) Latency Test\n"; + +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -$SV->Spawn (); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -$client = $CL->SpawnWaitKill (60); -$server = $SV->WaitKill (10); +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $iorfile; +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + exit $status; diff --git a/TAO/performance-tests/Latency/Single_Threaded/run_test.pl b/TAO/performance-tests/Latency/Single_Threaded/run_test.pl index 051c3195bed..1dc38cac83d 100755 --- a/TAO/performance-tests/Latency/Single_Threaded/run_test.pl +++ b/TAO/performance-tests/Latency/Single_Threaded/run_test.pl @@ -1,67 +1,94 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + $iteration = 250000; for ($iter = 0; $iter <= $#ARGV; $iter++) { if ($ARGV[$iter] eq "-h" || $ARGV[$iter] eq "-?") { - print "Run_Test Perl script for Single-threaded Latency test\n\n"; - print "run_test [-n num] [-h] \n"; - print "\n"; - print "-n num -- runs the client num times\n"; - print "-h -- prints this information\n"; - exit 0; - } - elsif ($ARGV[$iter] eq "-n") { - $iteration = $ARGV[$iter + 1]; - $i++; - } - + print "Run_Test Perl script for Single-threaded Latency test\n\n"; + print "run_test [-n num] [-h] \n"; + print "\n"; + print "-n num -- runs the client num times\n"; + print "-h -- prints this information\n"; + exit 0; + } + elsif ($ARGV[$iter] eq "-n") { + $iteration = $ARGV[$iter + 1]; + $i++; + } } print STDERR "================ Single-threaded Latency Test\n"; -unlink $iorfile; +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -i $iteration"); -$SV = new PerlACE::Process ("server", - "-o $iorfile"); +$server_status = $SV->Spawn (); -$CL = new PerlACE::Process ("client", - "-k file://$iorfile " - . " -i $iteration"); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -$SV->Spawn (); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -$client = $CL->SpawnWaitKill (120); -$server = $SV->WaitKill (10); +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $iorfile; +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 105); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + exit $status; diff --git a/TAO/performance-tests/Latency/Thread_Per_Connection/run_test.pl b/TAO/performance-tests/Latency/Thread_Per_Connection/run_test.pl index b6325a03ade..4ce8e018317 100755 --- a/TAO/performance-tests/Latency/Thread_Per_Connection/run_test.pl +++ b/TAO/performance-tests/Latency/Thread_Per_Connection/run_test.pl @@ -1,66 +1,95 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); -$iteration = 250000; -unlink $iorfile; +$debug_level = '0'; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} +my $iterations = 250000; for ($iter = 0; $iter <= $#ARGV; $iter++) { if ($ARGV[$iter] eq "-h" || $ARGV[$iter] eq "-?") { - print "Run_Test Perl script for Thread-per-Connection Latency test\n\n"; - print "run_test [-n num] [-h] \n"; - print "\n"; - print "-n num -- runs the client num times\n"; - print "-h -- prints this information\n"; - exit 0; - } - elsif ($ARGV[$iter] eq "-n") { - $iteration = $ARGV[$iter + 1]; - $i++; - } + print "Run_Test Perl script for Thread-per-Connection Latency test\n\n"; + print "run_test [-n num] [-h] \n"; + print "\n"; + print "-n num -- runs the client num times\n"; + print "-h -- prints this information\n"; + exit 0; + } + elsif ($ARGV[$iter] eq "-n") { + $iterations = $ARGV[$iter + 1]; + $i++; + } } +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -i $iterations"); + print STDERR "================ Thread-per-Connection Latency Test\n"; -$SV = new PerlACE::Process ("server", - "-o $iorfile"); +$server_status = $SV->Spawn (); -$CL = new PerlACE::Process ("client", - "-k file://$iorfile " - . " -i $iteration"); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -$SV->Spawn (); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -$client = $CL->SpawnWaitKill (120); -$server = $SV->WaitKill (20); +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $iorfile; +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 105); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + exit $status; diff --git a/TAO/performance-tests/Latency/Thread_Pool/run_test.pl b/TAO/performance-tests/Latency/Thread_Pool/run_test.pl index 598d5a55c17..8d55e53ad06 100755 --- a/TAO/performance-tests/Latency/Thread_Pool/run_test.pl +++ b/TAO/performance-tests/Latency/Thread_Pool/run_test.pl @@ -1,66 +1,94 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); +$debug_level = '0'; -$iteration = 150000; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $iterations = 150000; for ($iter = 0; $iter <= $#ARGV; $iter++) { if ($ARGV[$iter] eq "-h" || $ARGV[$iter] eq "-?") { - print "Run_Test Perl script for Thread pool Latency test\n\n"; - print "run_test [-n num] [-h] \n"; - print "\n"; - print "-n num -- runs the client num times\n"; - print "-h -- prints this information\n"; - exit 0; - } - elsif ($ARGV[$iter] eq "-n") { - $iteration = $ARGV[$iter + 1]; - $i++; - } - + print "Run_Test Perl script for Thread pool Latency test\n\n"; + print "run_test [-n num] [-h] \n"; + print "\n"; + print "-n num -- runs the client num times\n"; + print "-h -- prints this information\n"; + exit 0; + } + elsif ($ARGV[$iter] eq "-n") { + $iterations = $ARGV[$iter + 1]; + $i++; + } } -print STDERR "================ Thread Pool Latency Test\n"; +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; -unlink $iorfile; +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); -$SV = new PerlACE::Process ("server", - "-o $iorfile"); +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -i $iterations"); -$CL = new PerlACE::Process ("client", - "-k file://$iorfile " - . " -i $iteration"); +print STDERR "================ Thread Pool Latency Test\n"; + +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -$SV->Spawn (); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -$client = $CL->SpawnWaitKill (480); -$server = $SV->WaitKill (10); +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $iorfile; +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 465); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + exit $status; diff --git a/TAO/performance-tests/RTCorba/Oneways/Reliable/client_test.pl b/TAO/performance-tests/RTCorba/Oneways/Reliable/client_test.pl index 270aa7b8621..c82766dbfcc 100755 --- a/TAO/performance-tests/RTCorba/Oneways/Reliable/client_test.pl +++ b/TAO/performance-tests/RTCorba/Oneways/Reliable/client_test.pl @@ -1,14 +1,22 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -$iorfile = PerlACE::LocalFile ("test.ior"); $iterations = 4000; $bufsize = 4000; $work = 10; @@ -58,17 +66,23 @@ for ($i = 0; $i <= $#ARGV; $i++) { } } -$CL = new PerlACE::Process ("client"); +my $client = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + +my $iorbase = "test.ior"; +my $client_iorfile = $client->LocalFile ($iorbase); +$client->DeleteFile($iorbase); + +$CL = $client->CreateProcess ("client", ""); if ($all == 1) { foreach $bufsize (@bufsizes) { print STDERR "\n***************** STARTING TEST ******************\n"; - $CL->Arguments ("-ORBNodelay 0 -t none -i $iterations -m $bufsize"); + $CL->Arguments ("-k file://$client_iorfile -ORBNodelay 0 -t none ". + "-i $iterations -m $bufsize"); - my $client = $CL->SpawnWaitKill (60); - - if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; + my $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45); + if ($client_status != 0) { + print STDERR "ERROR: client SpawWaiKill returned $client_status\n"; $status = 1; } } @@ -88,16 +102,16 @@ foreach $type (@types) { print STDERR "\n***************** STARTING TEST ******************\n"; - $CL->Arguments ("$transport -t $type -i $iterations -m $bufsize -w $work $shutdown"); + $CL->Arguments ("-k file://$client_iorfile $transport -t $type -i $iterations ". + "-m $bufsize -w $work $shutdown"); - my $client = $CL->SpawnWaitKill (60); - - if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; + my $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45); + if ($client_status != 0) { + print STDERR "ERROR: client SpawWaiKill returned $client_status\n"; $status = 1; } } -unlink $iorfile; +$client->DeleteFile($iorbase); exit $status; diff --git a/TAO/performance-tests/RTCorba/Oneways/Reliable/run_test.pl b/TAO/performance-tests/RTCorba/Oneways/Reliable/run_test.pl index c426bd27ad4..2f5effbe44e 100755 --- a/TAO/performance-tests/RTCorba/Oneways/Reliable/run_test.pl +++ b/TAO/performance-tests/RTCorba/Oneways/Reliable/run_test.pl @@ -1,12 +1,21 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} $iterations = 4000; $bufsize = 4000; @@ -17,11 +26,6 @@ $shutdown = ""; $all = 1; $other = ""; -$status = 0; - -$iorfile = PerlACE::LocalFile ("test.ior"); -unlink $iorfile; - # Parse the arguments @types = ("none", "transport", "server", "target", "twoway -x"); @@ -69,31 +73,58 @@ for ($i = 0; $i <= $#ARGV; $i++) { } ############################################################################### +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); -unlink $iorfile; +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", ""); -$SV = new PerlACE::Process ("server"); -$CL = new PerlACE::Process ("client"); +$server_status = $SV->Spawn (); -$SV->Spawn (); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +# -*- perl -*- ############################################################################### if ($all == 1) { foreach $bufsize (@bufsizes) { print STDERR "\n***************** STARTING TEST ******************\n"; - $CL->Arguments ("-ORBNodelay 0 -l $level -t none -i $iterations -m $bufsize"); + $CL->Arguments ("-k file://$client_iorfile -ORBNodelay 0 -l $level ". + "-t none -i $iterations -m $bufsize"); + + my $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45); - my $client = $CL->SpawnWaitKill (60); - if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; + if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } } @@ -116,23 +147,27 @@ foreach $type (@types) { $shutdown = "-x"; } - $CL->Arguments (" $transport -t $type -i $iterations -l $level -m $bufsize -w $work $shutdown "); + $CL->Arguments ("-k file://$client_iorfile $transport -t $type -i $iterations ". + "-l $level -m $bufsize -w $work $shutdown "); - my $client = $CL->SpawnWaitKill (60); - if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; + my $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45); + + if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } } ############################################################################### -$server = $SV->WaitKill (5); -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $iorfile; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); exit $status; diff --git a/TAO/performance-tests/RTCorba/Oneways/Reliable/server.cpp b/TAO/performance-tests/RTCorba/Oneways/Reliable/server.cpp index ddf0e5e128b..fd57e2baefb 100644 --- a/TAO/performance-tests/RTCorba/Oneways/Reliable/server.cpp +++ b/TAO/performance-tests/RTCorba/Oneways/Reliable/server.cpp @@ -14,13 +14,13 @@ static const ACE_TCHAR *ior_output_file = ACE_TEXT("test.ior"); static int parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("f:")); + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); int c; while ((c = get_opts ()) != -1) switch (c) { - case 'f': + case 'o': ior_output_file = get_opts.opt_arg (); break; @@ -28,7 +28,7 @@ parse_args (int argc, ACE_TCHAR *argv[]) default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s " - "-f <ior file> " + "-o <ior file> " "\n", argv [0]), -1); diff --git a/TAO/performance-tests/Sequence_Latency/AMH_Single_Threaded/run_test.pl b/TAO/performance-tests/Sequence_Latency/AMH_Single_Threaded/run_test.pl index 6d9a99b0cad..5a672bbd8fa 100755 --- a/TAO/performance-tests/Sequence_Latency/AMH_Single_Threaded/run_test.pl +++ b/TAO/performance-tests/Sequence_Latency/AMH_Single_Threaded/run_test.pl @@ -1,19 +1,23 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); +$debug_level = '0'; -print STDERR "=============== AMH Single-threaded Latency Test\n"; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -unlink $iorfile; +print STDERR "=============== AMH Single-threaded Latency Test\n"; my $type = 'octet'; @@ -31,36 +35,62 @@ for ($i = 0; $i <= $#ARGV; $i++) { } } -$SV = new PerlACE::Process ("server", - "-o $iorfile"); +my $iterations = 50000; -$CL = new PerlACE::Process ("client", - "-t $type -k file://$iorfile " - . " -i 50000"); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -t $type -i $iterations"); print STDERR $CL->CommandLine () ; -$SV->Spawn (); +$server_status = $SV->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; } -$client = $CL->SpawnWaitKill (420); -$server = $SV->WaitKill (40); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $iorfile; +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 405); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 30); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + exit $status; diff --git a/TAO/performance-tests/Sequence_Latency/AMI/run_test.pl b/TAO/performance-tests/Sequence_Latency/AMI/run_test.pl index fdbcb7f9adc..64e99064ce8 100755 --- a/TAO/performance-tests/Sequence_Latency/AMI/run_test.pl +++ b/TAO/performance-tests/Sequence_Latency/AMI/run_test.pl @@ -1,20 +1,23 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); +$debug_level = '0'; -print STDERR "================ Thread AMI Latency Test\n"; - -unlink $iorfile; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} +print STDERR "================ Thread AMI Latency Test\n"; my $type = 'octet'; @@ -32,35 +35,62 @@ for ($i = 0; $i <= $#ARGV; $i++) { } } -$SV = new PerlACE::Process ("server", - "-o $iorfile"); +my $iterations = 150000; -$CL = new PerlACE::Process ("client", - "-t $type -k file://$iorfile " - . " -i 150000"); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -t $type -i $iterations"); print STDERR $CL->CommandLine () ; -$SV->Spawn (); +$server_status = $SV->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; } -$client = $CL->SpawnWaitKill (420); -$server = $SV->WaitKill (20); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $iorfile; +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 405); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 10); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + exit $status; diff --git a/TAO/performance-tests/Sequence_Latency/DII/run_test.pl b/TAO/performance-tests/Sequence_Latency/DII/run_test.pl index f21d6a5baff..7ee47f76cc4 100755 --- a/TAO/performance-tests/Sequence_Latency/DII/run_test.pl +++ b/TAO/performance-tests/Sequence_Latency/DII/run_test.pl @@ -1,19 +1,23 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); +$debug_level = '0'; -print STDERR "================ DII Latency Test\n"; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -unlink $iorfile; +print STDERR "================ DII Latency Test\n"; my $type = 'octet'; @@ -31,36 +35,62 @@ for ($i = 0; $i <= $#ARGV; $i++) { } } -$SV = new PerlACE::Process ("server", - "-o $iorfile"); +my $iterations = 150000; -$CL = new PerlACE::Process ("client", - "-t $type -k file://$iorfile " - . " -i 150000"); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -t $type -i $iterations"); print STDERR $CL->CommandLine () ; -$SV->Spawn (); +$server_status = $SV->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; } -$client = $CL->SpawnWaitKill (420); -$server = $SV->WaitKill (40); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $iorfile; +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 405); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 30); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + exit $status; diff --git a/TAO/performance-tests/Sequence_Latency/DSI/run_test.pl b/TAO/performance-tests/Sequence_Latency/DSI/run_test.pl index 4e8086261db..55894d8e866 100755 --- a/TAO/performance-tests/Sequence_Latency/DSI/run_test.pl +++ b/TAO/performance-tests/Sequence_Latency/DSI/run_test.pl @@ -1,21 +1,24 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); +$debug_level = '0'; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} print STDERR "================ DSI Latency Test\n"; -unlink $iorfile; - my $type = 'octet'; for ($i = 0; $i <= $#ARGV; $i++) { @@ -32,36 +35,62 @@ for ($i = 0; $i <= $#ARGV; $i++) { } } -$SV = new PerlACE::Process ("server", - "-o $iorfile"); +my $iterations = 50000; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; -$CL = new PerlACE::Process ("client", - "-t $type -k file://$iorfile " - . " -i 50000"); +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -t $type -i $iterations"); print STDERR $CL->CommandLine () ; -$SV->Spawn (); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -$client = $CL->SpawnWaitKill (420); -$server = $SV->WaitKill (40); +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $iorfile; +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 405); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 30); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + exit $status; diff --git a/TAO/performance-tests/Sequence_Latency/Deferred/run_test.pl b/TAO/performance-tests/Sequence_Latency/Deferred/run_test.pl index c4ffd7001ec..c89254efba1 100755 --- a/TAO/performance-tests/Sequence_Latency/Deferred/run_test.pl +++ b/TAO/performance-tests/Sequence_Latency/Deferred/run_test.pl @@ -1,19 +1,23 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); +$debug_level = '0'; -print STDERR "================ Deferred Synchronous Latency Test\n"; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -unlink $iorfile; +print STDERR "================ Deferred Synchronous Latency Test\n"; my $type = 'octet'; @@ -31,37 +35,62 @@ for ($i = 0; $i <= $#ARGV; $i++) { } } -$SV = new PerlACE::Process ("server", - "-o $iorfile"); +my $iterations = 50000; -$CL = new PerlACE::Process ("client", - "-t $type -k file://$iorfile " - . " -i 50000"); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -t $type -i $iterations"); print STDERR $CL->CommandLine () ; -$SV->Spawn (); +$server_status = $SV->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; } -$client = $CL->SpawnWaitKill (420); -$server = $SV->WaitKill (40); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $iorfile; +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 405); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 30); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + exit $status; diff --git a/TAO/performance-tests/Sequence_Latency/Single_Threaded/default_configuration.pl b/TAO/performance-tests/Sequence_Latency/Single_Threaded/default_configuration.pl index 38411a23f88..0dde4c2ca48 100755 --- a/TAO/performance-tests/Sequence_Latency/Single_Threaded/default_configuration.pl +++ b/TAO/performance-tests/Sequence_Latency/Single_Threaded/default_configuration.pl @@ -1,67 +1,101 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); -$defaultconf = PerlACE::LocalFile ("default$PerlACE::svcconf_ext"); +$debug_level = '0'; -print STDERR "================ Single-threaded (default) Latency Test\n"; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -unlink $iorfile; +print STDERR "================ Single-threaded (default) Latency Test\n"; my $type = 'octet'; for ($i = 0; $i <= $#ARGV; $i++) { if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") { - print "Run_Test Perl script for Performance Test\n\n"; - print "run_test [-t type] \n"; - print "\n"; - print "-t type -- runs only one type of param test\n"; - exit 0; + print "Run_Test Perl script for Performance Test\n\n"; + print "run_test [-t type] \n"; + print "\n"; + print "-t type -- runs only one type of param test\n"; + exit 0; } elsif ($ARGV[$i] eq "-t") { - $type = $ARGV[$i + 1]; - $i++; + $type = $ARGV[$i + 1]; + $i++; } } -$SV = new PerlACE::Process ("server", - "-ORBSvcConf $defaultconf" - . " -o $iorfile"); +my $iterations = 150000; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; +my $defaultconf = "default$PerlACE::svcconf_ext"; +my $server_defaultconf = $server->LocalFile ($defaultconf); +my $client_defaultconf = $client->LocalFile ($defaultconf); +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile ". + "-ORBSvcConf $server_defaultconf"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -t $type -i $iterations ". + "-ORBSvcConf $client_defaultconf"); + +print STDERR $CL->CommandLine () ; +$server_status = $SV->Spawn (); -$CL = new PerlACE::Process ("client", - "-ORBSvcConf $defaultconf" - . " -t $type -k file://$iorfile" - . " -i 150000"); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -$SV->Spawn (); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -$client = $CL->SpawnWaitKill (60); -$server = $SV->WaitKill (10); +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $iorfile; +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + exit $status; diff --git a/TAO/performance-tests/Sequence_Latency/Single_Threaded/run_test.pl b/TAO/performance-tests/Sequence_Latency/Single_Threaded/run_test.pl index bdde3c61361..8b2999453f5 100755 --- a/TAO/performance-tests/Sequence_Latency/Single_Threaded/run_test.pl +++ b/TAO/performance-tests/Sequence_Latency/Single_Threaded/run_test.pl @@ -1,65 +1,96 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); +$debug_level = '0'; -print STDERR "================ Single-threaded Latency Test\n"; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -unlink $iorfile; +print STDERR "================ Single-threaded Latency Test\n"; my $type = 'octet'; for ($i = 0; $i <= $#ARGV; $i++) { if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") { - print "Run_Test Perl script for Performance Test\n\n"; - print "run_test [-t type] \n"; - print "\n"; - print "-t type -- runs only one type of param test\n"; - exit 0; + print "Run_Test Perl script for Performance Test\n\n"; + print "run_test [-t type] \n"; + print "\n"; + print "-t type -- runs only one type of param test\n"; + exit 0; } elsif ($ARGV[$i] eq "-t") { - $type = $ARGV[$i + 1]; - $i++; + $type = $ARGV[$i + 1]; + $i++; } } -$SV = new PerlACE::Process ("server", - "-o $iorfile"); +my $iterations = 150000; -$CL = new PerlACE::Process ("client", - "-t $type -k file://$iorfile " - . " -i 150000"); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -t $type -i $iterations"); print STDERR $CL->CommandLine () ; -$SV->Spawn (); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -$client = $CL->SpawnWaitKill (420); -$server = $SV->WaitKill (10); +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $iorfile; +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 405); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + exit $status; diff --git a/TAO/performance-tests/Sequence_Latency/Thread_Per_Connection/run_test.pl b/TAO/performance-tests/Sequence_Latency/Thread_Per_Connection/run_test.pl index 773addd08e1..c72e68f8159 100755 --- a/TAO/performance-tests/Sequence_Latency/Thread_Per_Connection/run_test.pl +++ b/TAO/performance-tests/Sequence_Latency/Thread_Per_Connection/run_test.pl @@ -1,19 +1,23 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); +$debug_level = '0'; -print STDERR "================ Thread-Per-Connection Latency Test\n"; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -unlink $iorfile; +print STDERR "================ Thread-Per-Connection Latency Test\n"; my $type = 'octet'; @@ -31,35 +35,62 @@ for ($i = 0; $i <= $#ARGV; $i++) { } } -$SV = new PerlACE::Process ("server", - "-o $iorfile"); +my $iterations = 50000; -$CL = new PerlACE::Process ("client", - "-t $type -k file://$iorfile " - . " -i 50000"); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -t $type -i $iterations"); print STDERR $CL->CommandLine () ; -$SV->Spawn (); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -$client = $CL->SpawnWaitKill (420); -$server = $SV->WaitKill (40); +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $iorfile; +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 405); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 30); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + exit $status; diff --git a/TAO/performance-tests/Sequence_Latency/Thread_Pool/run_test.pl b/TAO/performance-tests/Sequence_Latency/Thread_Pool/run_test.pl index c8aa97710c5..df35e919e17 100755 --- a/TAO/performance-tests/Sequence_Latency/Thread_Pool/run_test.pl +++ b/TAO/performance-tests/Sequence_Latency/Thread_Pool/run_test.pl @@ -1,19 +1,23 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; + & eval 'exec perl -S $0 $argv:q' + if 0; # $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); +$debug_level = '0'; -print STDERR "================ Thread_Pool Latency Test\n"; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -unlink $iorfile; +print STDERR "================ Thread_Pool Latency Test\n"; my $type = 'octet'; @@ -31,37 +35,62 @@ for ($i = 0; $i <= $#ARGV; $i++) { } } -$SV = new PerlACE::Process ("server", - "-o $iorfile"); +my $iterations = 150000; -$CL = new PerlACE::Process ("client", - "-t $type -k file://$iorfile " - . " -i 150000"); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -t $type -i $iterations"); print STDERR $CL->CommandLine () ; -$SV->Spawn (); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -$client = $CL->SpawnWaitKill (420); -$server = $SV->WaitKill (40); +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $iorfile; +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 405); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 30); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); exit $status; diff --git a/TAO/tests/GIOP_Fragments/Java_Big_Reply/run_test.pl b/TAO/tests/GIOP_Fragments/Java_Big_Reply/run_test.pl index 6e4af6f5145..6ac0958e8d8 100755 --- a/TAO/tests/GIOP_Fragments/Java_Big_Reply/run_test.pl +++ b/TAO/tests/GIOP_Fragments/Java_Big_Reply/run_test.pl @@ -6,57 +6,95 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; use Config; + sub which { - my($prog) = shift; - my($exec) = $prog; - - if (defined $ENV{'PATH'}) { - my($part) = ''; - foreach $part (split($Config{'path_sep'}, $ENV{'PATH'})) { - $part .= "/$prog"; - if ( -x $part ) { - $exec = $part; - last; - } + my($prog) = shift; + my($exec) = $prog; + + if (defined $ENV{'PATH'}) { + my($part) = ''; + foreach $part (split($Config{'path_sep'}, $ENV{'PATH'})) { + $part .= "/$prog"; + if ( -x $part ) { + $exec = $part; + last; + } + } } - } - return $exec; + return $exec; +} + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } } -$iorfile = PerlACE::LocalFile ('server.ior'); -unlink $iorfile; +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; -$SV = new PerlACE::Process (which('java'), 'server'); -$CL = new PerlACE::Process ('client'); +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess (which("java"), "server"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -$SV->Spawn (); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; $SV->Kill (); $SV->TimedWait (1); exit 1; } -$CL->Spawn (60); +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -$client = $CL->WaitKill (60); +$client_status = $CL->Spawn ($client->ProcessStartWaitInterval() + 45); -if ($client1 != 0) { - print STDERR "ERROR: client 1 returned $client1\n"; +if ($client_status != 0) { + print STDERR "ERROR: client Spawn returned $client_status\n"; $status = 1; } +$client_status = $CL->WaitKill ($client->ProcessStopWaitInterval() + 45); + +if ($client_status != 0) { + print STDERR "ERROR: client WaitKill returned $client_status\n"; + $status = 1; +} -$server = $SV->WaitKill (10); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $iorfile; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); exit $status; diff --git a/TAO/tests/GIOP_Fragments/Java_Big_Request/run_test.pl b/TAO/tests/GIOP_Fragments/Java_Big_Request/run_test.pl index c23c7b4c2f5..2caa36b5f9b 100755 --- a/TAO/tests/GIOP_Fragments/Java_Big_Request/run_test.pl +++ b/TAO/tests/GIOP_Fragments/Java_Big_Request/run_test.pl @@ -6,48 +6,67 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ('server.ior'); -$TARGETHOSTNAME = 'localhost'; -$port = PerlACE::uniqueid () + 12000; +$debug_level = '0'; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + +my $host = $server->HostName(); +my $port = $server->RandomPort(); +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", ""); ## No ORB fragments GIOP 1.0 messages. ## The JDK ORB only fragments GIOP 1.2 messages. foreach my $giop ('1.2') { - print "Testing GIOP $giop Fragmentation\n"; - unlink $iorfile; - - $SV = new PerlACE::Process ('server', - '-ORBEndpoint ' . - "iiop://$giop\@$TARGETHOSTNAME" . ":$port"); - $SV->Spawn (); - - if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); $SV->TimedWait (1); - exit 1; - } - - my($cl) = system('java client'); - if ($cl != 0) { - print STDERR "ERROR: client returned $cl\n"; - ++$status; - } - - $server = $SV->WaitKill (20); - - if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - ++$status; - } - - unlink $iorfile; - - if ($status) { - last; - } + print "Testing GIOP $giop Fragmentation\n"; + + $server->DeleteFile($iorbase); + $SV->Arguments("-ORBdebuglevel $debug_level -o $server_iorfile ". + "-ORBEndpoint iiop://$giop\@$host:$port"); + + $server_status = $SV->Spawn (); + + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; + } + + if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; + } + + my $client_status = system('java client'); + if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + ++$status; + } + + $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 10); + + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + ++$status; + } + + if ($status) { + last; + } } +$server->DeleteFile($iorbase); + exit $status; |