summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2007-11-30 20:24:11 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2007-11-30 20:24:11 +0000
commit5ee4c584c49271d14920c4379b63b5223d3f71e4 (patch)
tree30ba7b5ac67bc1c60a11b27ed546a8e404e3ab3a
parent6978f67e927a7e6114a598aeb84d629dfde4632e (diff)
downloadATCD-5ee4c584c49271d14920c4379b63b5223d3f71e4.tar.gz
Fri Nov 30 20:23:54 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r--TAO/ChangeLog7
-rw-r--r--TAO/tests/Multiple/client.cpp36
-rwxr-xr-xTAO/tests/Multiple/run_test.pl22
-rw-r--r--TAO/tests/Multiple/server.cpp40
4 files changed, 89 insertions, 16 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 8b906dda845..d1ec88ce32b 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,10 @@
+Fri Nov 30 20:23:54 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * tests/Multiple/client.cpp:
+ * tests/Multiple/run_test.pl:
+ * tests/Multiple/server.cpp:
+ Pass IOR filename through the commandline
+
Fri Nov 30 14:10:00 UTC 2007 Simon Massey <sma@prismtech.com>
* orbsvcs/tests/InterfaceRepo/Bug_3155_Regression/run_test.pl:
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);