diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2007-11-30 20:24:11 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2007-11-30 20:24:11 +0000 |
commit | c511afcbd525633703ea10ee23daf3ee47d4b408 (patch) | |
tree | 30ba7b5ac67bc1c60a11b27ed546a8e404e3ab3a /TAO/tests | |
parent | 45b4a8ca8f0862cd6d1f64338659c00e9a28f00a (diff) | |
download | ATCD-c511afcbd525633703ea10ee23daf3ee47d4b408.tar.gz |
Fri Nov 30 20:23:54 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO/tests')
-rw-r--r-- | TAO/tests/Multiple/client.cpp | 36 | ||||
-rwxr-xr-x | TAO/tests/Multiple/run_test.pl | 22 | ||||
-rw-r--r-- | TAO/tests/Multiple/server.cpp | 40 |
3 files changed, 82 insertions, 16 deletions
diff --git a/TAO/tests/Multiple/client.cpp b/TAO/tests/Multiple/client.cpp index 0b2c982aa5c..d0050e5d8e3 100644 --- a/TAO/tests/Multiple/client.cpp +++ b/TAO/tests/Multiple/client.cpp @@ -1,21 +1,49 @@ // $Id$ # include "Collocation_Tester.h" +#include "ace/Get_Opt.h" ACE_RCSID (tests, client, "$Id$") -int main (int argc, char *argv[]) +const char *ior = "file://test.ior"; + +int +parse_args (int argc, char *argv[]) { + ACE_Get_Opt get_opts (argc, argv, "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 sucessful parsing of the command line + return 0; +} +int main (int argc, char *argv[]) +{ try { // ORB Initialization CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "TAO"); - CORBA::Object_var object; + if (parse_args (argc, argv) != 0) + return 1; - // Get The IOR from a file - object = orb->string_to_object ("file://s.ior"); + CORBA::Object_var object = orb->string_to_object (ior); if (CORBA::is_nil (object.in ())) { diff --git a/TAO/tests/Multiple/run_test.pl b/TAO/tests/Multiple/run_test.pl index 66144410e06..8d601878a17 100755 --- a/TAO/tests/Multiple/run_test.pl +++ b/TAO/tests/Multiple/run_test.pl @@ -10,19 +10,25 @@ use PerlACE::Run_Test; $status = 0; -$direct_colloc = "-ORBCollocationStrategy direct"; -$no_colloc = "-ORBCollocation no"; - -# @todo Test should take -o and -k options to specify iorfile -# Hard coded in test. -$iorfile = "s.ior"; +$iorbase = "server.ior"; +$iorfile = PerlACE::LocalFile ("$iorbase"); unlink $iorfile; my $class = (PerlACE::is_vxworks_test() ? 'PerlACE::ProcessVX' : 'PerlACE::Process'); -$SV = new $class ("server"); -$CL = new PerlACE::Process ("client"); +if (PerlACE::is_vxworks_test()) { + $SV = new PerlACE::ProcessVX ("server", "-o $iorbase"); + $direct_colloc = "-ORBCollocationStrategy direct -o $iorbase"; + $no_colloc = "-ORBCollocation no -o $iorbase"; + +} +else { + $SV = new PerlACE::Process ("server", "-o $iorfile"); + $direct_colloc = "-ORBCollocationStrategy direct -o $iorfile"; + $no_colloc = "-ORBCollocation no -o $iorfile"; +} +$CL = new PerlACE::Process ("client", "-k file://$iorfile"); # # Test using ThruPOA collocation. diff --git a/TAO/tests/Multiple/server.cpp b/TAO/tests/Multiple/server.cpp index cb292790c4c..bd487099faf 100644 --- a/TAO/tests/Multiple/server.cpp +++ b/TAO/tests/Multiple/server.cpp @@ -1,14 +1,43 @@ // $Id$ #include "Multiple_Impl.h" +#include "ace/Get_Opt.h" #include "ace/OS_NS_stdio.h" ACE_RCSID (tests, server, "$Id$") -int main (int argc, char *argv[]) +const char *ior_output_file = "test.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 +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ try { // Orb Initialization @@ -19,10 +48,12 @@ int main (int argc, char *argv[]) PortableServer::POA_var poa = PortableServer::POA::_narrow(object.in()); - // Get the POAManager PortableServer::POAManager_var poa_manager = poa->the_POAManager(); + if (parse_args (argc, argv) != 0) + return 1; + // Create the servant. Bottom_Impl servant (orb.in ()); @@ -50,11 +81,12 @@ int main (int argc, char *argv[]) // If the ior_output_file exists, output the ior to it - FILE *output_file= ACE_OS::fopen ("s.ior", "w"); + 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"), + "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); |