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/Bug_2494_Regression | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/tests/Bug_2494_Regression')
-rw-r--r-- | TAO/tests/Bug_2494_Regression/Bug_2494_Regression.mpc | 19 | ||||
-rw-r--r-- | TAO/tests/Bug_2494_Regression/README | 34 | ||||
-rw-r--r-- | TAO/tests/Bug_2494_Regression/client.cpp | 140 | ||||
-rwxr-xr-x | TAO/tests/Bug_2494_Regression/run_test.pl | 70 | ||||
-rw-r--r-- | TAO/tests/Bug_2494_Regression/server.cpp | 157 | ||||
-rw-r--r-- | TAO/tests/Bug_2494_Regression/test.idl | 10 | ||||
-rw-r--r-- | TAO/tests/Bug_2494_Regression/test_i.cpp | 29 | ||||
-rw-r--r-- | TAO/tests/Bug_2494_Regression/test_i.h | 36 | ||||
-rw-r--r-- | TAO/tests/Bug_2494_Regression/test_i.inl | 7 |
9 files changed, 0 insertions, 502 deletions
diff --git a/TAO/tests/Bug_2494_Regression/Bug_2494_Regression.mpc b/TAO/tests/Bug_2494_Regression/Bug_2494_Regression.mpc deleted file mode 100644 index 0360d9e7fd1..00000000000 --- a/TAO/tests/Bug_2494_Regression/Bug_2494_Regression.mpc +++ /dev/null @@ -1,19 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(*Server): taoserver { - idlflags += -Sc -St - Source_Files { - test_i.cpp - server.cpp - } -} - -project(*Client): taoclient { - idlflags += -Sc -St - after += *Server - Source_Files { - testC.cpp - client.cpp - } -} diff --git a/TAO/tests/Bug_2494_Regression/README b/TAO/tests/Bug_2494_Regression/README deleted file mode 100644 index 726419360b1..00000000000 --- a/TAO/tests/Bug_2494_Regression/README +++ /dev/null @@ -1,34 +0,0 @@ -# $Id$ - -Description: - - This test a modification of MT_Server. In this case the client is also -multi-threaded. The client sends very large strings to the server, which it -echoes back, for the sake of keeping the server busy doing I/O. When the -client is abruptly killed, the server should close the connection and continue -running. - -Expected output: - The server prints out the IOR of the object it serves and the -results of server shutdown (aborted or shutdown cleanly). - - Regression: -Activated as -<IOR:012a2a2a1600000049444c3a53696d706c655f5365727665723a312e30002a2a0100000000000000740000000101022a130000006f6369313332392e6f63697765622e636f6d002a19842a2a1b00000014010f0052535420c93244520b04000000000001000000010000002a020000000000000008000000012a2a2a004f41540100000018000000012a2a2a0100010001000000010001050901010000000000> -***Client has been killed*** -ACE_ASSERT (32395|3067820976): file Transport.cpp, line 172 assertion -failed for 'this->head_ == 0'.Aborting... -ERROR: cannot find file -</tao_builds/mitza/1.4a/ACE_wrappers/TAO/tests/Bug_2494_Regression/server_terminated> --- server has not shut down cleanly. -(perl script returns 1) - - Correct run: -Activated as -<IOR:012a2a2a1600000049444c3a53696d706c655f5365727665723a312e30002a2a0100000000000000740000000101022a130000006f6369313332392e6f63697765622e636f6d002a34842a2a1b00000014010f0052535488d03244438d04000000000001000000010000002a020000000000000008000000012a2a2a004f41540100000018000000012a2a2a0100010001000000010001050901010000000000> -***Client has been killed*** -event loop finished -(perl script returns 0) - -How to run: - Use the run_test.pl script to run it. diff --git a/TAO/tests/Bug_2494_Regression/client.cpp b/TAO/tests/Bug_2494_Regression/client.cpp deleted file mode 100644 index 25d1df2ae3d..00000000000 --- a/TAO/tests/Bug_2494_Regression/client.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// $Id$ - -#include "ace/Get_Opt.h" -#include "ace/Task.h" -#include "ace/OS_NS_string.h" -#include "testC.h" - -ACE_RCSID(Bug_2494_Regression, client, "$Id$") - -const char *ior = "file://test.ior"; -int nthreads = 5; -int do_shutdown = 0; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "xk:n:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'x': - do_shutdown = 1; - break; - - case 'k': - ior = get_opts.opt_arg (); - break; - - case 'n': - nthreads = ACE_OS::atoi (get_opts.opt_arg ()); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-k <ior> " - "[-n <nthreads> | -x]" - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -namespace -{ - const char *twohundredbytes = - "12345678901234567890123456789012345678901234567890" - "12345678901234567890123456789012345678901234567890" - "12345678901234567890123456789012345678901234567890" - "12345678901234567890123456789012345678901234567890" - ; -} - -struct Worker : ACE_Task_Base -{ - - Worker (Simple_Server_ptr srv) - : srv_(Simple_Server::_duplicate(srv)) - { - } - - Simple_Server_var srv_; - - int svc () - { - char* str = CORBA::string_alloc (200*2000 + 1); - if (!str) return 1; - str[0] = CORBA::Char('\0'); - for (int i=0; i < 2000; ++i) - { - ACE_OS::strcat(str, twohundredbytes); - } - - while (1) - { - try - { - const char *ret = srv_->test_method (str); - ACE_TRY_CHECK; - if (0 != ACE_OS::strcmp (str, ret)) return 1; - } - catch (CORBA::Exception& ex) - { - ACE_DEBUG ((LM_ERROR, - ACE_TEXT ("(%P|%t) Exception caught: \n%s\n"), - ACE_TEXT_CHAR_TO_TCHAR (ex._info ().c_str ()))); - return 1; - } - } - return 0; - } - -}; - -int -main (int argc, char *argv[]) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); - - if (parse_args (argc, argv) != 0) - return 1; - - CORBA::Object_var object = orb->string_to_object (ior); - - Simple_Server_var server = Simple_Server::_narrow (object.in ()); - - if (CORBA::is_nil (server.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Object reference <%s> is nil\n", - ior), 1); - } - - if (do_shutdown) - { - server->shutdown (); - } - else - { - Worker wrk (server.in ()); - wrk.activate (THR_NEW_LWP|THR_JOINABLE|THR_INHERIT_SCHED, nthreads); - wrk.thr_mgr ()->wait (); - } - } - catch (CORBA::Exception& ex) - { - ACE_DEBUG ((LM_ERROR, ACE_TEXT ("(%P|%t) Exception caught: \n%s\n"), - ACE_TEXT_CHAR_TO_TCHAR (ex._info ().c_str ()))); - return 1; - } - - return 0; -} diff --git a/TAO/tests/Bug_2494_Regression/run_test.pl b/TAO/tests/Bug_2494_Regression/run_test.pl deleted file mode 100755 index 1183cac469c..00000000000 --- a/TAO/tests/Bug_2494_Regression/run_test.pl +++ /dev/null @@ -1,70 +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; -$srv_threads = '4'; -$cli_threads = '30'; -$iorfile = PerlACE::LocalFile ("test.ior"); -$srvdownfile = PerlACE::LocalFile ("server_terminated"); - -unlink $iorfile; -unlink $srvdownfile; - -$SV = new PerlACE::Process ("server", "-o $iorfile -n $srv_threads"); -$CL = new PerlACE::Process ("client", "-k file://$iorfile -n $cli_threads"); -$CLS = new PerlACE::Process ("client", "-k file://$iorfile -x"); - -$SV->Spawn (); - -if (PerlACE::waitforfile_timed ($iorfile, - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); - exit 1; -} - -$CL->Spawn (); -#Client will not terminate on its own, kill it after 30 seconds -$CL->TimedWait (30); -$CL->Kill (1); -#The parameter '1' (above) indicates that an error return value should not -#cause this test to fail. - -print "***Client has been killed***\n"; - -#Server should still be running at this point, now start the client that asks -#the server to shut itself down - -$client = $CLS->SpawnWaitKill (5); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; -} - -#Server should now be shut down -if (PerlACE::waitforfile_timed ($srvdownfile, - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$srvdownfile>". - " -- server has not shut down cleanly.\n"; - $SV->Kill (); - exit 1; -} - -$server = $SV->WaitKill (1); - -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - $status = 1; -} - -unlink $iorfile; -unlink $srvdownfile; - -exit $status diff --git a/TAO/tests/Bug_2494_Regression/server.cpp b/TAO/tests/Bug_2494_Regression/server.cpp deleted file mode 100644 index 8a87e86c160..00000000000 --- a/TAO/tests/Bug_2494_Regression/server.cpp +++ /dev/null @@ -1,157 +0,0 @@ -// $Id$ - -#include "test_i.h" -#include "ace/Get_Opt.h" -#include "ace/Task.h" - -ACE_RCSID(Bug_2494_Regression, server, "$Id$") - -const char *ior_output_file = "file://test.ior"; -int nthreads = 4; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "o:n:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - ior_output_file = get_opts.opt_arg (); - break; - - case 'n': - nthreads = ACE_OS::atoi (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 Worker : public ACE_Task_Base -{ - // = TITLE - // Run a server thread - // - // = DESCRIPTION - // Use the ACE_Task_Base class to run server threads - // -public: - Worker (CORBA::ORB_ptr orb); - // ctor - - virtual int svc (void); - // The thread entry point. - -private: - CORBA::ORB_var orb_; - // The orb -}; - -int -main (int argc, char *argv[]) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA"); - - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - 1); - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in ()); - - PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); - - if (parse_args (argc, argv) != 0) - return 1; - - Simple_Server_i server_impl (orb.in ()); - - Simple_Server_var server = server_impl._this (); - - CORBA::String_var ior = orb->object_to_string (server.in ()); - - ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ())); - - // If the ior_output_file exists, output the ior to it - if (ior_output_file != 0) - { - 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 (); - - Worker worker (orb.in ()); - if (worker.activate (THR_NEW_LWP | THR_JOINABLE, - nthreads) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot activate client threads\n"), - 1); - - worker.thr_mgr ()->wait (); - - ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); - - const char *fname = "server_terminated"; - FILE *output_file= ACE_OS::fopen (fname, "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing: ", - fname), - 1); - ACE_OS::fprintf (output_file, "%s", "OK\n"); - ACE_OS::fclose (output_file); - } - catch (CORBA::Exception& ex) - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Exception caught:"); - return 1; - } - - return 0; -} - -// **************************************************************** - -Worker::Worker (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -int -Worker::svc (void) -{ - try - { - this->orb_->run (); - } - catch (CORBA::Exception&) - { - } - return 0; -} diff --git a/TAO/tests/Bug_2494_Regression/test.idl b/TAO/tests/Bug_2494_Regression/test.idl deleted file mode 100644 index 335009e627f..00000000000 --- a/TAO/tests/Bug_2494_Regression/test.idl +++ /dev/null @@ -1,10 +0,0 @@ -// -// $Id$ -// - -interface Simple_Server -{ - string test_method (in string str); - - oneway void shutdown (); -}; diff --git a/TAO/tests/Bug_2494_Regression/test_i.cpp b/TAO/tests/Bug_2494_Regression/test_i.cpp deleted file mode 100644 index bfccb378f26..00000000000 --- a/TAO/tests/Bug_2494_Regression/test_i.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// $Id$ - -#include "test_i.h" -#include "tao/debug.h" -#include "ace/OS_NS_unistd.h" - -#if !defined(__ACE_INLINE__) -#include "test_i.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Bug_2494_Regression, test_i, "$Id$") - -char * -Simple_Server_i::test_method (const char *x) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "Request in thread %t\n")); - ACE_Time_Value tv (2); - ACE_OS::sleep (tv); - return CORBA::string_dup(x); -} - -void -Simple_Server_i::shutdown () - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->orb_->shutdown (0); -} diff --git a/TAO/tests/Bug_2494_Regression/test_i.h b/TAO/tests/Bug_2494_Regression/test_i.h deleted file mode 100644 index cd8971dc7a6..00000000000 --- a/TAO/tests/Bug_2494_Regression/test_i.h +++ /dev/null @@ -1,36 +0,0 @@ -// $Id$ - -#ifndef TAO_BUG_2494_REGRESSION_TEST_I_H -#define TAO_BUG_2494_REGRESSION_TEST_I_H - -#include "testS.h" - -class Simple_Server_i : public POA_Simple_Server -{ - // = TITLE - // Simpler Server implementation - // - // = DESCRIPTION - // Implements the Simple_Server interface in test.idl - // -public: - Simple_Server_i (CORBA::ORB_ptr orb); - // ctor - - // = The Simple_Server methods. - char *test_method (const char *x) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void shutdown () - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - CORBA::ORB_var orb_; - // The ORB -}; - -#if defined(__ACE_INLINE__) -#include "test_i.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* TAO_BUG_2494_REGRESSION_TEST_I_H */ diff --git a/TAO/tests/Bug_2494_Regression/test_i.inl b/TAO/tests/Bug_2494_Regression/test_i.inl deleted file mode 100644 index 97524552ff4..00000000000 --- a/TAO/tests/Bug_2494_Regression/test_i.inl +++ /dev/null @@ -1,7 +0,0 @@ -// $Id$ - -ACE_INLINE -Simple_Server_i::Simple_Server_i (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} |