diff options
author | dbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-11-20 09:30:08 +0000 |
---|---|---|
committer | dbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-11-20 09:30:08 +0000 |
commit | 36c78fff873dadec71a5d1405bac10ab34a802fa (patch) | |
tree | 7abac907ea72817aa256f749054205ae05a0f04d | |
parent | 09c7e9bb146c39cae19cb8a8a89493815702e88a (diff) | |
download | ATCD-36c78fff873dadec71a5d1405bac10ab34a802fa.tar.gz |
Fri Nov 20 09:28:50 UTC 2009 Denis Budko <denis.budko@remedy.nl>
* orbsvcs/DevGuideExamples/EventServices/OMG_TypedEC/run_test.pl:
* orbsvcs/DevGuideExamples/EventServices/RTEC_Federated/run_test.pl:
* orbsvcs/DevGuideExamples/EventServices/OMG_SupplierSideEC/run_test.pl:
* orbsvcs/DevGuideExamples/EventServices/RTEC_Filter/run_test.pl:
* orbsvcs/DevGuideExamples/EventServices/OMG_Basic/run_test.pl:
* orbsvcs/DevGuideExamples/EventServices/RTEC_MCast_Federated/run_test.pl:
* orbsvcs/DevGuideExamples/EventServices/RTEC_Basic/run_test.pl:
* orbsvcs/tests/Security/EndpointPolicy/run_test.pl:
* DevGuideExamples/Multithreading/ThreadPool/MessengerServer.cpp:
* DevGuideExamples/Multithreading/ThreadPool/MessengerClient.cpp:
* DevGuideExamples/Multithreading/ThreadPool/run_test.pl:
* DevGuideExamples/Multithreading/GracefulShutdown/MessengerServer.cpp:
* DevGuideExamples/Multithreading/GracefulShutdown/MessengerClient.cpp:
* DevGuideExamples/Multithreading/GracefulShutdown/run_test.pl:
* DevGuideExamples/Multithreading/ThreadPerConnection/MessengerServer.cpp:
* DevGuideExamples/Multithreading/ThreadPerConnection/MessengerClient.cpp:
* DevGuideExamples/Multithreading/ThreadPerConnection/run_test.pl:
* DevGuideExamples/AMH_AMI/inner_server.cpp:
* DevGuideExamples/AMH_AMI/client.cpp:
* DevGuideExamples/AMH_AMI/middle_server.cpp:
* DevGuideExamples/AMH_AMI/run_test.pl:
* tests/OctetSeq/run_test1.pl:
* tests/OctetSeq/run_test2.pl:
* tests/OctetSeq/run_test.pl:
* tests/Bug_1330_Regression/server.cpp:
* tests/Bug_1330_Regression/run_test.pl:
* tests/Leader_Followers/run_test.pl:
* tests/NestedUpcall/MT_Client_Test/run_test.pl:
* tests/Bug_2702_Regression/run_test.pl:
* tests/IPV6/run_test.pl:
* tests/MProfile_Connection_Timeout/run_test.pl:
Tests are converted to use new test framework and added to fuzz build.
34 files changed, 2806 insertions, 1097 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 6a67aea3c15..b9247fc0b23 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,39 @@ +Fri Nov 20 09:28:50 UTC 2009 Denis Budko <denis.budko@remedy.nl> + + * orbsvcs/DevGuideExamples/EventServices/OMG_TypedEC/run_test.pl: + * orbsvcs/DevGuideExamples/EventServices/RTEC_Federated/run_test.pl: + * orbsvcs/DevGuideExamples/EventServices/OMG_SupplierSideEC/run_test.pl: + * orbsvcs/DevGuideExamples/EventServices/RTEC_Filter/run_test.pl: + * orbsvcs/DevGuideExamples/EventServices/OMG_Basic/run_test.pl: + * orbsvcs/DevGuideExamples/EventServices/RTEC_MCast_Federated/run_test.pl: + * orbsvcs/DevGuideExamples/EventServices/RTEC_Basic/run_test.pl: + * orbsvcs/tests/Security/EndpointPolicy/run_test.pl: + * DevGuideExamples/Multithreading/ThreadPool/MessengerServer.cpp: + * DevGuideExamples/Multithreading/ThreadPool/MessengerClient.cpp: + * DevGuideExamples/Multithreading/ThreadPool/run_test.pl: + * DevGuideExamples/Multithreading/GracefulShutdown/MessengerServer.cpp: + * DevGuideExamples/Multithreading/GracefulShutdown/MessengerClient.cpp: + * DevGuideExamples/Multithreading/GracefulShutdown/run_test.pl: + * DevGuideExamples/Multithreading/ThreadPerConnection/MessengerServer.cpp: + * DevGuideExamples/Multithreading/ThreadPerConnection/MessengerClient.cpp: + * DevGuideExamples/Multithreading/ThreadPerConnection/run_test.pl: + * DevGuideExamples/AMH_AMI/inner_server.cpp: + * DevGuideExamples/AMH_AMI/client.cpp: + * DevGuideExamples/AMH_AMI/middle_server.cpp: + * DevGuideExamples/AMH_AMI/run_test.pl: + * tests/OctetSeq/run_test1.pl: + * tests/OctetSeq/run_test2.pl: + * tests/OctetSeq/run_test.pl: + * tests/Bug_1330_Regression/server.cpp: + * tests/Bug_1330_Regression/run_test.pl: + * tests/Leader_Followers/run_test.pl: + * tests/NestedUpcall/MT_Client_Test/run_test.pl: + * tests/Bug_2702_Regression/run_test.pl: + * tests/IPV6/run_test.pl: + * tests/MProfile_Connection_Timeout/run_test.pl: + + Tests are converted to use new test framework and added to fuzz build. + Fri Nov 20 08:56:26 UTC 2009 Vladimir Zykov <vladimir.zykov@prismtech.com> * tests/Bug_3755_Regression/server.cpp: diff --git a/TAO/DevGuideExamples/AMH_AMI/client.cpp b/TAO/DevGuideExamples/AMH_AMI/client.cpp index 42b494a6700..5ec095e74c4 100644 --- a/TAO/DevGuideExamples/AMH_AMI/client.cpp +++ b/TAO/DevGuideExamples/AMH_AMI/client.cpp @@ -1,18 +1,49 @@ // $Id$ #include "amh_ami_pch.h" - +#include "ace/Get_Opt.h" #include "middleC.h" #include <iostream> + +const ACE_TCHAR *ior_file = ACE_TEXT ("file://middle.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_file = get_opts.opt_arg (); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior_file> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) { try { // Initialize the ORB. CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + if (parse_args (argc, argv) != 0) + return 1; + // Read and destringify the Asynch_Except_Demo object's IOR. - CORBA::Object_var obj = orb->string_to_object( "file://middle.ior" ); + CORBA::Object_var obj = orb->string_to_object(ior_file); if( CORBA::is_nil( obj.in() ) ) { std::cerr << "Could not get middle IOR." << std::endl; return 1; diff --git a/TAO/DevGuideExamples/AMH_AMI/inner_server.cpp b/TAO/DevGuideExamples/AMH_AMI/inner_server.cpp index 9dc4446b5d2..c38ecc815fe 100644 --- a/TAO/DevGuideExamples/AMH_AMI/inner_server.cpp +++ b/TAO/DevGuideExamples/AMH_AMI/inner_server.cpp @@ -5,23 +5,41 @@ #include "inner_i.h" #include "ace/SString.h" #include "ace/OS_String.h" +#include "ace/Get_Opt.h" #include <iostream> #include <fstream> int dont_crash = 1; +const ACE_TCHAR *ior_output_file = ACE_TEXT ("inner.ior"); + int parse_args (int argc, ACE_TCHAR *argv[]) { - int c = 0; - while (c < argc) - { - if (ACE_OS::strcasecmp (argv[c], ACE_TEXT("-crash")) == 0) - dont_crash = 0; - c++; - } + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("c:o:")); + int c; - return 1; + while ((c = get_opts ()) != -1) + switch (c) + { + case 'c': + dont_crash = 0; + break; + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile> " + "-c " + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; } int @@ -31,7 +49,8 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Initialize the ORB. CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - parse_args (argc, argv); + if (parse_args (argc, argv) != 0) + return 1; //Get reference to the RootPOA. CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); @@ -49,7 +68,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) PortableServer::ObjectId_var oid = poa->activate_object( servant.in() ); obj = poa->id_to_reference( oid.in() ); CORBA::String_var str = orb->object_to_string( obj.in() ); - ACE_CString iorname ("inner.ior"); + ACE_CString iorname (ior_output_file); std::ofstream iorFile (iorname.c_str()); iorFile << str.in() << std::endl; iorFile.close(); diff --git a/TAO/DevGuideExamples/AMH_AMI/middle_server.cpp b/TAO/DevGuideExamples/AMH_AMI/middle_server.cpp index 98e8dea90a7..c023790e131 100644 --- a/TAO/DevGuideExamples/AMH_AMI/middle_server.cpp +++ b/TAO/DevGuideExamples/AMH_AMI/middle_server.cpp @@ -4,25 +4,49 @@ #include "middle_i.h" #include "ace/OS_String.h" +#include "ace/Get_Opt.h" #include <iostream> #include <fstream> int use_synch = 0; +const ACE_TCHAR *ior_output_file = ACE_TEXT ("middle.ior"); +const ACE_TCHAR *ior_input_file = ACE_TEXT ("file://inner.ior"); + int parse_args (int argc, ACE_TCHAR *argv[]) { - int c = 0; - while (c < argc) - { - if (ACE_OS::strcasecmp (argv[c], ACE_TEXT("-no_AMH")) == 0) - use_synch = 1; - c++; - } + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:i:n")); + int c; - return 1; + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + case 'i': + ior_input_file = get_opts.opt_arg (); + break; + case 'n': + use_synch = 1; + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <ior_output_file> " + "-i <ior_input_file> " + "-n" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; } + int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { @@ -30,7 +54,8 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Initialize the ORB. CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - parse_args(argc,argv); + if (parse_args (argc, argv) != 0) + return 1; //Get reference to the RootPOA. CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); @@ -40,7 +65,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) PortableServer::POAManager_var mgr = poa->the_POAManager(); mgr->activate(); - obj = orb->string_to_object("file://inner.ior"); + obj = orb->string_to_object(ior_input_file); Inner_var peer = Inner::_narrow(obj.in()); if (CORBA::is_nil(peer.in())) @@ -63,7 +88,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) obj = poa->id_to_reference( oid.in() ); CORBA::String_var str = orb->object_to_string( obj.in() ); - ACE_CString iorname("middle.ior"); + ACE_CString iorname(ior_output_file); std::ofstream iorFile (iorname.c_str()); iorFile << str.in() << std::endl; iorFile.close(); diff --git a/TAO/DevGuideExamples/AMH_AMI/run_test.pl b/TAO/DevGuideExamples/AMH_AMI/run_test.pl index 332eeb84aa7..1e73cf21dc8 100755 --- a/TAO/DevGuideExamples/AMH_AMI/run_test.pl +++ b/TAO/DevGuideExamples/AMH_AMI/run_test.pl @@ -1,60 +1,120 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + # $Id$ +# -*- perl -*- -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; +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 $in_server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $md_server = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $client = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; +my $inner_ior = "inner.ior"; +my $middle_ior = "middle.ior"; -$inner_ior = PerlACE::LocalFile ("inner.ior"); -$middle_ior = PerlACE::LocalFile ("middle.ior"); -unlink $inner_ior; -unlink $middle_ior; +# Files which used by inner_server +my $in_server_inner_ior = $in_server->LocalFile ($inner_ior); +$in_server->DeleteFile($inner_ior); -# start inner_server +# Files which used by middle server +my $md_server_inner_ior = $md_server->LocalFile ($inner_ior); +my $md_server_middle_ior = $md_server->LocalFile ($middle_ior); +$md_server->DeleteFile($inner_ior); +$md_server->DeleteFile($middle_ior); -$IS = new PerlACE::Process("inner_server"); -$IS->Spawn(); +# Files which used by inner_server +my $client_iorfile = $client->LocalFile ($middle_ior); +$client->DeleteFile($middle_ior); -if (PerlACE::waitforfile_timed ($inner_ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$inner_ior>\n"; - $IS->Kill(); - unlink $inner_ior; +$IS = $in_server->CreateProcess ("inner_server", + "-ORBdebuglevel $debug_level " . + "-o $in_server_inner_ior"); + +$MD = $md_server->CreateProcess ("middle_server", + "-ORBdebuglevel $debug_level " . + "-o $md_server_middle_ior " . + "-i file://$md_server_inner_ior"); + +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); + +$server_status = $IS->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; } +if ($in_server->WaitForFileTimed ($inner_ior, + $in_server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$in_server_inner_ior>\n"; + $IS->Kill (); $IS->TimedWait (1); + exit 1; +} -# start middle_server +if ($in_server->GetFile ($inner_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$in_server_inner_ior>\n"; + $IS->Kill (); $IS->TimedWait (1); + exit 1; +} +if ($md_server->PutFile ($inner_ior) == -1) { + print STDERR "ERROR: cannot set file <$md_server_inner_ior>\n"; + $IS->Kill (); $IS->TimedWait (1); + exit 1; +} -$MS = new PerlACE::Process("middle_server"); -$MS->Spawn(); +$server_status = $MD->Spawn (); -if (PerlACE::waitforfile_timed ($middle_ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$middle_ior>\n"; - $MS->Kill(); - unlink $middle_ior; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; } -# start client +if ($md_server->WaitForFileTimed ($middle_ior, + $md_server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$md_server_middle_ior>\n"; + $MD->Kill (); $MD->TimedWait (1); + $IS->Kill (); $IS->TimedWait (1); + exit 1; +} -$C = new PerlACE::Process("client"); -$C->Spawn(); +if ($md_server->GetFile ($middle_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$md_server_middle_ior>\n"; + $MD->Kill (); $MD->TimedWait (1); + $IS->Kill (); $IS->TimedWait (1); + exit 1; +} +if ($client->PutFile ($middle_ior) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $MD->Kill (); $MD->TimedWait (1); + $IS->Kill (); $IS->TimedWait (1); + exit 1; +} -$CRET = $C->WaitKill(45); -$IS->Kill(); -$MS->Kill(); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 30); -# clean-up +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} -unlink $inner_ior; -unlink $middle_ior; +$IS->Kill (); +$MD->Kill (); -if ($CRET != 0) { - print STDERR "ERROR: Client returned <$CRET>\n"; - exit 1 ; -} +$in_server->DeleteFile($inner_ior); +$md_server->DeleteFile($inner_ior); +$md_server->DeleteFile($middle_ior); +$client->DeleteFile($middle_ior); -exit 0; +exit $status; diff --git a/TAO/DevGuideExamples/Multithreading/GracefulShutdown/MessengerClient.cpp b/TAO/DevGuideExamples/Multithreading/GracefulShutdown/MessengerClient.cpp index e2f551e93d7..5c5aef8f034 100644 --- a/TAO/DevGuideExamples/Multithreading/GracefulShutdown/MessengerClient.cpp +++ b/TAO/DevGuideExamples/Multithreading/GracefulShutdown/MessengerClient.cpp @@ -5,16 +5,20 @@ #include <iostream> int call_shutdown = 0; +const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); int parse_args (int argc, ACE_TCHAR* argv[]) { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("x")); + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:x")); int c; while ((c = get_opts ()) != -1) { switch (c) { + case 'k': + ior = get_opts.opt_arg (); + break; case 'x': call_shutdown = 1; break; @@ -22,6 +26,7 @@ int parse_args (int argc, ACE_TCHAR* argv[]) default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s\n" + "-k <ior> " "-x - call shutdown on server\n", argv[0]), -1); @@ -42,7 +47,7 @@ int ACE_TMAIN( int argc, ACE_TCHAR* argv[] ) return 1; // Read and destringify the Messenger object's 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 << "Could not get Messenger IOR." << std::endl; return 1; diff --git a/TAO/DevGuideExamples/Multithreading/GracefulShutdown/MessengerServer.cpp b/TAO/DevGuideExamples/Multithreading/GracefulShutdown/MessengerServer.cpp index 1d08615f6d6..b249ddc8228 100644 --- a/TAO/DevGuideExamples/Multithreading/GracefulShutdown/MessengerServer.cpp +++ b/TAO/DevGuideExamples/Multithreading/GracefulShutdown/MessengerServer.cpp @@ -8,7 +8,8 @@ #include "tao/ORB_Core.h" #include <iostream> #include <fstream> -ACE_TString ior_output_file; + +ACE_TString ior_output_file = ACE_TEXT ("test.ior"); // By default, shutdown when client calls Messenger::shutdown(). MessengerServer::ShutdownMethod s_method = MessengerServer::s_client_call; @@ -152,6 +153,14 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Initialize the ORB. CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + // Create a MessengerServer object. + MessengerServer * server = new MessengerServer (orb.in()); + ACE_Auto_Ptr<MessengerServer> safe_ptr (server); + + // Parse arguments to determine how we should shutdown. + if (server->parse_args (argc, argv) != 0) + return 1; + //Get reference to the RootPOA. CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); @@ -169,17 +178,11 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) poa->activate_object( &messenger_servant ); 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.c_str ())); iorFile << str.in() << std::endl; iorFile.close(); - std::cout << "IOR written to file Messenger.ior" << std::endl; - - // Create a MessengerServer object. - MessengerServer * server = new MessengerServer (orb.in()); - - // Parse arguments to determine how we should shutdown. - if (server->parse_args (argc, argv) != 0) - return 1; + std::cout << "IOR written to file " << + ACE_TEXT_ALWAYS_CHAR (ior_output_file.c_str ()) << std::endl; switch (s_method) { @@ -211,10 +214,6 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) server->run (timeout); break; } - - // Finished. - delete server; - } catch(const CORBA::Exception& ex) { std::cerr << "CORBA exception: " << ex << std::endl; diff --git a/TAO/DevGuideExamples/Multithreading/GracefulShutdown/run_test.pl b/TAO/DevGuideExamples/Multithreading/GracefulShutdown/run_test.pl index 327eae8a96d..a6c5964fc80 100755 --- a/TAO/DevGuideExamples/Multithreading/GracefulShutdown/run_test.pl +++ b/TAO/DevGuideExamples/Multithreading/GracefulShutdown/run_test.pl @@ -1,125 +1,201 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + # $Id$ +# -*- perl -*- -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; +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 $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"; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); -$ior = PerlACE::LocalFile ("Messenger.ior"); -unlink $ior; +my $hostname = $server->HostName (); +my $server_args = "-ORBdebuglevel $debug_level " . + "-ORBListenEndpoints iiop://$hostname -o $server_iorfile"; -$server_args = "-ORBListenEndpoints iiop://localhost"; +$SV = $server->CreateProcess ("MessengerServer", + $server_args . " -x"); +$CL = $client->CreateProcess ("MessengerClient", + "-k file://$client_iorfile -x"); # ------------------------------------------------------------------- # Test 1: Shutdown on client invocation # ------------------------------------------------------------------- -# start MessengerServer - print STDOUT "\n\nTest 1: Shutdown on client invocation.\n"; print STDOUT "Running MessengerServer...\n"; -$S1 = new PerlACE::Process("MessengerServer", $server_args . " -x"); -$S1->Spawn(); -if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ior>\n"; - $S1->Kill(); - unlink $ior; +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; } -# start MessengerClient +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -$C1 = new PerlACE::Process("MessengerClient", "-x"); -$C1->Spawn(); +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; +} -$C1RET = $C1->WaitKill(15); -$S1->Kill(); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); -# clean-up +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} -unlink $ior; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); -if ($C1RET != 0) { - print STDERR "ERROR: Client returned <$C1RET>\n"; - exit 1 ; -} +exit $status if ($status != 0); # ------------------------------------------------------------------- # Test 2: Shutdown after <n> iterations through polling loop # ------------------------------------------------------------------- -# start MessengerServer - -$iter = 10; +my $iter = 10; print STDOUT "\n\nTest 2: Shutdown after <$iter> iterations through polling loop.\n"; print STDOUT "Running MessengerServer...\n"; -$S2 = new PerlACE::Process("MessengerServer", $server_args . " -p " . $iter); -$S2->Spawn(); -if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ior>\n"; - $S2->Kill(); - unlink $ior; +$SV->Arguments ($server_args . " -p " . $iter); +$CL->Arguments ("-k file://$client_iorfile"); + +$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 ($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; } -# start MessengerClient +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); -$C2 = new PerlACE::Process("MessengerClient"); -$C2->Spawn(); +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} -$C2RET = $C2->WaitKill(15); -$S2->WaitKill($iter+5); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + $iter); -# clean-up +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} -unlink $ior; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); -if ($C2RET != 0) { - print STDERR "ERROR: Client returned <$C2RET>\n"; - exit 1 ; -} +exit $status if ($status != 0); # ------------------------------------------------------------------- -# Test 3: Schedule a timer with the ORB's reactor to shutdown +# Test 3: Schedule a timer with the ORB's reactor to shutdown. # in <n> seconds # ------------------------------------------------------------------- -# start MessengerServer - -$sec = 10; +my $sec = 10; print STDOUT "\n\nTest 3: Schedule a timer with the ORB's reactor to shutdown in <$sec> seconds.\n"; print STDOUT "Running MessengerServer...\n"; -$S3 = new PerlACE::Process("MessengerServer", $server_args . " -t " . $sec); -$S3->Spawn(); -if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ior>\n"; - $S3->Kill(); - unlink $ior; +$SV->Arguments ($server_args . " -t " . $sec); +$CL->Arguments ("-k file://$client_iorfile"); + +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; } -# start MessengerClient +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -$C3 = new PerlACE::Process("MessengerClient"); -$C3->Spawn(); +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; +} -$C3RET = $C3->WaitKill(15); -$S3->WaitKill($sec+5); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); -# clean-up +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} -unlink $ior; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + $sec); -if ($C3RET != 0) { - print STDERR "ERROR: Client returned <$C3RET>\n"; - exit 1 ; -} +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status if ($status != 0); # ------------------------------------------------------------------- # Test 4: Use the overloaded version of CORBA::ORB::run() that takes @@ -127,79 +203,110 @@ if ($C3RET != 0) { # should process events before returning. # ------------------------------------------------------------------- -# start MessengerServer - print STDOUT "\n\nTest 4: Use the overloaded version of CORBA::ORB::run()\n"; print STDOUT "that takes an ACE_Time_Value parameter indicating how long\n"; print STDOUT "run() should process events before returning (<$sec> seconds).\n"; print STDOUT "Running MessengerServer...\n"; -$S4 = new PerlACE::Process("MessengerServer", $server_args . " -r " . $sec); -$S4->Spawn(); -if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ior>\n"; - $S4->Kill(); - unlink $ior; +$SV->Arguments ($server_args . " -r " . $sec); +$CL->Arguments ("-k file://$client_iorfile"); + +$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; } -# start MessengerClient +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; +} -$C4 = new PerlACE::Process("MessengerClient"); -$C4->Spawn(); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); -$C4RET = $C4->WaitKill(15); -$S4->WaitKill($sec+5); +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} -# clean-up +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + $sec); -unlink $ior; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} -if ($C4RET != 0) { - print STDERR "ERROR: Client returned <$C4RET>\n"; - exit 1 ; -} +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); +exit $status if ($status != 0); # ------------------------------------------------------------------- # Test 5: Spawn a separate thread to shutdown the ORB on any # input from the console (terminal) # ------------------------------------------------------------------- -# start MessengerServer - print STDOUT "\n\nTest 5: Spawn a separate thread to shutdown the ORB on any input from the console (terminal).\n"; print STDOUT "Running MessengerServer...\n"; -$S5 = new PerlACE::Process("MessengerServer", $server_args . " -c"); -$S5->Spawn(); -if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ior>\n"; - $S5->Kill(); - unlink $ior; - exit 1; -} +$SV->Arguments ($server_args . " -c "); +$CL->Arguments ("-k file://$client_iorfile"); -# start MessengerClient +$server_status = $SV->Spawn (); -$C5 = new PerlACE::Process("MessengerClient"); -$C5->Spawn(); - -$C5RET = $C5->WaitKill(15); -print STDOUT "Enter any input to shutdown MessengerServer...\n"; -$S5->WaitKill(15); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -# clean-up +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -unlink $ior; +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 ($C5RET != 0) { - print STDERR "ERROR: Client returned <$C5RET>\n"; - exit 1 ; -} +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} -exit 0; +print STDOUT "Enter any input to shutdown MessengerServer...\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/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerClient.cpp b/TAO/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerClient.cpp index 1e24fd500ef..b4269742a43 100644 --- a/TAO/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerClient.cpp +++ b/TAO/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerClient.cpp @@ -1,15 +1,48 @@ // $Id$ #include "MessengerC.h" +#include "ace/Get_Opt.h" #include <iostream> + +const ACE_TCHAR *ior = ACE_TEXT ("file://test.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 the ORB. CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + if (parse_args (argc, argv) != 0) + return 1; + // Read and destringify the Messenger object's 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 << "Could not get Messenger IOR." << std::endl; return 1; diff --git a/TAO/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerServer.cpp b/TAO/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerServer.cpp index 5dc50c06521..512254aabea 100644 --- a/TAO/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerServer.cpp +++ b/TAO/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerServer.cpp @@ -1,8 +1,38 @@ // $Id$ #include "Messenger_i.h" +#include "ace/Get_Opt.h" #include <iostream> #include <fstream> + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("test.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 <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { try { @@ -17,6 +47,9 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) PortableServer::POAManager_var mgr = poa->the_POAManager(); mgr->activate(); + if (parse_args (argc, argv) != 0) + return 1; + // Create a servant. PortableServer::Servant_var<Messenger_i> messenger_servant = new Messenger_i; @@ -26,10 +59,10 @@ int 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 " << ACE_TEXT_ALWAYS_CHAR (ior_output_file) << std::endl; // Accept requests from clients. orb->run(); diff --git a/TAO/DevGuideExamples/Multithreading/ThreadPerConnection/run_test.pl b/TAO/DevGuideExamples/Multithreading/ThreadPerConnection/run_test.pl index e669d1d1995..cc23b7a59b2 100755 --- a/TAO/DevGuideExamples/Multithreading/ThreadPerConnection/run_test.pl +++ b/TAO/DevGuideExamples/Multithreading/ThreadPerConnection/run_test.pl @@ -1,76 +1,169 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + # $Id$ +# -*- perl -*- -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; +$status = 0; +$debug_level = '0'; -$ior = PerlACE::LocalFile ("Messenger.ior"); -unlink $ior; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -# start MessengerServer +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 $client3 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $client4 = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; + +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client1_iorfile = $client1->LocalFile ($iorbase); +my $client2_iorfile = $client2->LocalFile ($iorbase); +my $client3_iorfile = $client3->LocalFile ($iorbase); +my $client4_iorfile = $client4->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client1->DeleteFile($iorbase); +$client2->DeleteFile($iorbase); +$client3->DeleteFile($iorbase); +$client4->DeleteFile($iorbase); + +my $hostname = $server->HostName (); + +$SV = $server->CreateProcess ("MessengerServer", + "-ORBdebuglevel $debug_level " . + "-ORBSvcConf server.conf " . + "-ORBListenEndpoints iiop://$hostname " . + "-o $server_iorfile"); +$CL1 = $client1->CreateProcess ("MessengerClient", "-k file://$client1_iorfile"); +$CL2 = $client2->CreateProcess ("MessengerClient", "-k file://$client2_iorfile"); +$CL3 = $client3->CreateProcess ("MessengerClient", "-k file://$client3_iorfile"); +$CL4 = $client4->CreateProcess ("MessengerClient", "-k file://$client4_iorfile"); print STDOUT "Starting MessengerServer\n"; +$server_status = $SV->Spawn (); -$S = new PerlACE::Process("MessengerServer", "-ORBSvcConf server.conf -ORBListenEndpoints iiop://localhost"); -$S->Spawn(); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ior>\n"; - $S->Kill(); - unlink $ior; +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -# start several MessengerClients +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client1->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client1_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client2->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client2_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client3->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client3_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client4->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client4_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} print STDOUT "\n\nStarting 4 MessengerClients.\n"; -print STDOUT "Each client should get a new connection \ -and its own thread in the server.\n\n"; +print STDOUT "Each client should get a new connection ". + "and its own thread in the server.\n\n"; -$C1 = new PerlACE::Process("MessengerClient"); -$C2 = new PerlACE::Process("MessengerClient"); -$C3 = new PerlACE::Process("MessengerClient"); -$C4 = new PerlACE::Process("MessengerClient"); -$C1->Spawn(); -$C2->Spawn(); -$C3->Spawn(); -$C4->Spawn(); +$client_status = $CL1->Spawn (); -$C1RET = $C1->WaitKill(15); -$C2RET = $C2->WaitKill(15); -$C3RET = $C3->WaitKill(15); -$C4RET = $C4->WaitKill(15); -$S->Kill(); +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -# clean-up +$client_status = $CL2->Spawn (); -unlink $ior; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + exit 1; +} -if ($C1RET != 0) { - print STDERR "ERROR: Client 1 returned <$C1RET>\n"; - exit 1 ; -} +$client_status = $CL3->Spawn (); -if ($C2RET != 0) { - print STDERR "ERROR: Client 1 returned <$C2RET>\n"; - exit 1 ; -} +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + exit 1; +} -if ($C3RET != 0) { - print STDERR "ERROR: Client 1 returned <$C3RET>\n"; - exit 1 ; -} +$client_status = $CL4->Spawn (); -if ($C4RET != 0) { - print STDERR "ERROR: Client 1 returned <$C4RET>\n"; - exit 1 ; -} +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + exit 1; +} + +$client_status = $CL1->WaitKill ($client1->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} -exit 0; +$client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL3->WaitKill ($client3->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL4->WaitKill ($client4->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} +$SV->Kill (); +$server->DeleteFile($iorbase); +$client1->DeleteFile($iorbase); +$client2->DeleteFile($iorbase); +$client3->DeleteFile($iorbase); +$client4->DeleteFile($iorbase); +exit $status; diff --git a/TAO/DevGuideExamples/Multithreading/ThreadPool/MessengerClient.cpp b/TAO/DevGuideExamples/Multithreading/ThreadPool/MessengerClient.cpp index 1e24fd500ef..b4269742a43 100644 --- a/TAO/DevGuideExamples/Multithreading/ThreadPool/MessengerClient.cpp +++ b/TAO/DevGuideExamples/Multithreading/ThreadPool/MessengerClient.cpp @@ -1,15 +1,48 @@ // $Id$ #include "MessengerC.h" +#include "ace/Get_Opt.h" #include <iostream> + +const ACE_TCHAR *ior = ACE_TEXT ("file://test.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 the ORB. CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + if (parse_args (argc, argv) != 0) + return 1; + // Read and destringify the Messenger object's 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 << "Could not get Messenger IOR." << std::endl; return 1; diff --git a/TAO/DevGuideExamples/Multithreading/ThreadPool/MessengerServer.cpp b/TAO/DevGuideExamples/Multithreading/ThreadPool/MessengerServer.cpp index 2e0865eac9d..2097b73a3a3 100644 --- a/TAO/DevGuideExamples/Multithreading/ThreadPool/MessengerServer.cpp +++ b/TAO/DevGuideExamples/Multithreading/ThreadPool/MessengerServer.cpp @@ -1,11 +1,40 @@ // $Id$ #include "Messenger_i.h" +#include "ace/Get_Opt.h" #include <iostream> #include <fstream> // 1. Define a "task" class for implenting the thread pool threads. #include "ace/Task.h" +const ACE_TCHAR *ior_output_file = ACE_TEXT ("test.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 <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + class ORB_Task : public ACE_Task_Base { public: @@ -38,6 +67,9 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) PortableServer::POAManager_var mgr = poa->the_POAManager(); mgr->activate(); + if (parse_args (argc, argv) != 0) + return 1; + // Create a servant. PortableServer::Servant_var<Messenger_i> messenger_servant = new Messenger_i; @@ -47,10 +79,11 @@ int 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 " << + ACE_TEXT_ALWAYS_CHAR (ior_output_file) << std::endl; // 3. Create and activate threads for the thread pool. ORB_Task task (orb.in()); diff --git a/TAO/DevGuideExamples/Multithreading/ThreadPool/run_test.pl b/TAO/DevGuideExamples/Multithreading/ThreadPool/run_test.pl index a73ce34a799..a3fb0021480 100755 --- a/TAO/DevGuideExamples/Multithreading/ThreadPool/run_test.pl +++ b/TAO/DevGuideExamples/Multithreading/ThreadPool/run_test.pl @@ -1,115 +1,322 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + # $Id$ +# -*- perl -*- -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; +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 $client3 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $client4 = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; +my $client5 = PerlACE::TestTarget::create_target (6) || die "Create target 6 failed\n"; +my $client6 = PerlACE::TestTarget::create_target (7) || die "Create target 7 failed\n"; +my $client7 = PerlACE::TestTarget::create_target (8) || die "Create target 8 failed\n"; +my $client8 = PerlACE::TestTarget::create_target (9) || die "Create target 9 failed\n"; +my $client9 = PerlACE::TestTarget::create_target (10) || die "Create target 10 failed\n"; -$ior = PerlACE::LocalFile ("Messenger.ior"); -unlink $ior; +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client1_iorfile = $client1->LocalFile ($iorbase); +my $client2_iorfile = $client2->LocalFile ($iorbase); +my $client3_iorfile = $client3->LocalFile ($iorbase); +my $client4_iorfile = $client4->LocalFile ($iorbase); +my $client5_iorfile = $client5->LocalFile ($iorbase); +my $client6_iorfile = $client6->LocalFile ($iorbase); +my $client7_iorfile = $client7->LocalFile ($iorbase); +my $client8_iorfile = $client8->LocalFile ($iorbase); +my $client9_iorfile = $client9->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client1->DeleteFile($iorbase); +$client2->DeleteFile($iorbase); +$client3->DeleteFile($iorbase); +$client4->DeleteFile($iorbase); +$client5->DeleteFile($iorbase); +$client6->DeleteFile($iorbase); +$client7->DeleteFile($iorbase); +$client8->DeleteFile($iorbase); +$client9->DeleteFile($iorbase); -# start MessengerServer +my $hostname = $server->HostName (); + +$SV = $server->CreateProcess ("MessengerServer", + "-ORBdebuglevel $debug_level " . + "-ORBListenEndpoints iiop://$hostname " . + "-o $server_iorfile"); +$CL1 = $client1->CreateProcess ("MessengerClient", "-k file://$client1_iorfile"); +$CL2 = $client2->CreateProcess ("MessengerClient", "-k file://$client2_iorfile"); +$CL3 = $client3->CreateProcess ("MessengerClient", "-k file://$client3_iorfile"); +$CL4 = $client4->CreateProcess ("MessengerClient", "-k file://$client4_iorfile"); +$CL5 = $client5->CreateProcess ("MessengerClient", "-k file://$client5_iorfile"); +$CL6 = $client6->CreateProcess ("MessengerClient", "-k file://$client6_iorfile"); +$CL7 = $client7->CreateProcess ("MessengerClient", "-k file://$client7_iorfile"); +$CL8 = $client8->CreateProcess ("MessengerClient", "-k file://$client8_iorfile"); +$CL9 = $client9->CreateProcess ("MessengerClient", "-k file://$client9_iorfile"); print STDOUT "Starting MessengerServer\n"; +$server_status = $SV->Spawn (); -$S = new PerlACE::Process("MessengerServer", "-ORBListenEndpoints iiop://localhost"); -$S->Spawn(); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ior>\n"; - $S->Kill(); - unlink $ior; +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -# start several MessengerClients +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client1->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client1_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client2->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client2_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client3->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client3_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client4->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client4_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client5->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client5_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client6->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client6_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client7->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client7_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client8->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client8_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client9->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client9_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} print STDOUT "\n\nStarting 9 MessengerClients.\n"; print STDOUT "The server should use different threads to handle requests.\n\n"; -$C1 = new PerlACE::Process("MessengerClient"); -$C2 = new PerlACE::Process("MessengerClient"); -$C3 = new PerlACE::Process("MessengerClient"); -$C4 = new PerlACE::Process("MessengerClient"); -$C5 = new PerlACE::Process("MessengerClient"); -$C6 = new PerlACE::Process("MessengerClient"); -$C7 = new PerlACE::Process("MessengerClient"); -$C8 = new PerlACE::Process("MessengerClient"); -$C9 = new PerlACE::Process("MessengerClient"); -$C1->Spawn(); -$C2->Spawn(); -$C3->Spawn(); -$C4->Spawn(); -$C5->Spawn(); -$C6->Spawn(); -$C7->Spawn(); -$C8->Spawn(); -$C9->Spawn(); - -$C1RET = $C1->WaitKill(15); -$C2RET = $C2->WaitKill(15); -$C3RET = $C3->WaitKill(15); -$C4RET = $C4->WaitKill(15); -$C5RET = $C5->WaitKill(15); -$C6RET = $C6->WaitKill(15); -$C7RET = $C7->WaitKill(15); -$C8RET = $C8->WaitKill(15); -$C9RET = $C9->WaitKill(15); -$S->Kill(); - -# clean-up - -unlink $ior; - -if ($C1RET != 0) { - print STDERR "ERROR: Client 1 returned <$C1RET>\n"; - exit 1 ; -} - -if ($C2RET != 0) { - print STDERR "ERROR: Client 1 returned <$C2RET>\n"; - exit 1 ; -} - -if ($C3RET != 0) { - print STDERR "ERROR: Client 1 returned <$C3RET>\n"; - exit 1 ; -} - -if ($C4RET != 0) { - print STDERR "ERROR: Client 1 returned <$C4RET>\n"; - exit 1 ; -} - -if ($C5RET != 0) { - print STDERR "ERROR: Client 1 returned <$C5RET>\n"; - exit 1 ; -} - -if ($C6RET != 0) { - print STDERR "ERROR: Client 1 returned <$C6RET>\n"; - exit 1 ; -} - -if ($C7RET != 0) { - print STDERR "ERROR: Client 1 returned <$C7RET>\n"; - exit 1 ; -} - -if ($C8RET != 0) { - print STDERR "ERROR: Client 1 returned <$C8RET>\n"; - exit 1 ; -} - -if ($C9RET != 0) { - print STDERR "ERROR: Client 1 returned <$C9RET>\n"; - exit 1 ; -} - -exit 0; +$client_status = $CL1->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL2->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + exit 1; +} + +$client_status = $CL3->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + exit 1; +} + +$client_status = $CL4->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + exit 1; +} + +$client_status = $CL5->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + $CL4->Kill (); $CL4->TimedWait (1); + exit 1; +} + +$client_status = $CL6->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + $CL4->Kill (); $CL4->TimedWait (1); + $CL5->Kill (); $CL5->TimedWait (1); + exit 1; +} + +$client_status = $CL7->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + $CL4->Kill (); $CL4->TimedWait (1); + $CL5->Kill (); $CL5->TimedWait (1); + $CL6->Kill (); $CL6->TimedWait (1); + exit 1; +} + +$client_status = $CL8->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + $CL4->Kill (); $CL4->TimedWait (1); + $CL5->Kill (); $CL5->TimedWait (1); + $CL6->Kill (); $CL6->TimedWait (1); + $CL7->Kill (); $CL7->TimedWait (1); + exit 1; +} + +$client_status = $CL9->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + $CL4->Kill (); $CL4->TimedWait (1); + $CL5->Kill (); $CL5->TimedWait (1); + $CL6->Kill (); $CL6->TimedWait (1); + $CL7->Kill (); $CL7->TimedWait (1); + $CL8->Kill (); $CL8->TimedWait (1); + exit 1; +} + +$client_status = $CL1->WaitKill ($client1->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL3->WaitKill ($client3->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL4->WaitKill ($client4->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL5->WaitKill ($client5->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL6->WaitKill ($client6->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL7->WaitKill ($client7->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL8->WaitKill ($client8->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL9->WaitKill ($client9->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} +$SV->Kill (); +$server->DeleteFile($iorbase); +$client1->DeleteFile($iorbase); +$client2->DeleteFile($iorbase); +$client3->DeleteFile($iorbase); +$client4->DeleteFile($iorbase); +$client5->DeleteFile($iorbase); +$client6->DeleteFile($iorbase); +$client7->DeleteFile($iorbase); +$client8->DeleteFile($iorbase); +$client9->DeleteFile($iorbase); +exit $status; diff --git a/TAO/bin/tao_orb_tests.lst b/TAO/bin/tao_orb_tests.lst index 740d07d5eed..584613d310f 100644 --- a/TAO/bin/tao_orb_tests.lst +++ b/TAO/bin/tao_orb_tests.lst @@ -14,7 +14,7 @@ TAO/tests/Oneway_Send_Timeouts/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_M TAO/tests/Oneway_Send_Timeouts/run_test.pl -blocking: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !Win32 TAO/tests/Oneway_Send_Timeouts/run_test.pl -reactive: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !Win32 TAO/tests/Abstract_Interface/run_test.pl: !CORBA_E_MICRO -TAO/tests/Bug_2702_Regression/run_test.pl: !FUZZ !LabVIEW_RT +TAO/tests/Bug_2702_Regression/run_test.pl: TAO/tests/ORB_Local_Config/Bunch/run_test.pl: TAO/tests/ORB_Local_Config/Bug_1459/run_test.pl: SSL !NO_DIOP !STATIC !ACE_FOR_TAO TAO/tests/ORB_Local_Config/Bug_2612/run_test.pl: !ST !STATIC !ACE_FOR_TAO @@ -38,14 +38,14 @@ TAO/tests/Collocation_Oneway_Tests/run_test.pl: !ST !NO_MESSAGING !CORBA_E_MICRO TAO/tests/Collocation_Exception_Test/run_test.pl: !ST TAO/tests/CollocationLockup/run_test.pl: !ST !DISABLE_ToFix_LynxOS_x86 !LabVIEW_RT !WinCE !FUZZ TAO/tests/OctetSeq/run_test.pl: !ACE_FOR_TAO -TAO/tests/OctetSeq/run_test1.pl: !STATIC !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ -TAO/tests/OctetSeq/run_test2.pl: !STATIC !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ +TAO/tests/OctetSeq/run_test1.pl: !STATIC !ACE_FOR_TAO +TAO/tests/OctetSeq/run_test2.pl: !STATIC !ACE_FOR_TAO TAO/tests/BiDirectional/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !GIOP10 !DISABLE_BIDIR !LynxOS TAO/tests/BiDirectional/run_test3557.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !GIOP10 !DISABLE_BIDIR !LynxOS TAO/tests/BiDirectional/run_test_ipv6.pl: IPV6 !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !GIOP10 !DISABLE_BIDIR TAO/tests/BiDirectional_NestedUpcall/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !GIOP10 !DISABLE_BIDIR !DISABLE_ToFix_LynxOS_PPC TAO/tests/BiDirectional_DelayedUpcall/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !GIOP10 !DISABLE_BIDIR !DISABLE_ToFix_LynxOS_PPC -TAO/tests/Leader_Followers/run_test.pl: !ST !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ +TAO/tests/Leader_Followers/run_test.pl: !ST !ACE_FOR_TAO TAO/tests/Leader_Followers/run_test_mt.pl: !ST !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ TAO/tests/Multiple_Inheritance/run_test.pl: !CORBA_E_MICRO TAO/tests/Bug_933_Regression/run_test.pl: @@ -62,7 +62,7 @@ TAO/tests/Bug_1020_Basic_Regression/run_test.pl -quick : !Win32 !MINIMUM !CORBA_ TAO/tests/Bug_1020_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !Win32 !QUICK !LabVIEW_RT !WinCE !FUZZ TAO/tests/Bug_1020_Regression/run_test.pl -quick : !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !Win32 QUICK !LabVIEW_RT !WinCE !FUZZ TAO/tests/Bug_1254_Regression/run_test.pl: -TAO/tests/Bug_1330_Regression/run_test.pl: !LabVIEW_RT !WinCE !FUZZ +TAO/tests/Bug_1330_Regression/run_test.pl: TAO/tests/Bug_1361_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !Win32 !IRIX !QUICK !LabVIEW_RT !WinCE !FUZZ TAO/tests/Bug_1361_Regression/run_test.pl -quick : !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !Win32 !IRIX QUICK !LabVIEW_RT !WinCE !FUZZ TAO/tests/Bug_1476_Test/run_test.pl: !NO_MESSAGING !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ @@ -212,7 +212,7 @@ TAO/tests/Hello/run_test.pl: TAO/tests/Objref_Sequence_Test/run_test.pl: TAO/tests/ICMG_Any_Bug/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO TAO/tests/LongDouble/run_test.pl: -TAO/tests/IPV6/run_test.pl: IPV6 !LabVIEW_RT !WinCE !FUZZ +TAO/tests/IPV6/run_test.pl: IPV6 TAO/tests/AlternateIIOP/run_test.pl: !DISABLE_ToFix_LynxOS_x86 !LabVIEW_RT !WinCE !FUZZ TAO/tests/Optimized_Connection/run_test.pl: !DISABLE_ToFix_LynxOS_x86 !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ TAO/tests/Cache_Growth_Test/run_test.pl: !LabVIEW_RT !WinCE !FUZZ @@ -241,7 +241,7 @@ TAO/tests/Crash_On_Write/run_test.pl: !ST !Win32 TAO/tests/Nested_Upcall_Crash/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !OpenVMS_IA64Crash !QUICK !LabVIEW_RT !WinCE !FUZZ TAO/tests/Nested_Upcall_Crash/run_test.pl -quick: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !OpenVMS_IA64Crash QUICK !LabVIEW_RT !WinCE !FUZZ TAO/tests/NestedUpcall/Simple/run_test.pl: !ST !LabVIEW_RT !WinCE !FUZZ -TAO/tests/NestedUpcall/MT_Client_Test/run_test.pl: !ST !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ +TAO/tests/NestedUpcall/MT_Client_Test/run_test.pl: !ST !CORBA_E_MICRO TAO/tests/NestedUpcall/Triangle_Test/run_test.pl: !CORBA_E_MICRO TAO/tests/Nested_Event_Loop/run_test.pl: !ACE_FOR_TAO TAO/tests/POA/Identity/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO @@ -289,7 +289,7 @@ TAO/tests/Timed_Buffered_Oneways/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E TAO/tests/Single_Read/run_test.pl: TAO/tests/Connection_Timeout/run_test.pl: !VxWorks !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO #TAO/tests/Connection_Failure/run_test.pl ! Timesout for good reasons -TAO/tests/MProfile_Connection_Timeout/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ +TAO/tests/MProfile_Connection_Timeout/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO TAO/tests/Codec/run_test.pl TAO/tests/Bug_1693_Test/run_test.pl TAO/tests/IDL_Test/run_test.pl: !NO_MESSAGING !CORBA_E_MICRO @@ -427,10 +427,10 @@ TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/run_test.pl: !MINIMUM !DIS TAO/DevGuideExamples/RTCORBA/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !STATIC TAO/DevGuideExamples/SmartProxies/run_test.pl: !NO_SMARTPROXIES !NO_MESSAGING !CORBA_E_MICRO TAO/DevGuideExamples/Multithreading/Reactive/run_test.pl: !STATIC !MINIMUM !LynxOS -TAO/DevGuideExamples/Multithreading/ThreadPerConnection/run_test.pl: !ST !LabVIEW_RT !WinCE !FUZZ !VxWorks !VxWorks_RTP -TAO/DevGuideExamples/Multithreading/ThreadPool/run_test.pl: !ST !MINIMUM !LabVIEW_RT !WinCE !FUZZ !VxWorks !VxWorks_RTP +TAO/DevGuideExamples/Multithreading/ThreadPerConnection/run_test.pl: !ST +TAO/DevGuideExamples/Multithreading/ThreadPool/run_test.pl: !ST !MINIMUM TAO/DevGuideExamples/ValueTypes/Messenger/run_test.pl: !MINIMUM !CORBA_E_MICRO TAO/DevGuideExamples/ValueTypes/Bank/run_test.pl: !MINIMUM !CORBA_E_MICRO TAO/DevGuideExamples/AMH/run_test.pl: !NO_MESSAGING !CORBA_E_MICRO -TAO/DevGuideExamples/AMH_AMI/run_test.pl: !NO_MESSAGING !LabVIEW_RT !WinCE !FUZZ !CORBA_E_MICRO !VxWorks !VxWorks_RTP +TAO/DevGuideExamples/AMH_AMI/run_test.pl: !NO_MESSAGING !CORBA_E_MICRO diff --git a/TAO/bin/tao_other_tests.lst b/TAO/bin/tao_other_tests.lst index eef1eee5847..11c7e9d2cbc 100644 --- a/TAO/bin/tao_other_tests.lst +++ b/TAO/bin/tao_other_tests.lst @@ -217,13 +217,13 @@ TAO/orbsvcs/tests/unit/Notify/MC/Statistic_Registry/run_test.pl: TAO/orbsvcs/tests/unit/Notify/MC/Statistic/run_test.pl: TAO/orbsvcs/tests/Notify/MC/run_test.pl: !ST !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/Simple_Naming/run_test_ipv6.pl: IPV6 !ST !SUNCC5_1 !NO_MESSAGING !ACE_FOR_TAO !LynxOS !CORBA_E_MICRO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/orbsvcs/DevGuideExamples/EventServices/OMG_Basic/run_test.pl: !MINIMUM !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/EventServices/OMG_SupplierSideEC/run_test.pl: !MINIMUM !NO_MESSAGING !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/EventServices/OMG_TypedEC/run_test.pl: !MINIMUM !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ !NO_IFR !LynxOS -TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Basic/run_test.pl: !NO_MESSAGING !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Federated/run_test.pl: !ST !NO_MESSAGING !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Filter/run_test.pl: !NO_MESSAGING !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_MCast_Federated/run_test.pl: !NO_MCAST !NO_MESSAGING !VxWorks !VxWorks_RTP !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ !LynxOS +TAO/orbsvcs/DevGuideExamples/EventServices/OMG_Basic/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS +TAO/orbsvcs/DevGuideExamples/EventServices/OMG_SupplierSideEC/run_test.pl: !MINIMUM !NO_MESSAGING !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS +TAO/orbsvcs/DevGuideExamples/EventServices/OMG_TypedEC/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !NO_IFR !LynxOS +TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Basic/run_test.pl: !NO_MESSAGING !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !LynxOS +TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Federated/run_test.pl: !ST !NO_MESSAGING !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !LynxOS +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 !VxWorks !VxWorks_RTP !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ !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 diff --git a/TAO/orbsvcs/DevGuideExamples/EventServices/OMG_Basic/run_test.pl b/TAO/orbsvcs/DevGuideExamples/EventServices/OMG_Basic/run_test.pl index a452c9efb65..153ca3624e2 100755 --- a/TAO/orbsvcs/DevGuideExamples/EventServices/OMG_Basic/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/EventServices/OMG_Basic/run_test.pl @@ -4,60 +4,144 @@ 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"); -$esiorfile = PerlACE::LocalFile ("es.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; +$status = 0; +$debug_level = '0'; -unlink $nsiorfile; -unlink $esiorfile; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -# start Naming Service +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 $s = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $c = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; + +my $nsiorfile = "ns.ior"; +my $esiorfile = "es.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $es_nsiorfile = $es->LocalFile ($nsiorfile); +my $s_nsiorfile = $s->LocalFile ($nsiorfile); +my $c_nsiorfile = $c->LocalFile ($nsiorfile); +my $es_esiorfile = $es->LocalFile ($esiorfile); +$ns->DeleteFile ($nsiorfile); +$es->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); +$c->DeleteFile ($nsiorfile); +$es->DeleteFile ($esiorfile); $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, "-ORBdebuglevel $debug_level ". + " -o $ns_nsiorfile"); +$EventService = "$ENV{TAO_ROOT}/orbsvcs/CosEvent_Service/CosEvent_Service"; +$ES = $es->CreateProcess ($EventService, " -o $es_esiorfile ". + "-ORBInitRef NameService=file://$es_nsiorfile"); +$S = $ns->CreateProcess ("EchoEventSupplier", "-ORBInitRef NameService=file://$s_nsiorfile"); +$C = $ns->CreateProcess ("EchoEventConsumer", "-ORBInitRef NameService=file://$c_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 ($es->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$es_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($s->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$s_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($c->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$c_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } + # start Event Service -$EventService = "$ENV{TAO_ROOT}/orbsvcs/CosEvent_Service/CosEvent_Service"; -$ES = new PerlACE::Process($EventService, "-o $esiorfile $arg_ns_ref"); -$ES->Spawn(); -if (PerlACE::waitforfile_timed ($esiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$esiorfile>\n"; - $ES->Kill(); - unlink $nsiorfile; +$ES_status = $ES->Spawn (); + +if ($ES_status != 0) { + print STDERR "ERROR: Event Service returned $ES_status\n"; + exit 1; +} + +if ($es->WaitForFileTimed ($esiorfile,$es->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$es_esiorfile>\n"; + $ES->Kill (); $ES->TimedWait (1); exit 1; } # start EchoEventSupplier -$S = new PerlACE::Process("EchoEventSupplier", $arg_ns_ref); -$S->Spawn(); +$S_status = $S->Spawn (); + +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; + exit 1; +} # start EchoEventConsumer -$C = new PerlACE::Process("EchoEventConsumer", $arg_ns_ref); -$C->Spawn(); +$C_status = $C->Spawn (); + +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + exit 1; +} + +$C_status = $C->WaitKill ($c->ProcessStopWaitInterval()+45); + +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + $status = 1; +} -$CRET = $C->WaitKill(60); -$S->Kill(); -$NS->Kill(); -$ES->Kill(); +$S_status = $S->TerminateWaitKill ($s->ProcessStopWaitInterval()); -unlink $nsiorfile; -unlink $esiorfile; +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; + $status = 1; +} + +$ES_status = $ES->TerminateWaitKill ($es->ProcessStopWaitInterval()); -if ($CRET != 0) { - print STDERR "ERROR: Client returned <$CRET>\n"; - exit 1 ; -} +if ($ES_status != 0) { + print STDERR "ERROR: Event Service returned $ES_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); +$es->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); +$c->DeleteFile ($nsiorfile); +$es->DeleteFile ($esiorfile); +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/EventServices/OMG_SupplierSideEC/run_test.pl b/TAO/orbsvcs/DevGuideExamples/EventServices/OMG_SupplierSideEC/run_test.pl index dea4d416326..d58b9480936 100755 --- a/TAO/orbsvcs/DevGuideExamples/EventServices/OMG_SupplierSideEC/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/EventServices/OMG_SupplierSideEC/run_test.pl @@ -4,44 +4,109 @@ 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; -$iorfile = PerlACE::LocalFile ("ns.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$iorfile"; +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; -unlink $iorfile; +$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 $s = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $c = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; + +my $iorfile = "ns.ior"; + +my $ns_iorfile = $ns->LocalFile ($iorfile); +my $s_iorfile = $s->LocalFile ($iorfile); +my $c_iorfile = $c->LocalFile ($iorfile); +$ns->DeleteFile ($iorfile); +$s->DeleteFile ($iorfile); +$c->DeleteFile ($iorfile); -# start Naming Service $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $iorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($iorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $NS->Kill(); +$NS = $ns->CreateProcess ($NameService, "-ORBdebuglevel $debug_level ". + " -o $ns_iorfile"); +$S = $ns->CreateProcess ("EchoEventSupplier", "-ORBInitRef NameService=file://$s_iorfile"); +$C = $ns->CreateProcess ("EchoEventConsumer", "-ORBInitRef NameService=file://$c_iorfile"); + +# 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 ($iorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_iorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } +if ($ns->GetFile ($iorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_iorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($s->PutFile ($iorfile) == -1) { + print STDERR "ERROR: cannot set file <$s_iorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($c->PutFile ($iorfile) == -1) { + print STDERR "ERROR: cannot set file <$c_iorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + + # start EchoEventSupplier -$S = new PerlACE::Process("EchoEventSupplier", $arg_ns_ref); -$S->Spawn(); +$S_status = $S->Spawn (); + +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; + exit 1; +} # start EchoEventConsumer -$C = new PerlACE::Process("EchoEventConsumer", $arg_ns_ref); -$CRET = $C->SpawnWaitKill(60); +$C_status = $C->Spawn (); -$S->Kill(); -$NS->Kill(); +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + exit 1; +} + +$C_status = $C->WaitKill ($c->ProcessStopWaitInterval()+45); -unlink $iorfile; +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + $status = 1; +} -if ($CRET != 0) { - print STDERR "ERROR: Client returned <$CRET>\n"; - exit 1 ; -} +$S_status = $S->TerminateWaitKill ($s->ProcessStopWaitInterval()); +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_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; +} -exit 0; +$ns->DeleteFile ($iorfile); +$s->DeleteFile ($iorfile); +$c->DeleteFile ($iorfile); +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/EventServices/OMG_TypedEC/run_test.pl b/TAO/orbsvcs/DevGuideExamples/EventServices/OMG_TypedEC/run_test.pl index 3089a483280..48885aed884 100755 --- a/TAO/orbsvcs/DevGuideExamples/EventServices/OMG_TypedEC/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/EventServices/OMG_TypedEC/run_test.pl @@ -4,93 +4,221 @@ 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"); -$ifriorfile = PerlACE::LocalFile ("ifr.ior"); -$esiorfile = PerlACE::LocalFile ("es.ior"); -$consiorfile = PerlACE::LocalFile ("Consumer.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -$arg_ifr_ref = "-ORBInitRef InterfaceRepository=file://$ifriorfile"; - -unlink $nsiorfile; -unlink $ifriorfile; -unlink $esiorfile; -unlink $consiorfile; +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 $ifr= PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $ti = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $ns = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $es = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $c = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; +my $s = PerlACE::TestTarget::create_target (6) || die "Create target 6 failed\n"; + +my $nsiorfile = "ns.ior"; +my $ifriorfile = "ifr.ior"; +my $esiorfile = "es.ior"; +my $consiorfile = "Consumer.ior"; +my $idlfile = "Messenger.idl"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $es_esiorfile = $es->LocalFile ($esiorfile); +my $ifr_ifriorfile = $ifr->LocalFile ($ifriorfile); +my $c_consiorfile = $c->LocalFile ($consiorfile); +my $ti_ifriorfile = $ti->LocalFile ($ifriorfile); +my $es_nsiorfile = $es->LocalFile ($nsiorfile); +my $es_ifriorfile = $es->LocalFile ($ifriorfile); +my $c_nsiorfile = $c->LocalFile ($nsiorfile); +my $s_nsiorfile = $s->LocalFile ($nsiorfile); +$ns->DeleteFile ($nsiorfile); +$es->DeleteFile ($esiorfile); +$ifr->DeleteFile ($ifriorfile); +$c->DeleteFile ($consiorfile); +$ti->DeleteFile ($ifriorfile); +$es->DeleteFile ($nsiorfile); +$es->DeleteFile ($ifriorfile); +$c->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); + -# start the Interface Repository Service $IFRService = "$ENV{TAO_ROOT}/orbsvcs/IFR_Service/IFR_Service"; -$IF = new PerlACE::Process ($IFRService, "-o $ifriorfile"); -$IF->Spawn (); -if (PerlACE::waitforfile_timed ($ifriorfile, 15) == -1) { - print STDERR "ERROR: cannot find file <$ifriorfile>\n"; - $IF->Kill (); +$IF = $ifr->CreateProcess ($IFRService, "-ORBdebuglevel $debug_level ". + "-o $ifr_ifriorfile"); +$TAO_IFR = "$ENV{ACE_ROOT}/bin/tao_ifr"; +$TI = $ti->CreateProcess ($TAO_IFR, "-ORBInitRef InterfaceRepository=file://$ti_ifriorfile ". + "$idlfile"); +$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; +$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile"); +$EventService = "$ENV{TAO_ROOT}/orbsvcs/CosEvent_Service/CosEvent_Service"; +$ES = $es->CreateProcess ($EventService, " -t -o $es_esiorfile ". + "-ORBInitRef NameService=file://$es_nsiorfile ". + "-ORBInitRef InterfaceRepository=file://$es_ifriorfile "); +$C = $c->CreateProcess ("Consumer", "-ORBInitRef NameService=file://$c_nsiorfile"); +$S = $s->CreateProcess ("Supplier", "-ORBInitRef NameService=file://$s_nsiorfile"); + + +# start the Interface Repository Service +$IF_status = $IF->Spawn (); + +if ($IF_status != 0) { + print STDERR "ERROR: Interface Repository returned $IF_status\n"; + exit 1; +} + +if ($ifr->WaitForFileTimed ($ifriorfile,$ifr->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ifr_ifriorfile>\n"; + $IF->Kill (); $IF->TimedWait (1); + exit 1; +} + +if ($ifr->GetFile ($ifriorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ifr_ifriorfile>\n"; + $IF->Kill (); $IF->TimedWait (1); + exit 1; +} +if ($ti->PutFile ($ifriorfile) == -1) { + print STDERR "ERROR: cannot set file <$ti_ifriorfile>\n"; + $IF->Kill (); $IF->TimedWait (1); + exit 1; +} +if ($es->PutFile ($ifriorfile) == -1) { + print STDERR "ERROR: cannot set file <$es_ifriorfile>\n"; + $IF->Kill (); $IF->TimedWait (1); exit 1; } # load the IFR with the Messenger interface info -$TAO_IFR = "$ENV{ACE_ROOT}/bin/tao_ifr"; -$TI = new PerlACE::Process ($TAO_IFR, - "$arg_ifr_ref Messenger.idl"); -$TI->SpawnWaitKill (60); +$TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval()+45); + +if ($TI_status != 0) { + print STDERR "ERROR: tao_ifr returned $TI_status\n"; + $IF->Kill (); $IF->TimedWait (1); + exit 1; +} # 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(); - $IF->Kill (); +$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); + $IF->Kill (); $IF->TimedWait (1); + exit 1; +} + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $IF->Kill (); $IF->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($es->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$es_nsiorfile>\n"; + $IF->Kill (); $IF->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($c->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$c_nsiorfile>\n"; + $IF->Kill (); $IF->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($s->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$s_nsiorfile>\n"; + $IF->Kill (); $IF->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); exit 1; } # start Event Service -$EventService = "$ENV{TAO_ROOT}/orbsvcs/CosEvent_Service/CosEvent_Service"; -$ES = new PerlACE::Process($EventService, - "-t -o $esiorfile $arg_ns_ref $arg_ifr_ref"); -$ES->Spawn(); -if (PerlACE::waitforfile_timed ($esiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$esiorfile>\n"; - $ES->Kill(); - $NS->Kill (); - $IF->Kill (); - unlink $nsiorfile; +$ES_status = $ES->Spawn (); + +if ($ES_status != 0) { + print STDERR "ERROR: Event Service returned $ES_status\n"; + exit 1; +} + +if ($es->WaitForFileTimed ($esiorfile,$es->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$es_esiorfile>\n"; + $ES->Kill (); $ES->TimedWait (1); + $NS->Kill (); $NS->TimedWait (1); + $IF->Kill (); $IF->TimedWait (1); exit 1; } # start Consumer -$C = new PerlACE::Process("Consumer", "$arg_ns_ref"); -$C->Spawn(); -if (PerlACE::waitforfile_timed ($consiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$consiorfile>\n"; - $ES->Kill(); - $NS->Kill (); - $IF->Kill (); - $C->Kill (); +$C_status = $C->Spawn (); + +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; exit 1; } # start Supplier -$S = new PerlACE::Process("Supplier", "$arg_ns_ref"); -$S->Spawn(); +$S_status = $S->Spawn (); + +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; + exit 1; +} + +$C_status = $C->WaitKill ($c->ProcessStopWaitInterval()+45); + +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + $status = 1; +} + +$S_status = $S->TerminateWaitKill ($s->ProcessStopWaitInterval()); -$CRET = $C->WaitKill(60); -$S->Kill(); -$NS->Kill(); -$ES->Kill(); -$IF->Kill(); +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; + $status = 1; +} + +$ES_status = $ES->TerminateWaitKill ($es->ProcessStopWaitInterval()); + +if ($ES_status != 0) { + print STDERR "ERROR: Event Service returned $ES_status\n"; + $status = 1; +} -unlink $nsiorfile; -unlink $ifriorfile; -unlink $esiorfile; -unlink $consiorfile; +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); -if ($CRET != 0) { - print STDERR "ERROR: Client returned <$CRET>\n"; - exit 1 ; +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; } -exit 0; +$IF_status = $IF->TerminateWaitKill ($ifr->ProcessStopWaitInterval()); + +if ($IF_status != 0) { + print STDERR "ERROR: Interface Repository returned $IF_status\n"; + $status = 1; +} + +$ns->DeleteFile ($nsiorfile); +$es->DeleteFile ($esiorfile); +$ifr->DeleteFile ($ifriorfile); +$c->DeleteFile ($consiorfile); +$ti->DeleteFile ($ifriorfile); +$es->DeleteFile ($nsiorfile); +$es->DeleteFile ($ifriorfile); +$c->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); + +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Basic/run_test.pl b/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Basic/run_test.pl index 4a256b9dbef..fb32874d788 100755 --- a/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Basic/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Basic/run_test.pl @@ -4,59 +4,144 @@ 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"); -$esiorfile = PerlACE::LocalFile ("es.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; +$status = 0; +$debug_level = '0'; -unlink $nsiorfile; -unlink $esiorfile; +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 $s = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $c = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; + +my $nsiorfile = "ns.ior"; +my $esiorfile = "es.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $es_nsiorfile = $es->LocalFile ($nsiorfile); +my $s_nsiorfile = $s->LocalFile ($nsiorfile); +my $c_nsiorfile = $c->LocalFile ($nsiorfile); +my $es_esiorfile = $es->LocalFile ($esiorfile); +$ns->DeleteFile ($nsiorfile); +$es->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); +$c->DeleteFile ($nsiorfile); +$es->DeleteFile ($esiorfile); -# 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, "-ORBdebuglevel $debug_level ". + " -o $ns_nsiorfile"); +$EventService = "$ENV{TAO_ROOT}/orbsvcs/Event_Service/Event_Service"; +$ES = $es->CreateProcess ($EventService, " -o $es_esiorfile ". + "-ORBInitRef NameService=file://$es_nsiorfile"); +$S = $ns->CreateProcess ("EchoEventSupplier", "-ORBInitRef NameService=file://$s_nsiorfile"); +$C = $ns->CreateProcess ("EchoEventConsumer", "-ORBInitRef NameService=file://$c_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 ($es->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$es_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($s->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$s_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($c->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$c_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } + # start Event Service -$EventService = "$ENV{TAO_ROOT}/orbsvcs/Event_Service/Event_Service"; -$ES = new PerlACE::Process($EventService, "-o $esiorfile $arg_ns_ref"); -$ES->Spawn(); -if (PerlACE::waitforfile_timed ($esiorfile, 15) == -1) { - print STDERR "ERROR: cannot find file <$esiorfile>\n"; - $ES->Kill(); - unlink $nsiorfile; +$ES_status = $ES->Spawn (); + +if ($ES_status != 0) { + print STDERR "ERROR: Event Service returned $ES_status\n"; + exit 1; +} + +if ($es->WaitForFileTimed ($esiorfile,$es->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$es_esiorfile>\n"; + $ES->Kill (); $ES->TimedWait (1); exit 1; } # start EchoEventSupplier -$S = new PerlACE::Process("EchoEventSupplier", $arg_ns_ref); -$S->Spawn(); +$S_status = $S->Spawn (); + +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; + exit 1; +} # start EchoEventConsumer -$C = new PerlACE::Process("EchoEventConsumer", $arg_ns_ref); -$CRET = $C->SpawnWaitKill(60); +$C_status = $C->Spawn (); -$S->Kill(); -$NS->Kill(); -$ES->Kill(); +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + exit 1; +} + +$C_status = $C->WaitKill ($c->ProcessStopWaitInterval()+45); + +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + $status = 1; +} -unlink $nsiorfile; -unlink $esiorfile; +$S_status = $S->TerminateWaitKill ($s->ProcessStopWaitInterval()); -if ($CRET != 0) { - print STDERR "ERROR: Client returned <$CRET>\n"; - exit 1 ; -} +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; + $status = 1; +} + +$ES_status = $ES->TerminateWaitKill ($es->ProcessStopWaitInterval()); +if ($ES_status != 0) { + print STDERR "ERROR: Event Service returned $ES_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); +$es->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); +$c->DeleteFile ($nsiorfile); +$es->DeleteFile ($esiorfile); +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Federated/run_test.pl b/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Federated/run_test.pl index 59a8f65a7e6..8dd897e8579 100755 --- a/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Federated/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Federated/run_test.pl @@ -4,93 +4,194 @@ 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; -$iorfile = PerlACE::LocalFile ("ns.ior"); -$ec1iorfile = PerlACE::LocalFile ("ec1.ior"); -$ec2iorfile = PerlACE::LocalFile ("ec2.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$iorfile"; +$status = 0; +$debug_level = '0'; -unlink $iorfile; -unlink $ec1iorfile; -unlink $ec2iorfile; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $s1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $s2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $c1 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $c2 = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; + +my $nsiorfile = "ns.ior"; +my $ec1iorfile = "ec1.ior"; +my $ec2iorfile = "ec2.ior"; +my $supplier_conf_file = ""; +if ( -e "supplier.conf" ) { + $supplier_conf_file = "supplier.conf"; +} +else{ + $supplier_conf_file = "../supplier.conf"; +} + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $s1_ec1iorfile = $s1->LocalFile ($ec1iorfile); +my $s2_ec2iorfile = $s2->LocalFile ($ec2iorfile); +my $s1_nsiorfile = $s1->LocalFile ($nsiorfile); +my $s2_nsiorfile = $s2->LocalFile ($nsiorfile); +my $c1_nsiorfile = $c1->LocalFile ($nsiorfile); +my $c2_nsiorfile = $c2->LocalFile ($nsiorfile); +$ns->DeleteFile ($nsiorfile); +$s1->DeleteFile ($ec1iorfile); +$s2->DeleteFile ($ec2iorfile); +$s1->DeleteFile ($nsiorfile); +$s2->DeleteFile ($nsiorfile); +$c1->DeleteFile ($nsiorfile); +$c2->DeleteFile ($nsiorfile); -# start Naming Service $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $iorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($iorfile, 10) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $NS->Kill(); +$NS = $ns->CreateProcess ($NameService, "-ORBdebuglevel $debug_level ". + " -o $ns_nsiorfile"); +$args1 = "-ORBSvcConf $supplier_conf_file -ecname ec1 -gateway ec2"; +$S1 = $s1->CreateProcess ("EchoEventSupplier", "-ORBInitRef NameService=file://$s1_nsiorfile ". + "$args1 ". + "-iorfile $s1_ec1iorfile"); +$args2 = "-ORBSvcConf $supplier_conf_file -ecname ec2 -gateway ec1"; +$S2 = $s2->CreateProcess ("EchoEventSupplier", "-ORBInitRef NameService=file://$s2_nsiorfile ". + "$args2 ". + "-iorfile $s2_ec2iorfile"); +$args3 = "-ecname ec1"; +$C1 = $c1->CreateProcess ("EchoEventConsumer", "-ORBInitRef NameService=file://$c1_nsiorfile ". + "$args3"); +$args4 = "-ecname ec2"; +$C2 = $c2->CreateProcess ("EchoEventConsumer", "-ORBInitRef NameService=file://$c2_nsiorfile ". + "$args4"); + + +# 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 ($s1->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$s1_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($s2->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$s2_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($c1->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$c1_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($c2->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$c2_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } # start Supplier -if ( -e "supplier.conf" ) -{ - $supplier_conf_file = "supplier.conf"; +$S1_status = $S1->Spawn (); + +if ($S1_status != 0) { + print STDERR "ERROR: Supplier1 returned $S1_status\n"; + exit 1; } -else{ - $supplier_conf_file = "../supplier.conf"; + +$S2_status = $S2->Spawn (); + +if ($S2_status != 0) { + print STDERR "ERROR: Supplier2 returned $S2_status\n"; + exit 1; +} + +if ($s1->WaitForFileTimed ($ec1iorfile, $s1->ProcessStartWaitInterval()+60) == -1) { + print STDERR "ERROR: cannot find file <$s1_ec1iorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $S1->Kill (); $S1->TimedWait (1); + exit 1; +} + +if ($s2->WaitForFileTimed ($ec2iorfile, $s2->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$s2_ec2iorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $S1->Kill (); $S1->TimedWait (1); + $S2->Kill (); $S2->TimedWait (1); + exit 1; } -$args1 = "-ORBSvcConf $supplier_conf_file -ecname ec1 -gateway ec2 -iorfile $ec1iorfile"; -$S1 = new PerlACE::Process("EchoEventSupplier", "$arg_ns_ref $args1"); -$S1->Spawn(); -$args2 = "-ORBSvcConf $supplier_conf_file -ecname ec2 -gateway ec1 -iorfile $ec2iorfile"; -$S2 = new PerlACE::Process("EchoEventSupplier", "$arg_ns_ref $args2"); -$S2->Spawn(); +$C1_status = $C1->Spawn (); -if ((PerlACE::waitforfile_timed ($ec1iorfile, 15) == -1) || - (PerlACE::waitforfile_timed ($ec2iorfile, 2) == -1)) { - print STDERR "ERROR: cannot find files <$ec1iorfile> and <$ec2iorfile>\n"; - $NS->Kill(); - $S1->Kill(); - $S2->Kill(); +if ($C1_status != 0) { + print STDERR "ERROR: Consumer returned $C1_status\n"; exit 1; } -$args3 = "-ecname ec1"; -$C1 = new PerlACE::Process("EchoEventConsumer", "$arg_ns_ref $args3"); -$C1->Spawn(); +$C2_status = $C2->Spawn (); -$args4 = "-ecname ec2"; -$C2 = new PerlACE::Process("EchoEventConsumer", "$arg_ns_ref $args4"); -$C2->Spawn(); +if ($C2_status != 0) { + print STDERR "ERROR: Consumer returned $C2_status\n"; + exit 1; +} + +$C1_status = $C1->WaitKill ($c1->ProcessStopWaitInterval()+45); + +if ($C1_status != 0) { + print STDERR "ERROR: Consumer1 returned $C1_status\n"; + $status = 1; +} -if ($C1->WaitKill(60) == -1) { - print STDERR "consumer1 timedout \n"; +$C2_status = $C2->WaitKill ($c2->ProcessStopWaitInterval()); - $C2->Kill(); - $S1->Kill(); - $S2->Kill(); - $NS->Kill(); +if ($C2_status != 0) { + print STDERR "ERROR: Consumer2 returned $C2_status\n"; + $status = 1; +} - unlink $iorfile; +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); - exit 1; +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; } -if ($C2->WaitKill(10) == -1) { - print STDERR "consumer2 timedout \n"; +$S1_status = $S1->TerminateWaitKill ($s1->ProcessStopWaitInterval()); - $S1->Kill(); - $S2->Kill(); - $NS->Kill(); +if ($S1_status != 0) { + print STDERR "ERROR: Supplier1 returned $S1_status\n"; + $status = 1; +} - unlink $iorfile; +$S2_status = $S2->TerminateWaitKill ($s2->ProcessStopWaitInterval()); - exit 1; +if ($S2_status != 0) { + print STDERR "ERROR: Supplier2 returned $S2_status\n"; + $status = 1; } - -$NS->Kill(); -$S1->Kill(); -$S2->Kill(); -unlink $iorfile; -unlink $ec1iorfile; -unlink $ec2iorfile; +$ns->DeleteFile ($nsiorfile); +$s1->DeleteFile ($ec1iorfile); +$s2->DeleteFile ($ec2iorfile); +$s1->DeleteFile ($nsiorfile); +$s2->DeleteFile ($nsiorfile); +$c1->DeleteFile ($nsiorfile); +$c2->DeleteFile ($nsiorfile); -exit 0; +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Filter/run_test.pl b/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Filter/run_test.pl index 204135e8346..62a7da11bbc 100755 --- a/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Filter/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_Filter/run_test.pl @@ -4,60 +4,146 @@ 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"); -$esiorfile = PerlACE::LocalFile ("es.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; +$status = 0; +$debug_level = '0'; -unlink $nsiorfile; -unlink $esiorfile; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -# start Naming Service +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 $s = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $c = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; + +my $nsiorfile = "ns.ior"; +my $esiorfile = "es.ior"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $es_nsiorfile = $es->LocalFile ($nsiorfile); +my $s_nsiorfile = $s->LocalFile ($nsiorfile); +my $c_nsiorfile = $c->LocalFile ($nsiorfile); +my $es_esiorfile = $es->LocalFile ($esiorfile); +$ns->DeleteFile ($nsiorfile); +$es->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); +$c->DeleteFile ($nsiorfile); +$es->DeleteFile ($esiorfile); $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, "-ORBdebuglevel $debug_level ". + " -o $ns_nsiorfile"); +$EventService = "$ENV{TAO_ROOT}/orbsvcs/Event_Service/Event_Service"; +$ES = $es->CreateProcess ($EventService, "-ORBdebuglevel $debug_level ". + " -o $es_esiorfile ". + "-ORBInitRef NameService=file://$es_nsiorfile"); +$S = $ns->CreateProcess ("EchoEventSupplier", "-ORBInitRef NameService=file://$s_nsiorfile"); +$C = $ns->CreateProcess ("EchoEventConsumer", "-ORBInitRef NameService=file://$c_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 ($es->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$es_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($s->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$s_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($c->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$c_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + + # start Event Service -$EventService = "$ENV{TAO_ROOT}/orbsvcs/Event_Service/Event_Service"; -$ES = new PerlACE::Process($EventService, "-o $esiorfile $arg_ns_ref"); -$ES->Spawn(); -if (PerlACE::waitforfile_timed ($esiorfile, 15) == -1) { - print STDERR "ERROR: cannot find file <$esiorfile>\n"; - $ES->Kill(); - unlink $nsiorfile; +$ES_status = $ES->Spawn (); + +if ($ES_status != 0) { + print STDERR "ERROR: Event Service returned $ES_status\n"; + exit 1; +} + +if ($es->WaitForFileTimed ($esiorfile,$es->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$es_esiorfile>\n"; + $ES->Kill (); $ES->TimedWait (1); exit 1; } # start EchoEventSupplier -$S = new PerlACE::Process("EchoEventSupplier", $arg_ns_ref); -$S->Spawn(); +$S_status = $S->Spawn (); + +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; + exit 1; +} # start EchoEventConsumer -$C = new PerlACE::Process("EchoEventConsumer", $arg_ns_ref); -$C->Spawn(); +$C_status = $C->Spawn (); + +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + exit 1; +} + +$C_status = $C->WaitKill ($c->ProcessStopWaitInterval()+45); + +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + $status = 1; +} + +$S_status = $S->TerminateWaitKill ($s->ProcessStopWaitInterval()); -$CRET = $C->WaitKill(60); -$S->Kill(); -$NS->Kill(); -$ES->Kill(); +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; + $status = 1; +} + +$ES_status = $ES->TerminateWaitKill ($es->ProcessStopWaitInterval()); -unlink $nsiorfile; -unlink $esiorfile; +if ($ES_status != 0) { + print STDERR "ERROR: Event Service returned $ES_status\n"; + $status = 1; +} -if ($CRET != 0) { - print STDERR "ERROR: Client returned <$CRET>\n"; - exit 1 ; -} +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + $status = 1; +} -exit 0; +$ns->DeleteFile ($nsiorfile); +$es->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); +$c->DeleteFile ($nsiorfile); +$es->DeleteFile ($esiorfile); +exit $status; diff --git a/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_MCast_Federated/run_test.pl b/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_MCast_Federated/run_test.pl index 3c66425f182..8ddace59c15 100755 --- a/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_MCast_Federated/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_MCast_Federated/run_test.pl @@ -4,143 +4,248 @@ 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; if (!defined $ENV{TAO_ROOT}) { - $ENV{TAO_ROOT} = "$ENV{ACE_ROOT}/TAO"; + $ENV{TAO_ROOT} = "$ENV{ACE_ROOT}/TAO"; } sub usage() { - print "Usage:\n"; - print " run_test [-h] [-debug]\n\n"; - print " -udp -- Federate using udp\n"; - print " -mcast -- Federate using multicast (the default)\n"; - print " -h -- Prints this information\n"; - print " -debug -- Sets the debug flag for the test\n"; - exit; + print "Usage:\n"; + print " run_test [-h] [-debug]\n\n"; + print " -udp -- Federate using udp\n"; + print " -mcast -- Federate using multicast (the default)\n"; + print " -h -- Prints this information\n"; + print " -debug -- Sets the debug flag for the test\n"; + exit; } my $udp = 0; my $i = 0; my $flags = ""; while ($i <= $#ARGV) { - if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-help" || - $ARGV[$i] eq "--help" || $ARGV[$i] eq "-?") { - usage (); - } elsif ($ARGV[$i] eq "-debug") { - $flags .= " -ORBDebugLevel 10 "; - } elsif ($ARGV[$i] eq "-udp") { - $udp = 1; - } elsif ($ARGV[$i] eq "-mcast") { - $udp = 0; - } else { - print "ERROR: Unknown Option: ".$ARGV[$i]."\n\n"; - usage (); - } - $i++; + if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-help" || + $ARGV[$i] eq "--help" || $ARGV[$i] eq "-?") { + usage (); + } elsif ($ARGV[$i] eq "-debug") { + $flags .= " -ORBDebugLevel 10 "; + } elsif ($ARGV[$i] eq "-udp") { + $udp = 1; + } elsif ($ARGV[$i] eq "-mcast") { + $udp = 0; + } else { + print "ERROR: Unknown Option: ".$ARGV[$i]."\n\n"; + usage (); + } + $i++; +} + +if ($udp) { + print "Using UDP to link the event channels.\n\n"; +} else { + print "Using multicast to link the event channels.\n\n"; +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $s1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $s2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $c1 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $c2 = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; + +my $nsiorfile = "ns.ior"; +my $ec1iorfile = "ec1.ior"; +my $ec2iorfile = "ec2.ior"; +my $supplier_conf_file = ""; +if ( -e "supplier.conf" ) { + $supplier_conf_file = "supplier.conf"; +} +else{ + $supplier_conf_file = "../supplier.conf"; } +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $s1_ec1iorfile = $s1->LocalFile ($ec1iorfile); +my $s2_ec2iorfile = $s2->LocalFile ($ec2iorfile); +my $s1_nsiorfile = $s1->LocalFile ($nsiorfile); +my $s2_nsiorfile = $s2->LocalFile ($nsiorfile); +my $c1_nsiorfile = $c1->LocalFile ($nsiorfile); +my $c2_nsiorfile = $c2->LocalFile ($nsiorfile); +$ns->DeleteFile ($nsiorfile); +$s1->DeleteFile ($ec1iorfile); +$s2->DeleteFile ($ec2iorfile); +$s1->DeleteFile ($nsiorfile); +$s2->DeleteFile ($nsiorfile); +$c1->DeleteFile ($nsiorfile); +$c2->DeleteFile ($nsiorfile); + +my $ns_hostname = $ns->HostName(); +my $s1_hostname = $s1->HostName(); +my $s2_hostname = $s2->HostName(); +my $c1_hostname = $c1->HostName(); +my $c2_hostname = $c2->HostName(); +my $ns_port = $ns->RandomPort(); + +$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; +$NS = $ns->CreateProcess ($NameService, "$flags ". + " -o $ns_nsiorfile ". + "-ORBListenEndpoints iiop://$ns_hostname:$ns_port"); + +my($port1) = $s1->RandomPort() ; +my($port2) = $s1->RandomPort() ; +my($mport) = $s1->RandomPort() ; + +$args1 = "$flags -ORBInitRef NameService=file://$s1_nsiorfile -ORBSvcConf $supplier_conf_file -ORBListenEndpoints iiop://$s1_hostname -iorfile $s1_ec1iorfile"; +if ($udp) { + $args1 .= " -udp -ecname ec1 -port $port1 -listenport $port2 "; +} else { + $args1 .= " -ecname ec1 -address 224.9.9.2 -port $mport "; +} +$S1 = $s1->CreateProcess ("EchoEventSupplier", "$args1"); + + +$args2 = "$flags -ORBInitRef NameService=file://$s2_nsiorfile -ORBSvcConf $supplier_conf_file -ORBListenEndpoints iiop://$s2_hostname -iorfile $s2_ec2iorfile"; if ($udp) { - print "Using UDP to link the event channels.\n\n"; + $args2 .= " -udp -ecname ec2 -port $port2 -listenport $port1 "; } else { - print "Using multicast to link the event channels.\n\n"; + $args2 .= " -ecname ec2 -address 224.9.9.2 -port $mport "; } +$S2 = $s2->CreateProcess ("EchoEventSupplier", "$args2"); -$nsiorfile = PerlACE::LocalFile ("ns.ior"); -$ec1iorfile = PerlACE::LocalFile ("ec1.ior"); -$ec2iorfile = PerlACE::LocalFile ("ec2.ior"); +$args3 = "$flags -ORBInitRef NameService=file://$c1_nsiorfile -ecname ec1 -ORBListenEndpoints iiop://$c1_hostname"; +$C1 = $c1->CreateProcess ("EchoEventConsumer", "$args3"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -$end_point = "-ORBListenEndpoints iiop://localhost"; -$ns_port = PerlACE::random_port(); -unlink $nsiorfile; -unlink $ec1iorfile; -unlink $ec2iorfile; +$args4 = "$flags -ORBInitRef NameService=file://$c2_nsiorfile -ecname ec2 -ORBListenEndpoints iiop://$c2_hostname"; +$C2 = $c2->CreateProcess ("EchoEventConsumer", "$args4"); # start Naming Service +$NS_status = $NS->Spawn (); -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "$flags -o $nsiorfile $end_point:$ns_port"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$nsiorfile>\n"; - $NS->Kill(); +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; exit 1; } -# start EchoEventSupplier -my($port1) = 10001 + PerlACE::uniqueid() ; -my($port2) = 10001 + PerlACE::uniqueid() ; -my($mport) = 10001 + PerlACE::uniqueid() ; -if ( -e "supplier.conf" ) -{ - $supplier_conf_file = "supplier.conf"; +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; } -else{ - $supplier_conf_file = "../supplier.conf"; + +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($s1->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$s1_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($s2->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$s2_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($c1->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$c1_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($c2->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$c2_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; } -$args1 = "$flags $arg_ns_ref -ORBSvcConf $supplier_conf_file $end_point -iorfile $ec1iorfile"; -if ($udp) { - $args1 .= " -udp -ecname ec1 -port $port1 -listenport $port2 "; -} else { - $args1 .= " -ecname ec1 -address 224.9.9.2 -port $mport "; +# start EchoEventSupplier +$S1_status = $S1->Spawn (); + +if ($S1_status != 0) { + print STDERR "ERROR: Supplier1 returned $S1_status\n"; + exit 1; } -$S1 = new PerlACE::Process("EchoEventSupplier", $args1); -$S1->Spawn(); -$args2 = "$flags $arg_ns_ref -ORBSvcConf $supplier_conf_file $end_point -iorfile $ec2iorfile"; -if ($udp) { - $args2 .= " -udp -ecname ec2 -port $port2 -listenport $port1 "; -} else { - $args2 .= " -ecname ec2 -address 224.9.9.2 -port $mport "; +$S2_status = $S2->Spawn (); + +if ($S2_status != 0) { + print STDERR "ERROR: Supplier2 returned $S2_status\n"; + exit 1; } -$S2 = new PerlACE::Process("EchoEventSupplier", $args2); -$S2->Spawn(); -if ((PerlACE::waitforfile_timed ($ec1iorfile, 15) == -1) || - (PerlACE::waitforfile_timed ($ec2iorfile, 2) == -1)) { - print STDERR "ERROR: cannot find files <$ec1iorfile> and <$ec2iorfile>\n"; - $NS->Kill(); - $S1->Kill(); - $S2->Kill(); +if ($s1->WaitForFileTimed ($ec1iorfile, $s1->ProcessStartWaitInterval()+60) == -1) { + print STDERR "ERROR: cannot find file <$s1_ec1iorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $S1->Kill (); $S1->TimedWait (1); exit 1; } -$args3 = "$flags $arg_ns_ref -ecname ec1 $end_point"; -$C1 = new PerlACE::Process("EchoEventConsumer", $args3); -$C1->Spawn(); +if ($s2->WaitForFileTimed ($ec2iorfile, $s2->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$s2_ec2iorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + $S1->Kill (); $S1->TimedWait (1); + $S2->Kill (); $S2->TimedWait (1); + exit 1; +} +$C1_status = $C1->Spawn (); -$args4 = "$flags $arg_ns_ref -ecname ec2 $end_point"; -$C2 = new PerlACE::Process("EchoEventConsumer", $args4); -$C2->Spawn(); +if ($C1_status != 0) { + print STDERR "ERROR: Consumer returned $C1_status\n"; + exit 1; +} -if ($C1->WaitKill(30) == -1) { - $S1->Kill(); - $S2->Kill(); - $NS->Kill(); - $C2->Kill(); +$C2_status = $C2->Spawn (); +if ($C2_status != 0) { + print STDERR "ERROR: Consumer returned $C2_status\n"; exit 1; } -if ($C2->WaitKill(5) == -1) { - $S1->Kill(); - $S2->Kill(); - $NS->Kill(); - exit 1; +$C1_status = $C1->WaitKill ($c1->ProcessStopWaitInterval()+30); + +if ($C1_status != 0) { + print STDERR "ERROR: Consumer1 returned $C1_status\n"; + $status = 1; +} + +$C2_status = $C2->WaitKill ($c2->ProcessStopWaitInterval()); + +if ($C2_status != 0) { + print STDERR "ERROR: Consumer2 returned $C2_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->Kill(); -$S1->Kill(); -$S2->Kill(); +$S1_status = $S1->TerminateWaitKill ($s1->ProcessStopWaitInterval()); + +if ($S1_status != 0) { + print STDERR "ERROR: Supplier1 returned $S1_status\n"; + $status = 1; +} + +$S2_status = $S2->TerminateWaitKill ($s2->ProcessStopWaitInterval()); + +if ($S2_status != 0) { + print STDERR "ERROR: Supplier2 returned $S2_status\n"; + $status = 1; +} -unlink $nsiorfile; -unlink $ec1iorfile; -unlink $ec2iorfile; +$ns->DeleteFile ($nsiorfile); +$s1->DeleteFile ($ec1iorfile); +$s2->DeleteFile ($ec2iorfile); +$s1->DeleteFile ($nsiorfile); +$s2->DeleteFile ($nsiorfile); +$c1->DeleteFile ($nsiorfile); +$c2->DeleteFile ($nsiorfile); -exit 0; +exit $status; diff --git a/TAO/orbsvcs/tests/Security/EndpointPolicy/run_test.pl b/TAO/orbsvcs/tests/Security/EndpointPolicy/run_test.pl index 8c8ab641151..52e211e3ffb 100755 --- a/TAO/orbsvcs/tests/Security/EndpointPolicy/run_test.pl +++ b/TAO/orbsvcs/tests/Security/EndpointPolicy/run_test.pl @@ -6,41 +6,52 @@ 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'; -$iorfile = PerlACE::LocalFile ("test.ior"); -unlink $iorfile; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -$port = 12345; +my $test = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; -if (PerlACE::is_vxworks_test()) { - $exe = new PerlACE::ProcessVX ("test", "-ORBDottedDecimalAddresses 0 -ORBUseSharedProfile 1 -o $iorfile -p $port"); -} -else { - $exe = new PerlACE::Process ("test", "-ORBDottedDecimalAddresses 0 -ORBUseSharedProfile 1 -o $iorfile -p $port"); -} +my $iorbase = "test.ior"; +my $port = 12345; +my $test_iorfile = $test->LocalFile ($iorbase); +$test->DeleteFile($iorbase); + +$T = $test->CreateProcess ("test", "-ORBdebuglevel $debug_level ". + "-ORBDottedDecimalAddresses 0 ". + "-ORBUseSharedProfile 1 ". + "-o $test_iorfile -p $port"); print "Starting server using shared profiles\n"; -$exe->Spawn (); +$test_status = $T->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile, - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $exe->Kill (); $exe->TimedWait (1); +if ($test_status != 0) { + print STDERR "ERROR: test returned $test_status\n"; exit 1; } -# The server ought to die quickly on its own. -$server = $exe->WaitKill (2); +if ($test->WaitForFileTimed ($iorbase, + $test->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$test_iorfile>\n"; + $T->Kill (); $T->TimedWait (1); + exit 1; +} -if ($server != 0) { - print STDERR "ERROR: server [single profile per IOR] returned $server\n"; - $status = 1; +# The server ought to die quickly on its own. +$test_status = $T->WaitKill ($test->ProcessStopWaitInterval()); +if ($test_status != 0) { + print STDERR "ERROR: server [single profile per IOR] returned $test_status\n"; + exit 1; } -unlink $iorfile; +$test->DeleteFile($iorbase); exit $status; diff --git a/TAO/tests/Bug_1330_Regression/run_test.pl b/TAO/tests/Bug_1330_Regression/run_test.pl index 9b60f4c59ee..46dfab2d765 100755 --- a/TAO/tests/Bug_1330_Regression/run_test.pl +++ b/TAO/tests/Bug_1330_Regression/run_test.pl @@ -1,69 +1,80 @@ - -# $Id$ - eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; +# $Id$ # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; -# The server IOR file -$iorbase = "server.ior"; +$status = 0; +$debug_level = '0'; -# The client and server processes -if (PerlACE::is_vxworks_test()) { - $SERVER = new PerlACE::ProcessVX("server"); - $server_ior_file = $iorbase; - $TARGETHOSTNAME = $ENV{'ACE_RUN_VX_TGTHOST'}; -} -else { - $SERVER = new PerlACE::Process("server"); - $server_ior_file = PerlACE::LocalFile ($iorbase); - $TARGETHOSTNAME = "localhost"; + + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } } -unlink $server_ior_file; -$CLIENT = new PerlACE::Process("client"); +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"; + +$port = $server->RandomPort(); + +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", + "-ORBdebuglevel $debug_level " . + "-ORBEndpoint iiop://:$port " . + "-o $server_iorfile"); -# We want the server to run on a fixed port -$port = PerlACE::uniqueid () + 10001; # This can't be 10000 for Chorus 4.0 -$SERVER->Arguments("-ORBEndpoint iiop://:$port"); +$CL1 = $client->CreateProcess ("client", + "-k \"corbaloc:iiop:$TARGETHOSTNAME:$port/Name\\2dwith\\2dhyphens\""); -# Fire up the server -$SERVER->Spawn(); +$CL2 = $client->CreateProcess ("client", + "-k corbaloc:iiop:$TARGETHOSTNAME:$port/Name%2dwith%2dhyphens"); -# We don't need the IOR file but we can wait on the file -if (PerlACE::waitforfile_timed ($server_ior_file, $PerlACE::wait_interval_for_process_creation) == -1) -{ - print STDERR "ERROR: cannot find $server_ior_file\n"; - $SERVER->Kill(); - exit 1; + +$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; +} + +$client_status = $CL1->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: Bug 1330 Regression failed. Correct escape characters rejected\n"; + $status = 1; } -# Try the corbaloc URL with incorrect '\' escaping of hex characters -# We expect this to 'fail' -$CLIENT->Arguments("-k \"corbaloc:iiop:$TARGETHOSTNAME:$port/Name\\2dwith\\2dhyphens\""); -if ($CLIENT->SpawnWaitKill (30) != 0) -{ - print STDERR "ERROR: Bug 1330 Regression failed. Correct escape characters rejected\n"; - $SERVER->Kill(); - exit 1; +$client_status = $CL2->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: Bug 1330 Regression failed. Correct escape characters rejected\n"; + $status = 1; } -# Try the corbaloc URL with the correct '%' escaping of hex characters -# We expect success -$CLIENT->Arguments("-k corbaloc:iiop:$TARGETHOSTNAME:$port/Name%2dwith%2dhyphens"); -if ($CLIENT->SpawnWaitKill (30) != 0) -{ - print STDERR "ERROR: Bug 1330 Regression failed. Correct escape characters rejected\n"; - $SERVER->Kill(); - exit 1; +$server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; } -# Clean up and return -$SERVER->TerminateWaitKill (5); -unlink $server_ior_file; -exit 0; +$server->DeleteFile($iorbase); + +exit $status; diff --git a/TAO/tests/Bug_1330_Regression/server.cpp b/TAO/tests/Bug_1330_Regression/server.cpp index 7174165c8a6..c9e54969898 100644 --- a/TAO/tests/Bug_1330_Regression/server.cpp +++ b/TAO/tests/Bug_1330_Regression/server.cpp @@ -8,16 +8,20 @@ #include "tao/IORTable/IORTable.h" const ACE_TCHAR *object_key = 0; +const ACE_TCHAR *ior_file = ACE_TEXT ("server.ior"); int parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:k")); int c; while ((c = get_opts ()) != -1) switch (c) { + case 'o': + ior_file = get_opts.opt_arg (); + break; case 'k': object_key = get_opts.opt_arg (); break; @@ -25,7 +29,8 @@ parse_args (int argc, ACE_TCHAR *argv[]) default: ACE_ERROR_RETURN ((LM_ERROR, "SERVER (%P): usage: %s " - "-k <object key>" + "-k <object key> " + "-o <ior>" "\n", argv [0]), -1); @@ -81,7 +86,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) adapter->bind("Name-with-hyphens", ior.in()); - FILE *output_file= ACE_OS::fopen ("server.ior", "w"); + FILE *output_file= ACE_OS::fopen (ior_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "SERVER (%P): Cannot open output file " diff --git a/TAO/tests/Bug_2702_Regression/run_test.pl b/TAO/tests/Bug_2702_Regression/run_test.pl index f80c5217185..b57c15de707 100755 --- a/TAO/tests/Bug_2702_Regression/run_test.pl +++ b/TAO/tests/Bug_2702_Regression/run_test.pl @@ -6,20 +6,22 @@ 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; + # Usually the primary component to run on targets (if any) is the server; # this time it's the client. my $client = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; -my $host = PerlACE::TestTarget::create_target(2) || die "Create target 2 failed\n"; +my $server = PerlACE::TestTarget::create_target(2) || die "Create target 2 failed\n"; -$iorbase = "server_on_localhost_1192.ior"; -$client_iorfile = $client->LocalFile($iorbase); -$logfile = "client.log"; -$client_logfile = $client->LocalFile($logfile); -$host_logfile = $host->LocalFile($logfile); -$status = 0; +my $iorbase = "server_on_localhost_1192.ior"; +my $logfile = "client.log"; + +my $client_iorfile = $client->LocalFile($iorbase); +my $client_logfile = $client->LocalFile($logfile); +my $server_logfile = $server->LocalFile($logfile); +$client->DeleteFile($logfile); ## Get the perl interpreter that invoked us and remove any ## executable extension (if there is one). @@ -27,44 +29,51 @@ my($perl) = $^X; $perl =~ s/\.exe$//i; $perl =~ s/000000\///g if ($^O eq 'VMS'); -$SV = new PerlACE::Process ($perl, "fakeserver2.pl"); -$CL = $client->CreateProcess ("client", " -k file://$client_iorfile -ORBdebuglevel 1 -ORBlogfile $client_logfile"); -$client->DeleteFile("client.log"); +$SV = $server->CreateProcess ($perl, "fakeserver2.pl"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile ". + "-ORBdebuglevel 1 ". + "-ORBlogfile $client_logfile"); $SV->IgnoreExeSubDir(1); $SV->IgnoreHostRoot(1); -$SV->Spawn (); + +$server_status = $SV->Spawn (); + sleep(1); # give the server a chance to come up -if (PerlACE::waitforfile_timed ($iorbase, - $client->ProcessStartWaitInterval()) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; +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 <$iorbase>\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; } -$CL->SpawnWaitKill (60); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45); -# We expect to have to kill both client and server. - -#if ($client != 0) { -# print STDERR "ERROR: client returned $client\n"; -# $status = 1; -#} +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} -$SV->WaitKill (10); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); -#if ($server != 0) { -# print STDERR "ERROR: server returned $server\n"; -# $status = 1; -#} +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} -open (LOG, $host_logfile) or die "Couldn't open client log file client.log: $!\n"; +open (LOG, $server_logfile) or die "Couldn't open server log file $server_logfile: $!\n"; while (<LOG>) { $ccmsgfound = 1 if (/process_parsed_messages, received CloseConnection message/); } diff --git a/TAO/tests/IPV6/run_test.pl b/TAO/tests/IPV6/run_test.pl index 555d35a5fa9..dd0d7f39083 100755 --- a/TAO/tests/IPV6/run_test.pl +++ b/TAO/tests/IPV6/run_test.pl @@ -6,84 +6,83 @@ 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'; -$iorfile = PerlACE::LocalFile ("server.ior"); -unlink $iorfile; - -if (PerlACE::is_vxworks_test()) { - $srv_arg = "-o server.ior "; -} -else { - $srv_arg = "-o $iorfile "; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } } -$srv_arg .= "-ORBUseSharedProfile 0 "; -$clt_arg = "-k file://$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 = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +# -*- perl -*- +$server_arg = "-ORBdebuglevel $debug_level -o $server_iorfile -ORBUseSharedProfile 0 "; +$client_arg = "-k file://$client_iorfile "; @configurations = - ( - { + ({ description => "Testing server with '-ORBConnectIPV6Only 1'.\n", - server => "$srv_arg -ORBConnectIPV6Only 1", - client => "$clt_arg", + server => "$server_arg -ORBConnectIPV6Only 1", + client => "$client_arg", error => 0, url => 0, url_address => "", - }, - { + },{ description => "Testing client with '-ORBPreferIPV6Interfaces 1'.\n", - server => "$srv_arg ", - client => "$clt_arg -ORBPreferIPV6Interfaces 1", + server => "$server_arg ", + client => "$client_arg -ORBPreferIPV6Interfaces 1", error => 0, url => 0, url_address => "", - }, - { + },{ description => "Testing IPV4 server with client with '-ORBConnectIPV6Only 1'.\n", - server => "$srv_arg -ORBListenEndpoints iiop://127.0.0.1", - client => "$clt_arg -x -ORBConnectIPV6Only 1", + server => "$server_arg -ORBListenEndpoints iiop://127.0.0.1", + client => "$client_arg -x -ORBConnectIPV6Only 1", error => 1, url => 0, url_address => "", - }, - { + },{ description => "Testing IPV4 server with client and URL-style IOR", - server => "$srv_arg -ORBListenEndpoints iiop://0.0.0.0 -ORBObjRefStyle url", - client => "$clt_arg", + server => "$server_arg -ORBListenEndpoints iiop://0.0.0.0 -ORBObjRefStyle url", + client => "$client_arg", error => 0, url => 0, url_address => "", - }, - { + },{ description => "Testing IPV4 server with client and IPV6-forced URL", - server => "$srv_arg -ORBListenEndpoints iiop://0.0.0.0 -ORBObjRefStyle url", + server => "$server_arg -ORBListenEndpoints iiop://0.0.0.0 -ORBObjRefStyle url", client => "-x", error => 1, url => 1, url_address => "corbaloc:iiop:1.2\@[::1]:", - }, - { + },{ description => "Testing IPV6 server with client and IPV4-forced URL", - server => "$srv_arg -ORBListenEndpoints iiop://[::1] -ORBObjRefStyle url", + server => "$server_arg -ORBListenEndpoints iiop://[::1] -ORBObjRefStyle url", client => "-x", error => 1, url => 1, url_address => "corbaloc:iiop:1.2\@127.0.0.1:", - }, - { + },{ description => "Testing IPV6Only server with client and IPV4-forced URL", - server => "$srv_arg -ORBConnectIPV6Only 1 -ORBObjRefStyle url", + server => "$server_arg -ORBConnectIPV6Only 1 -ORBObjRefStyle url", client => "-x", error => 1, url => 1, url_address => "corbaloc:iiop:1.2\@127.0.0.1:", - }, - { + },{ description => "Testing server with client and IPV4-forced URL", - server => "$srv_arg -ORBObjRefStyle url", + server => "$server_arg -ORBObjRefStyle url", client => "", error => 0, url => 1, @@ -94,41 +93,52 @@ $clt_arg = "-k file://$iorfile "; sub run_test_ { - my $srvargs = @_[0]->{server}; - my $cltargs = @_[0]->{client}; - my $error = @_[0]->{error}; - my $stat = 0; + my $server_args = $_[0]->{server}; + my $client_args = $_[0]->{client}; + my $error = $_[0]->{error}; + my $test_status = 0; print STDERR "\n******************************************************\n"; - print @_[0]->{description}; + print $_[0]->{description}; + + print "\nRunning server with the following args:\n$server_args\n\n"; - print "\nRunning server with the following args:\n$srvargs\n\n"; + $SV = $server->CreateProcess ("server", $server_args); + $server_status = $SV->Spawn (); - if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", $srvargs); + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + return 1; } - else { - $SV = new PerlACE::Process ("server", $srvargs); + + if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + return 1; } - $SV->Spawn (); + if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + return 1; + } - if (PerlACE::waitforfile_timed ($iorfile, - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; + if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; $SV->Kill (); $SV->TimedWait (1); return 1; } - if (@_[0]->{url}) { + if ($_[0]->{url}) { my $fh; - open $fh, $iorfile; + open $fh, $client_iorfile; my $url = <$fh>; close $fh; print "Changing corbaloc url from:\n$url\nto\n"; - my $url_addr = @_[0]->{url_address}; + my $url_addr = $_[0]->{url_address}; if ($url =~ /corbaloc:iiop:1.[01234]\@[\[].*[\]]\:.*/) { $url =~ s/(corbaloc:iiop:1.[01234]\@[\[].*[\]]\:)(.*)/$url_addr$2/; } @@ -137,43 +147,46 @@ sub run_test_ } print $url . "\n"; - $cltargs .= " -k \"$url\""; + $client_args .= " -k \"$url\""; } - print "\nRunning client with the following args:\n$cltargs\n\n"; + print "\nRunning client with the following args:\n$client_args\n\n"; - $CL = new PerlACE::Process ("client", $cltargs); + $CL = $client->CreateProcess ("client", $client_args); - $client = $CL->SpawnWaitKill (300); - - if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $stat = 1; + $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 285); + if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $test_status = 1; } if ($error) { - $server = $SV->TerminateWaitKill (10); + $server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval()); + + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $test_status = 1; + } } else { - $server = $SV->WaitKill (10); + $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); - if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - $stat = 1; - } + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $test_status = 1; + } } - return $stat; + return $test_status; } +for $test (@configurations) { + if (run_test_($test) != 0) { + $status = 1; + } -for $test (@configurations) -{ - if (run_test_($test) != 0) { - $status = 1; - } - - unlink $iorfile; + $server->DeleteFile($iorbase); + $client->DeleteFile($iorbase); } exit $status; diff --git a/TAO/tests/Leader_Followers/run_test.pl b/TAO/tests/Leader_Followers/run_test.pl index e5cccb7ed0d..8935ffa36c4 100755 --- a/TAO/tests/Leader_Followers/run_test.pl +++ b/TAO/tests/Leader_Followers/run_test.pl @@ -1,46 +1,53 @@ 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; -$iorfilebase = "lf.ior"; -$iorfile = PerlACE::LocalFile ("$iorfilebase"); -$tp_conf_base = "tp$PerlACE::svcconf_ext"; -$select_mt_conf_base = "select_mt$PerlACE::svcconf_ext"; -$tp_conf = PerlACE::LocalFile ("$tp_conf_base"); -$select_mt_conf = PerlACE::LocalFile ("$select_mt_conf_base"); - -if (PerlACE::is_vxworks_test()) { - $sv_iorfile = $iorfilebase; - $SV = new PerlACE::ProcessVX ("server"); - $tpool_reactor_directive = "-ORBsvcconf $tp_conf_base"; - $select_reactor_directive = "-ORBsvcconf $select_mt_conf_base"; -} -else { - $sv_iorfile = $iorfile; - $SV = new PerlACE::Process ("server"); - $tpool_reactor_directive = "-ORBsvcconf $tp_conf"; - $select_reactor_directive = "-ORBsvcconf $select_mt_conf"; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } } -$CL = new PerlACE::Process ("client"); + +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 = "lf.ior"; +my $tp_conf_base = "tp$PerlACE::svcconf_ext"; +my $select_mt_conf_base = "select_mt$PerlACE::svcconf_ext"; + +my $server_tp_conf_file = $server->LocalFile ($tp_conf_base); +my $server_select_mt_conf_file = $server->LocalFile ($select_mt_conf_base); +my $client_tp_conf_file = $client->LocalFile ($tp_conf_base); +my $client_select_mt_conf_file = $client->LocalFile ($select_mt_conf_base); + +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server"); +$CL = $client->CreateProcess ("client"); sub run_client ($) { my $args = shift; - $CL->Arguments ("-k file://$iorfile " . $args); + $CL->Arguments ("-k file://$client_iorfile " . $args); - my $client = $CL->SpawnWaitKill (200); + my $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 185); - if ($client != 0) { - $time = localtime; - print STDERR "ERROR: client returned $client at $time\n"; + if ($client_status != 0) { + my $time = localtime; + print STDERR "ERROR: client returned $client_status at $time\n"; $status = 1; } } @@ -51,129 +58,139 @@ sub run_clients () print STDERR "\nSelect Reactor\n\n"; - run_client ("$select_reactor_directive -e 0"); + run_client ("-ORBsvcconf $client_select_mt_conf_file -e 0"); print STDERR "\nTP Reactor\n\n"; - run_client ("$tpool_reactor_directive -e 0"); + run_client ("-ORBsvcconf $client_tp_conf_file -e 0"); print STDERR "\n\n*** Single-threaded client event loop: Select Reactor ***\n\n\n"; print STDERR "\nSingle-threaded client running event loop for 3 seconds\n\n"; - run_client ("$select_reactor_directive -e 1 -t 3000"); + run_client ("-ORBsvcconf $client_select_mt_conf_file -e 1 -t 3000"); print STDERR "\nSingle-threaded client running event loop for 10 seconds\n\n"; - run_client ("$select_reactor_directive -e 1 -t 10000"); + run_client ("-ORBsvcconf $client_select_mt_conf_file -e 1 -t 10000"); print STDERR "\nSingle-threaded client running event loop for 20 seconds\n\n"; - run_client ("$select_reactor_directive -e 1 -t 20000"); + run_client ("-ORBsvcconf $client_select_mt_conf_file -e 1 -t 20000"); print STDERR "\n\n*** Single-threaded client event loop: TP Reactor ***\n\n\n"; print STDERR "\nSingle-threaded client running event loop for 3 seconds\n\n"; - run_client ("$tpool_reactor_directive -e 1 -t 3000"); + run_client ("-ORBsvcconf $client_tp_conf_file -e 1 -t 3000"); print STDERR "\nSingle-threaded client running event loop for 10 seconds\n\n"; - run_client ("$tpool_reactor_directive -e 1 -t 10000"); + run_client ("-ORBsvcconf $client_tp_conf_file -e 1 -t 10000"); print STDERR "\nSingle-threaded client running event loop for 20 seconds\n\n"; - run_client ("$tpool_reactor_directive -e 1 -t 20000"); + run_client ("-ORBsvcconf $client_tp_conf_file -e 1 -t 20000"); print STDERR "\n\n*** Multi-threaded client event loop: TP Reactor ***\n\n\n"; print STDERR "\nMulti-threaded client running event loop for 3 seconds\n\n"; - run_client ("$tpool_reactor_directive -e 5 -t 3000"); + run_client ("-ORBsvcconf $client_tp_conf_file -e 5 -t 3000"); print STDERR "\nMulti-threaded client running event loop for 10 seconds\n\n"; - run_client ("$tpool_reactor_directive -e 5 -t 10000"); + run_client ("-ORBsvcconf $client_tp_conf_file -e 5 -t 10000"); print STDERR "\nMulti-threaded client running event loop for 20 seconds\n\n"; - run_client ("$tpool_reactor_directive -e 5 -t 20000 -x"); + run_client ("-ORBsvcconf $client_tp_conf_file -e 5 -t 20000 -x"); } -$single = 1; -$multi = 0; +sub run_server ($) +{ + my $args = shift; -for ($i = 0; $i <= $#ARGV; $i++) { - if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") { - print "run_test [-m] -[a]\n"; - print "\n"; - print "-m -- tests the multithreaded server (default is single)\n"; - print "-a -- tests both multi and single threaded servers\n"; - exit 0; - } - elsif ($ARGV[$i] eq "-m") { - $multi = 1; - $single = 0; - } - elsif ($ARGV[$i] eq "-a") { - $multi = 1; - $single = 1; - } -} + $server->DeleteFile($iorbase); + $client->DeleteFile($iorbase); -if ($single == 1) { - unlink $iorfile; + $SV->Arguments ("-o $server_iorfile " . $args); - print STDERR "\n\n*** Single threaded server ***\n\n\n"; + my $server_status = $SV->Spawn (); - $SV->Arguments ("-o $sv_iorfile $select_reactor_directive"); + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + return 1; + } - $SV->Spawn (); + if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + return 1; + } - if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); - exit 1; + if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + return 1; + } + + if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + return 1; } run_clients (); - $server = $SV->WaitKill (100); - if ($server != 0) { - $time = localtime; - print STDERR "ERROR: server returned $server at $time\n"; + $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 85); + + if ($server_status != 0) { + my $time = localtime; + print STDERR "ERROR: server returned $server_status at $time\n"; $status = 1; } - unlink $iorfile; + $server->DeleteFile($iorbase); + $client->DeleteFile($iorbase); } -if ($multi == 1) { - unlink $iorfile; - - print STDERR "\n\n*** Thread-Pool server ***\n\n\n"; - - $SV->Arguments ("-o $sv_iorfile -e 5 $tpool_reactor_directive"); +my $single = 1; +my $multi = 0; - $SV->Spawn (); +for ($i = 0; $i <= $#ARGV; $i++) { + if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") { + print "run_test [-m] -[a]\n"; + print "\n"; + print "-m -- tests the multithreaded server (default is single)\n"; + print "-a -- tests both multi and single threaded servers\n"; + exit 0; + } + elsif ($ARGV[$i] eq "-m") { + $multi = 1; + $single = 0; + } + elsif ($ARGV[$i] eq "-a") { + $multi = 1; + $single = 1; + } +} - if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($single == 1) { + print STDERR "\n\n*** Single threaded server ***\n\n\n"; + $run_status = run_server("-ORBsvcconf $server_select_mt_conf_file"); + if ($run_status != 0) { exit 1; } +} - run_clients (); - - $server = $SV->WaitKill (10); - - if ($server != 0) { - $time = localtime; - print STDERR "ERROR: server returned $server at $time\n"; - $SV->Kill (); +if ($multi == 1) { + print STDERR "\n\n*** Thread-Pool server ***\n\n\n"; + $run_status = run_server("-e 5 -ORBsvcconf $server_tp_conf_file"); + if ($run_status != 0) { + exit 1; } - - unlink $iorfile; } exit $status; diff --git a/TAO/tests/MProfile_Connection_Timeout/run_test.pl b/TAO/tests/MProfile_Connection_Timeout/run_test.pl index e554d2670a7..d8eeb9c9fe3 100755 --- a/TAO/tests/MProfile_Connection_Timeout/run_test.pl +++ b/TAO/tests/MProfile_Connection_Timeout/run_test.pl @@ -6,58 +6,131 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; - -$iorfile1base = "server1.ior"; -$iorfile1 = PerlACE::LocalFile ("$iorfile1base"); -$iorfile2 = PerlACE::LocalFile ("server2.ior"); - -unlink $iorfile1; -unlink $iorfile2; +use PerlACE::TestTarget; $status = 0; +$debug_level = '0'; -if (PerlACE::is_vxworks_test()) { - $SV1 = new PerlACE::ProcessVX ("server", "-o $iorfile1base"); +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } } -else { - $SV1 = new PerlACE::Process ("server", "-o $iorfile1"); + +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 = "server1.ior"; +my $ior2file = "server2.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); + +#Files which used by server2 +my $client_ior1file = $client->LocalFile ($ior1file); +my $client_ior2file = $client->LocalFile ($ior2file); +$client->DeleteFile($ior1file); +$client->DeleteFile($ior2file); + +$SV1 = $server1->CreateProcess ("server", + "-ORBdebuglevel $debug_level " . + "-o $server1_ior1file"); + +$SV2 = $server2->CreateProcess ("server", + "-ORBdebuglevel $debug_level " . + "-o $server2_ior2file " . + "-r"); + +$CL = $client->CreateProcess ("client", + "-k file://$ior1file " . + "-m file://$ior2file"); + +$server_status = $SV1->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; } -$SV2 = new PerlACE::Process ("server", "-o $iorfile2 -r"); -$CL = new PerlACE::Process ("client", " -k file://$iorfile1 -m file://$iorfile2"); -$SV1->Spawn (); +$server_status = $SV2->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile1, - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile1>\n"; - $SV1->Kill (); $SV1->TimedWait (1); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; } -$SV2->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile2, - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile2>\n"; +sub KillServers{ + $SV1->Kill (); $SV1->TimedWait (1); $SV2->Kill (); $SV2->TimedWait (1); +} + +if ($server1->WaitForFileTimed ($ior1file, + $server1->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server1_ior1file>\n"; + KillServers (); + exit 1; +} + +if ($server2->WaitForFileTimed ($ior2file, + $server2->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server2_ior2file>\n"; + KillServers (); + exit 1; +} + +if ($server1->GetFile ($ior1file) == -1) { + print STDERR "ERROR: cannot retrieve file <$server1_ior1file>\n"; + KillServers (); + exit 1; +} +if ($client->PutFile ($ior1file) == -1) { + print STDERR "ERROR: cannot set file <$client_ior1file>\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; } -$client = $CL->SpawnWaitKill (300); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 285); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$server1 = $SV1->WaitKill (10); +$server_status = $SV1->WaitKill ($server1->ProcessStopWaitInterval()); -$server2 = $SV2->WaitKill (10); -if ($server2 != 0) { - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $iorfile1; -unlink $iorfile2; + +$server_status = $SV2->WaitKill ($server2->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + + +$server1->DeleteFile($ior1file); +$server2->DeleteFile($ior2file); +$client->DeleteFile($ior1file); +$client->DeleteFile($ior2file); exit $status; diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/run_test.pl b/TAO/tests/NestedUpcall/MT_Client_Test/run_test.pl index adcc580eb47..b0ea7f4b11b 100755 --- a/TAO/tests/NestedUpcall/MT_Client_Test/run_test.pl +++ b/TAO/tests/NestedUpcall/MT_Client_Test/run_test.pl @@ -1,72 +1,144 @@ 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; -$ior1filebase = "server1.ior"; -$ior1file = PerlACE::LocalFile ("$ior1filebase"); -$ior2file = PerlACE::LocalFile ("server2.ior"); +$debug_level = '0'; -# Make sure the files are gone -unlink $ior1file; -unlink $ior2file; +$iterations = '10'; +$number_threads = '2'; +$server_iterations = '5'; -if (PerlACE::is_vxworks_test()) { - $SV1 = new PerlACE::ProcessVX ("server", "-o $ior1filebase"); + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } } -else { - $SV1 = new PerlACE::Process ("server", "-o $ior1file"); + +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 = "server1.ior"; +my $ior2file = "server2.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); + +#Files which used by server2 +my $client_ior1file = $client->LocalFile ($ior1file); +my $client_ior2file = $client->LocalFile ($ior2file); +$client->DeleteFile($ior1file); +$client->DeleteFile($ior2file); + +$SV1 = $server1->CreateProcess ("server", + "-ORBdebuglevel $debug_level " . + "-o $server1_ior1file"); + +$SV2 = $server2->CreateProcess ("server", + "-ORBdebuglevel $debug_level " . + "-o $server2_ior2file"); + + +$CL = $client->CreateProcess ("client", + "-f $ior1file " . + "-g $ior2file " . + "-n $number_threads " . + "-i $iterations " . + "-s $server_iterations"); + +$server_status = $SV1->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +$server_status = $SV2->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; } -$SV2 = new PerlACE::Process ("server", "-o $ior2file"); -$CL = new PerlACE::Process ("client", "-f $ior1file -g $ior2file -n 2 -i 10 -s 5"); -$SV1->Spawn (); -$SV2->Spawn (); +sub KillServers{ + $SV1->Kill (); $SV1->TimedWait (1); + $SV2->Kill (); $SV2->TimedWait (1); +} -if (PerlACE::waitforfile_timed ($ior1file, - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ior1file>\n"; - $SV1->Kill (); - $SV2->Kill (); +if ($server1->WaitForFileTimed ($ior1file, + $server1->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server1_ior1file>\n"; + KillServers (); exit 1; } -if (PerlACE::waitforfile_timed ($ior2file, - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ior2file>\n"; - $SV1->Kill (); - $SV2->Kill (); +if ($server2->WaitForFileTimed ($ior2file, + $server2->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server2_ior2file>\n"; + KillServers (); exit 1; } -$client = $CL->SpawnWaitKill (60); +if ($server1->GetFile ($ior1file) == -1) { + print STDERR "ERROR: cannot retrieve file <$server1_ior1file>\n"; + KillServers (); + exit 1; +} +if ($client->PutFile ($ior1file) == -1) { + print STDERR "ERROR: cannot set file <$client_ior1file>\n"; + KillServers (); + exit 1; +} -$server1 = $SV1->TerminateWaitKill (5); -$server2 = $SV2->TerminateWaitKill (5); +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; +} -# Clean up -unlink $ior1file; -unlink $ior2file; +$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 ($server1 != 0) { - print STDERR "ERROR: server 1 returned $server1\n"; +$server_status = $SV1->TerminateWaitKill ($server1->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -if ($server2 != 0) { - print STDERR "ERROR: server 2 returned $server2\n"; +$server_status = $SV2->TerminateWaitKill ($server2->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } + +$server1->DeleteFile($ior1file); +$server2->DeleteFile($ior2file); +$client->DeleteFile($ior1file); +$client->DeleteFile($ior2file); + exit $status; diff --git a/TAO/tests/OctetSeq/run_test.pl b/TAO/tests/OctetSeq/run_test.pl index 763d9e82b22..dd58f82249e 100755 --- a/TAO/tests/OctetSeq/run_test.pl +++ b/TAO/tests/OctetSeq/run_test.pl @@ -8,6 +8,23 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' use lib "$ENV{ACE_ROOT}/bin"; use PerlACE::TestTarget; +$status = 0; +$debug_level = '0'; + +$client_iterations = '5000'; + +$octet_iterations = '32'; +$low = '8192'; +$high = '8192'; +$step = '1'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + + 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 $t3 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; @@ -20,9 +37,15 @@ my $client_iorfile = $t3->LocalFile ($iorbase); $server->DeleteFile($iorbase); $client->DeleteFile($iorbase); -$SV = $server->CreateProcess ("server", "-o $server_iorfile"); -$T = $client->CreateProcess ("OctetSeq", "-n 32 -l 8192 -h 8192 -s 1 -q"); -$CL = $t3->CreateProcess ("client", "-i 5000 -k file://$client_iorfile"); +$SV = $server->CreateProcess ("server", + "-ORBdebuglevel $debug_level " . + "-o $server_iorfile"); + +$T = $client->CreateProcess ("OctetSeq", + "-ORBdebuglevel $debug_level " . + "-n $octet_iterations -l $low -h $high -s $step -q"); + +$CL = $t3->CreateProcess ("client", "-i $client_iterations -k file://$client_iorfile"); print STDERR "\n\n==== Octet sequence passing test\n"; @@ -40,6 +63,17 @@ if ($server->WaitForFileTimed ($iorbase, 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; +} + $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 100); if ($client_status != 0) { diff --git a/TAO/tests/OctetSeq/run_test1.pl b/TAO/tests/OctetSeq/run_test1.pl index adab544a7b4..5d932bb2b8b 100755 --- a/TAO/tests/OctetSeq/run_test1.pl +++ b/TAO/tests/OctetSeq/run_test1.pl @@ -6,55 +6,103 @@ 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 ("test1.ior"); +$debug_level = '0'; -unlink $iorfile; +$conf = $PerlACE::svcconf_ext; -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-ORBSvcConf svc1$PerlACE::svcconf_ext -o test1.ior"); -} -else { - $SV = new PerlACE::Process ("server", "-ORBSvcConf svc1$PerlACE::svcconf_ext -o $iorfile"); +$client_iterations = '5000'; + +$octet_iterations = '32'; +$low = '8192'; +$high = '8192'; +$step = '1'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } } -$CL = new PerlACE::Process ("client", "-ORBSvcConf svc1$PerlACE::svcconf_ext -i 5000 -k file://$iorfile"); -$T = new PerlACE::Process ("OctetSeq", "-ORBSvcConf svc1$PerlACE::svcconf_ext -n 32 -l 8192 -h 8192 -s 1 -q"); + +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 $t3 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; + +$status = 0; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $t3->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", + "-ORBdebuglevel $debug_level " . + "-ORBSvcConf svc1$conf " . + "-o $server_iorfile"); + +$T = $client->CreateProcess ("OctetSeq", + "-ORBdebuglevel $debug_level " . + "-ORBSvcConf svc1$conf " . + "-n $octet_iterations -l $low -h $high -s $step -q"); + +$CL = $t3->CreateProcess ("client", + "-ORBSvcConf svc1$conf " . + "-i $client_iterations -k file://$client_iorfile"); print STDERR "\n\n==== Octet sequence passing test\n"; -$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; +} + +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; } -$client = $CL->SpawnWaitKill (120); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 100); -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->WaitKill (5); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 10); -if ($server != 0) { +if ($server_status != 0) { print STDERR "ERROR: server returned $server\n"; $status = 1; } print STDERR "\n\n==== Octet sequence performance test\n"; -$test = $T->SpawnWaitKill (60); +$test = $T->SpawnWaitKill ($t3->ProcessStartWaitInterval() + 45); if ($test != 0) { print STDERR "ERROR: test returned $test\n"; $status = 1; } -unlink $iorfile; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); exit $status; diff --git a/TAO/tests/OctetSeq/run_test2.pl b/TAO/tests/OctetSeq/run_test2.pl index 9ec6aceedc0..67fa5e3f08e 100755 --- a/TAO/tests/OctetSeq/run_test2.pl +++ b/TAO/tests/OctetSeq/run_test2.pl @@ -6,55 +6,103 @@ 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 ("test2.ior"); +$debug_level = '0'; -unlink $iorfile; +$conf = $PerlACE::svcconf_ext; -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-ORBSvcConf svc2$PerlACE::svcconf_ext -o test2.ior"); -} -else { - $SV = new PerlACE::Process ("server", "-ORBSvcConf svc2$PerlACE::svcconf_ext -o $iorfile"); +$client_iterations = '5000'; + +$octet_iterations = '32'; +$low = '8192'; +$high = '8192'; +$step = '1'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } } -$CL = new PerlACE::Process ("client", "-ORBSvcConf svc2$PerlACE::svcconf_ext -i 5000 -k file://$iorfile"); -$T = new PerlACE::Process ("OctetSeq", "-ORBSvcConf svc2$PerlACE::svcconf_ext -n 32 -l 8192 -h 8192 -s 1 -q"); + +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 $t3 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; + +$status = 0; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $t3->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", + "-ORBdebuglevel $debug_level " . + "-ORBSvcConf svc2$conf " . + "-o $server_iorfile"); + +$T = $client->CreateProcess ("OctetSeq", + "-ORBdebuglevel $debug_level " . + "-ORBSvcConf svc2$conf " . + "-n $octet_iterations -l $low -h $high -s $step -q"); + +$CL = $t3->CreateProcess ("client", + "-ORBSvcConf svc2$conf " . + "-i $client_iterations -k file://$client_iorfile"); print STDERR "\n\n==== Octet sequence passing test\n"; -$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; +} + +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; } -$client = $CL->SpawnWaitKill (120); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 100); -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->WaitKill (5); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 10); -if ($server != 0) { +if ($server_status != 0) { print STDERR "ERROR: server returned $server\n"; $status = 1; } print STDERR "\n\n==== Octet sequence performance test\n"; -$test = $T->SpawnWaitKill (60); +$test = $T->SpawnWaitKill ($t3->ProcessStartWaitInterval() + 45); if ($test != 0) { print STDERR "ERROR: test returned $test\n"; $status = 1; } -unlink $iorfile; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); exit $status; |