diff options
author | oci <oci@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-04-27 15:49:28 +0000 |
---|---|---|
committer | oci <oci@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-04-27 15:49:28 +0000 |
commit | f7cd6c7fbccd26bd4b068af11947bc96a94ba78f (patch) | |
tree | 0398feda854b9a10abe09567dddad9b591d050d0 | |
parent | e36218a410c021d7ebff264316114643fdc4d4a5 (diff) | |
download | ATCD-f7cd6c7fbccd26bd4b068af11947bc96a94ba78f.tar.gz |
ChangeLogTag: Fri Apr 27 10:45:35 2001 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 10 | ||||
-rw-r--r-- | TAO/tests/Explicit_Event_Loop/client.cpp | 12 | ||||
-rwxr-xr-x | TAO/tests/Explicit_Event_Loop/run_test.pl | 60 | ||||
-rw-r--r-- | TAO/tests/Explicit_Event_Loop/server.cpp | 58 |
4 files changed, 95 insertions, 45 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index ecc2d58572c..977df264068 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,13 @@ +Fri Apr 27 10:45:35 2001 Chad Elliott <elliott_c@ociweb.com> + + * tests/Explicit_Event_Loop/client.cpp: + * tests/Explicit_Event_Loop/server.cpp: + * tests/Explicit_Event_Loop/run_test.pl: + + Updated this test to use the newer style perl modules, which + supports running on Chorus. This required a couple minor + modifications to the client and server code. + Fri Apr 27 10:32:57 2001 Jeff Parsons <parsons@cs.wustl.edu> * tests/IDL_Test/Makefile: diff --git a/TAO/tests/Explicit_Event_Loop/client.cpp b/TAO/tests/Explicit_Event_Loop/client.cpp index f38839271df..f9df0405b05 100644 --- a/TAO/tests/Explicit_Event_Loop/client.cpp +++ b/TAO/tests/Explicit_Event_Loop/client.cpp @@ -32,22 +32,22 @@ main (int argc, char *argv[]) ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + // Check arguments if (argc != 2) { cerr << "Usage: client IOR_string" << endl; - // throw 0; + return 1; } - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); - // Destringify argv[1] CORBA::Object_var obj = orb->string_to_object (argv[1]); if (CORBA::is_nil (obj.in ())) { cerr << "Nil Time reference" << endl; - // throw 0; + return 1; } // Narrow @@ -56,7 +56,7 @@ main (int argc, char *argv[]) if (CORBA::is_nil (tm.in ())) { cerr << "Argument is not a Time reference" << endl; - // throw 0; + return 1; } // Get time diff --git a/TAO/tests/Explicit_Event_Loop/run_test.pl b/TAO/tests/Explicit_Event_Loop/run_test.pl index bf4ae72ade1..103f523706c 100755 --- a/TAO/tests/Explicit_Event_Loop/run_test.pl +++ b/TAO/tests/Explicit_Event_Loop/run_test.pl @@ -1,56 +1,40 @@ 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 "../../../bin"; +use lib '../../../bin'; +use PerlACE::Run_Test; -require ACEutils; -require Process; -use Cwd; - -$cwd = getcwd(); -ACE::checkForTarget($cwd); - -$status = 0; -$iorfile = "$cwd$DIR_SEPARATOR" . "chapter_test.ior"; +$iorfile = PerlACE::LocalFile ("server.ior"); unlink $iorfile; +$status = 0; +$SV = new PerlACE::Process ("server", "-o $iorfile"); +$CL = new PerlACE::Process ("client", "file://$iorfile"); +$SV->Spawn (); -# Hacked call -$server = Process::Create ("exec ".$EXEPREFIX."server".$EXE_EXT.">$iorfile", - ""); -# Proper call -#$server = Process::Create ($EXEPREFIX."server".$EXE_EXT, ">$iorfile"); - -if (ACE::waitforfile_timed ($iorfile, 15) == -1) { - print STDERR "ERROR: timedout waiting for file <$iorfile>\n"; - $server->Kill (); $server->TimedWait (1); - exit 1; -} - -open(ior_handle, "$iorfile"); -$ior_content = <ior_handle>; +if (PerlACE::waitforfile_timed ($iorfile, 10) == -1) { + print STDERR "ERROR: cannot find file <$iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -$client = Process::Create($EXEPREFIX."client$EXE_EXT", "$ior_content"); +$client = $CL->SpawnWaitKill (60); -if ($client->TimedWait (60) == -1) { - print STDERR "ERROR: client timedout\n"; - $status = 1; - $client->Kill (); $client->TimedWait (1); +if ($client != 0) { + print STDERR "ERROR: client returned $client\n"; + $status = 1; } +$server = $SV->WaitKill (10); - - -$server->Terminate (); -if ($server->TimedWait (5) == -1) { - print STDERR "ERROR: cannot terminate the server\n"; - $server->Kill (); $server->TimedWait (1); - $status = 1; +if ($server != 0) { + print STDERR "ERROR: server returned $server\n"; + $status = 1; } unlink $iorfile; diff --git a/TAO/tests/Explicit_Event_Loop/server.cpp b/TAO/tests/Explicit_Event_Loop/server.cpp index 7d037702b3d..df130a20d4e 100644 --- a/TAO/tests/Explicit_Event_Loop/server.cpp +++ b/TAO/tests/Explicit_Event_Loop/server.cpp @@ -20,12 +20,46 @@ // ============================================================================ #include "server.h" +#include "tao/debug.h" +#include "ace/Get_Opt.h" // The following headers are #included automatically by ACE+TAO. // Therefore, they don't need to be included explicitly. //#include <time.h> //#include <iostream.h> +const char *ior_output_file = "server.ior"; +int done = 0; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "o:d"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.optarg; + break; + case 'd': + TAO_debug_level++; + 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; +} + + TimeOfDay Time_impl:: get_gmt ( CORBA_Environment &) @@ -39,11 +73,16 @@ get_gmt ( CORBA_Environment &) tod.minute = time_p->tm_min; tod.second = time_p->tm_sec; + done = 1; + return tod; } void do_something_else() { + // Sleep a bit so we don't eat up + // a ton of cpu + ACE_OS::sleep(3); } int @@ -61,6 +100,9 @@ main (int argc, char *argv[]) ACE_TRY_ENV); ACE_TRY_CHECK; + if (parse_args (argc, argv) != 0) + return 1; + // Get reference to Root POA. CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA", @@ -89,8 +131,20 @@ main (int argc, char *argv[]) ACE_TRY_CHECK; cout << str.in () << endl; + 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", str.in ()); + ACE_OS::fclose (output_file); + } + // Explicit Event Loop - while (1) + while (!done) { CORBA::Boolean pending = orb->work_pending(ACE_TRY_ENV); @@ -102,6 +156,8 @@ main (int argc, char *argv[]) } do_something_else(); } + orb->shutdown (); + orb->destroy (); } ACE_CATCHANY |