diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
commit | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch) | |
tree | da50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/tests/Nested_Event_Loop | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/tests/Nested_Event_Loop')
-rw-r--r-- | TAO/tests/Nested_Event_Loop/.cvsignore | 2 | ||||
-rw-r--r-- | TAO/tests/Nested_Event_Loop/Nested_Event_Loop.mpc | 18 | ||||
-rw-r--r-- | TAO/tests/Nested_Event_Loop/README | 19 | ||||
-rw-r--r-- | TAO/tests/Nested_Event_Loop/client.cpp | 147 | ||||
-rwxr-xr-x | TAO/tests/Nested_Event_Loop/run_test.pl | 48 | ||||
-rw-r--r-- | TAO/tests/Nested_Event_Loop/server.cpp | 111 | ||||
-rw-r--r-- | TAO/tests/Nested_Event_Loop/svc.conf | 3 | ||||
-rw-r--r-- | TAO/tests/Nested_Event_Loop/svc.conf.xml | 7 | ||||
-rw-r--r-- | TAO/tests/Nested_Event_Loop/test.idl | 29 | ||||
-rw-r--r-- | TAO/tests/Nested_Event_Loop/test_i.cpp | 198 | ||||
-rw-r--r-- | TAO/tests/Nested_Event_Loop/test_i.h | 54 |
11 files changed, 0 insertions, 636 deletions
diff --git a/TAO/tests/Nested_Event_Loop/.cvsignore b/TAO/tests/Nested_Event_Loop/.cvsignore deleted file mode 100644 index f2ad85300eb..00000000000 --- a/TAO/tests/Nested_Event_Loop/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -client -server diff --git a/TAO/tests/Nested_Event_Loop/Nested_Event_Loop.mpc b/TAO/tests/Nested_Event_Loop/Nested_Event_Loop.mpc deleted file mode 100644 index 50ef58ea252..00000000000 --- a/TAO/tests/Nested_Event_Loop/Nested_Event_Loop.mpc +++ /dev/null @@ -1,18 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(*Server): strategies, taoexe, portableserver { - Source_Files { - test_i.cpp - server.cpp - } -} - -project(*Client): strategies, taoexe, portableserver { - after += *Server - Source_Files { - test_i.cpp - client.cpp - } -} - diff --git a/TAO/tests/Nested_Event_Loop/README b/TAO/tests/Nested_Event_Loop/README deleted file mode 100644 index e5bd434ecf1..00000000000 --- a/TAO/tests/Nested_Event_Loop/README +++ /dev/null @@ -1,19 +0,0 @@ -# $Id$ - -Description: - -This is a test of invoking nested event loop calls from user code, -i.e., a call to perform_work() or run() from the implementation of the -servant. - -Expected output: - -The client and server should be able to make steady progress, i.e., -should not deadlock. - -How to run: - -You can use the run_test.pl script to run it or: - -$ server -$ client diff --git a/TAO/tests/Nested_Event_Loop/client.cpp b/TAO/tests/Nested_Event_Loop/client.cpp deleted file mode 100644 index ac198b31bd6..00000000000 --- a/TAO/tests/Nested_Event_Loop/client.cpp +++ /dev/null @@ -1,147 +0,0 @@ -// $Id$ - -#include "ace/Get_Opt.h" -#include "ace/Read_Buffer.h" -#include "test_i.h" - -#include "tao/Strategies/advanced_resource.h" - -ACE_RCSID(Nested_Event_Loop, client, "$Id$") - -// Name of file contains ior. -static const char *IOR = "file://ior"; - -// Default event_loop_depth. -static CORBA::ULong event_loop_depth = 6; - -// Default event_loop_iterations. -static CORBA::ULong event_loop_iterations = 6; - -// Flag indicates whether to shutdown remote server or not upon client -// shutdown. -static int shutdown_server = 0; - -static int -parse_args (int argc, char **argv) -{ - ACE_Get_Opt get_opts (argc, argv, "k:d:i:x"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'k': - IOR = get_opts.opt_arg (); - break; - - case 'i': - event_loop_iterations = ::atoi (get_opts.opt_arg ()); - break; - - case 'd': - event_loop_depth = ::atoi (get_opts.opt_arg ()); - break; - - case 'x': - shutdown_server = 1; - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-k IOR " - "-i event loop iterations " - "-d event loop depth " - "-x shutdown server " - "\n", - argv [0]), - -1); - } - - if (IOR == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Please specify the IOR for the servant\n"), -1); - - // Indicates successful parsing of command line. - return 0; -} - -int -main (int argc, char **argv) -{ - ACE_DECLARE_NEW_CORBA_ENV; - - ACE_TRY - { - // Initialize the ORB. - CORBA::ORB_var orb = - CORBA::ORB_init (argc, - argv, - 0 - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Initialize options based on command-line arguments. - int parse_args_result = parse_args (argc, argv); - if (parse_args_result != 0) - return parse_args_result; - - CORBA::Object_var object = - orb->resolve_initial_references ("RootPOA" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (object.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Get an object reference from the argument string. - object = orb->string_to_object (IOR - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Try to narrow the object reference to a <server> reference. - server_var server_object = server::_narrow (object.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - client_i servant (server_object.in ()); - - servant.loop (event_loop_depth, - event_loop_iterations - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Shutdown server. - if (shutdown_server) - { - server_object->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - root_poa->destroy (1, - 1 - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Exception caught:"); - return -1; - } - ACE_ENDTRY; - - ACE_CHECK_RETURN (-1); - - return 0; -} diff --git a/TAO/tests/Nested_Event_Loop/run_test.pl b/TAO/tests/Nested_Event_Loop/run_test.pl deleted file mode 100755 index df9c649b7f0..00000000000 --- a/TAO/tests/Nested_Event_Loop/run_test.pl +++ /dev/null @@ -1,48 +0,0 @@ -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -# $Id$ -# -*- perl -*- - -use lib '../../../bin'; -use PerlACE::Run_Test; - -$status = 0; -$iorfile = PerlACE::LocalFile ("test.ior"); - -unlink $iorfile; - -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-o test.ior"); -} -else { - $SV = new PerlACE::Process ("server", "-o $iorfile"); -} -$CL = new PerlACE::Process ("client", "-k file://$iorfile -x"); - -$SV->Spawn (); - -if (PerlACE::waitforfile_timed ($iorfile, 10) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); $SV->TimedWait (1); - exit 1; -} - -$client = $CL->SpawnWaitKill (200); - -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; -} - -$server = $SV->WaitKill (100); - -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - $status = 1; -} - -unlink $iorfile; - -exit $status; diff --git a/TAO/tests/Nested_Event_Loop/server.cpp b/TAO/tests/Nested_Event_Loop/server.cpp deleted file mode 100644 index 134bd31f46a..00000000000 --- a/TAO/tests/Nested_Event_Loop/server.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// $Id$ - -#include "ace/Get_Opt.h" -#include "test_i.h" - -#include "tao/Strategies/advanced_resource.h" - -ACE_RCSID(Nested_Event_Loop, server, "$Id$") - -const char *ior_output_file = "ior"; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "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 -main (int argc, char *argv[]) -{ - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, - argv, - "" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var poa_object = - orb->resolve_initial_references ("RootPOA" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return -1; - - server_i servant (orb.in ()); - - server_var server_object = - servant._this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::String_var ior = - orb->object_to_string (server_object.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ())); - - FILE *output_file = ACE_OS::fopen (ior_output_file, "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing IOR: %s", - ior_output_file), - -1); - ACE_OS::fprintf (output_file, "%s", ior.in ()); - ACE_OS::fclose (output_file); - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); - - root_poa->destroy (1, - 1 - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Exception caught:"); - return -1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/tests/Nested_Event_Loop/svc.conf b/TAO/tests/Nested_Event_Loop/svc.conf deleted file mode 100644 index 64044024bc5..00000000000 --- a/TAO/tests/Nested_Event_Loop/svc.conf +++ /dev/null @@ -1,3 +0,0 @@ -# $Id$ -# -static Advanced_Resource_Factory "-ORBReactorType select_mt" diff --git a/TAO/tests/Nested_Event_Loop/svc.conf.xml b/TAO/tests/Nested_Event_Loop/svc.conf.xml deleted file mode 100644 index 981923d7a31..00000000000 --- a/TAO/tests/Nested_Event_Loop/svc.conf.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version='1.0'?> -<!-- Converted from ./tests/Nested_Event_Loop/svc.conf by svcconf-convert.pl --> -<ACE_Svc_Conf> - <!-- $Id$ --> - <!-- --> - <static id="Advanced_Resource_Factory" params="-ORBReactorType select_mt"/> -</ACE_Svc_Conf> diff --git a/TAO/tests/Nested_Event_Loop/test.idl b/TAO/tests/Nested_Event_Loop/test.idl deleted file mode 100644 index 2a0de7543ad..00000000000 --- a/TAO/tests/Nested_Event_Loop/test.idl +++ /dev/null @@ -1,29 +0,0 @@ -// -// $Id$ -// - -typedef sequence<octet> act; - -interface client -{ - void loop (in unsigned long event_loop_depth, - in unsigned long event_loop_iterations); - - oneway void oneway_no_op (in act act_for_iterations, - in act act_for_flag); - - void twoway_no_op (); -}; - -interface server -{ - void loop (in client remote_partner, - in unsigned long event_loop_depth, - in unsigned long event_loop_iterations); - - void no_op (in client remote_partner, - in act act_for_iterations, - in act act_for_flag); - - oneway void shutdown (); -}; diff --git a/TAO/tests/Nested_Event_Loop/test_i.cpp b/TAO/tests/Nested_Event_Loop/test_i.cpp deleted file mode 100644 index 7b27990c225..00000000000 --- a/TAO/tests/Nested_Event_Loop/test_i.cpp +++ /dev/null @@ -1,198 +0,0 @@ -// $Id$ - -#include "test_i.h" -#include "ace/OS_NS_string.h" - -ACE_RCSID(Nested_Event_Loop, test_i, "$Id$") - -server_i::server_i (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -void -server_i::loop (client_ptr remote_partner, - CORBA::ULong event_loop_depth, - CORBA::ULong event_loop_iterations - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, - "server_i::loop: event_loop_depth = %2.2d; event_loop_iterations = %2.2d\n", - event_loop_depth, - event_loop_iterations)); - - this->run_no_ops (remote_partner, - event_loop_iterations / 2 - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (--event_loop_depth != 0) - { - remote_partner->loop (event_loop_depth, - event_loop_iterations - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - - this->run_no_ops (remote_partner, - event_loop_iterations / 2 - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -server_i::run_no_ops (client_ptr remote_partner, - CORBA::ULong iterations - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - while (iterations != 0) - { - CORBA::ULong *pointer_to_iterations = &iterations; - size_t sizeof_pointer_to_iterations = sizeof (pointer_to_iterations); - - act act_for_iterations (sizeof_pointer_to_iterations); - act_for_iterations.length (sizeof_pointer_to_iterations); - - ACE_OS::memcpy (act_for_iterations.get_buffer (), - &pointer_to_iterations, - sizeof_pointer_to_iterations); - - CORBA::ULong got_reply = 0; - - CORBA::ULong *pointer_to_flag = &got_reply; - size_t sizeof_pointer_to_flag = sizeof (pointer_to_flag); - - act act_for_flag (sizeof_pointer_to_flag); - act_for_flag.length (sizeof_pointer_to_flag); - - ACE_OS::memcpy (act_for_flag.get_buffer (), - &pointer_to_flag, - sizeof_pointer_to_flag); - - remote_partner->oneway_no_op (act_for_iterations, - act_for_flag - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - while (!got_reply) - { - this->orb_->perform_work (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - } - } -} - -void -server_i::no_op (client_ptr remote_partner, - const act &act_for_iterations, - const act &act_for_flag - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - CORBA::ULong *pointer_to_iterations = 0; - - ACE_OS::memcpy (&pointer_to_iterations, - act_for_iterations.get_buffer (), - act_for_iterations.length ()); - - CORBA::ULong *pointer_to_flag = 0; - - ACE_OS::memcpy (&pointer_to_flag, - act_for_flag.get_buffer (), - act_for_flag.length ()); - - ACE_DEBUG ((LM_DEBUG, - "server_i::no_op: iterations = %d\n", - *pointer_to_iterations)); - - --(*pointer_to_iterations); - - *pointer_to_flag = 1; - - remote_partner->twoway_no_op (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -void -server_i::shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->orb_->shutdown (0 - ACE_ENV_ARG_PARAMETER); -} - -client_i::client_i (server_ptr remote_partner) - : remote_partner_ (server::_duplicate (remote_partner)) -{ -} - -void -client_i::loop (CORBA::ULong event_loop_depth, - CORBA::ULong event_loop_iterations - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, - "client_i::loop: event_loop_depth = %2.2d; event_loop_iterations = %2.2d\n", - event_loop_depth, - event_loop_iterations)); - - ACE_DECLARE_NEW_CORBA_ENV; - - ACE_TRY - { - client_var self = - this->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - this->remote_partner_->loop (self.in (), - event_loop_depth, - event_loop_iterations - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Exception caught in client_i::loop:"); - } - ACE_ENDTRY; -} - -void -client_i::oneway_no_op (const act &act_for_iterations, - const act &act_for_flag - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_DECLARE_NEW_CORBA_ENV; - - ACE_TRY - { - client_var self = - this->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - this->remote_partner_->no_op (self.in (), - act_for_iterations, - act_for_flag - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Exception caught in client_i::no_op:"); - } - ACE_ENDTRY; -} - -void -client_i::twoway_no_op (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, - "client_i::twoway_no_op\n")); -} diff --git a/TAO/tests/Nested_Event_Loop/test_i.h b/TAO/tests/Nested_Event_Loop/test_i.h deleted file mode 100644 index 37d1b80f541..00000000000 --- a/TAO/tests/Nested_Event_Loop/test_i.h +++ /dev/null @@ -1,54 +0,0 @@ -// $Id$ - -#include "testS.h" - -class server_i : public POA_server -{ -public: - server_i (CORBA::ORB_ptr orb); - - void loop (client_ptr remote_partner, - CORBA::ULong event_loop_depth, - CORBA::ULong event_loop_iterations - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void run_no_ops (client_ptr remote_partner, - CORBA::ULong iterations - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void no_op (client_ptr remote_partner, - const act &act_for_iterations, - const act &act_for_flag - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - CORBA::ORB_var orb_; -}; - -class client_i : public POA_client -{ -public: - client_i (server_ptr remote_partner); - - void loop (CORBA::ULong event_loop_depth, - CORBA::ULong event_loop_iterations - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void oneway_no_op (const act &act_for_iterations, - const act &act_for_flag - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void twoway_no_op (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - server_var remote_partner_; -}; |