summaryrefslogtreecommitdiff
path: root/TAO/tests/CodeSets
diff options
context:
space:
mode:
authorvzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-12-23 12:02:42 +0000
committervzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-12-23 12:02:42 +0000
commit268576b7f1520ce75d4876ce07721062c550b431 (patch)
tree1c741f048219642425231914755b998195e4c4e3 /TAO/tests/CodeSets
parent0e0166d51e7729089d342641de9ad6a39804db42 (diff)
downloadATCD-268576b7f1520ce75d4876ce07721062c550b431.tar.gz
Wed Dec 23 11:56:42 UTC 2009 Vladimir Zykov <vladimir.zykov@prismtech.com>
* tests/CodeSets/simple/client.cpp: * tests/CodeSets/simple/server.cpp: * tests/CodeSets/simple/run_test.pl: * tests/Bug_3766_Regression/client.cpp: * tests/Bug_3766_Regression/server.cpp: * tests/Bug_3766_Regression/run_test.pl: Changed the tests so they accept IORs from command line. * tests/Bug_3790_Regression/server2.cpp: Fixed compile error on wchar builds. * bin/tao_orb_tests.lst: Disabled a test for bug#3542 on static builds.
Diffstat (limited to 'TAO/tests/CodeSets')
-rw-r--r--TAO/tests/CodeSets/simple/client.cpp42
-rwxr-xr-xTAO/tests/CodeSets/simple/run_test.pl16
-rw-r--r--TAO/tests/CodeSets/simple/server.cpp35
3 files changed, 73 insertions, 20 deletions
diff --git a/TAO/tests/CodeSets/simple/client.cpp b/TAO/tests/CodeSets/simple/client.cpp
index 36d0293e1e7..217c0237b86 100644
--- a/TAO/tests/CodeSets/simple/client.cpp
+++ b/TAO/tests/CodeSets/simple/client.cpp
@@ -25,6 +25,35 @@
#include "ace/OS_NS_string.h"
#include "ace/Log_Msg.h"
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("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 successful parsing of the command line
+ return 0;
+}
wchar_t *
make_wstring (const char *str)
@@ -52,7 +81,6 @@ make_wstring (const char *str)
// ------------------------------------------------------------
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
- char buf[1000];
int error_count = 0;
try
@@ -61,18 +89,12 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
CORBA::ORB_var orb= CORBA::ORB_init (argc, argv);
// Get IOR from command line (or file)
- if (argc != 2)
- {
- ACE_OS::strcpy (buf, "file://server.ior");
- }
- else
- {
- ACE_OS::strcpy (buf, ACE_TEXT_ALWAYS_CHAR (argv[1]));
- }
+ if (parse_args (argc, argv) != 0)
+ return 1;
// The first arg should be the IOR
CORBA::Object_var object =
- orb->string_to_object (buf);
+ orb->string_to_object (ior);
// Get the server
simple_var server = simple::_narrow (object.in ());
diff --git a/TAO/tests/CodeSets/simple/run_test.pl b/TAO/tests/CodeSets/simple/run_test.pl
index a1f3951d23e..b12c6fec53c 100755
--- a/TAO/tests/CodeSets/simple/run_test.pl
+++ b/TAO/tests/CodeSets/simple/run_test.pl
@@ -25,8 +25,8 @@ $client->DeleteFile($iorbase);
my $client_conf = $client->LocalFile ("cs_test.conf");
my $server_conf = $server->LocalFile ("cs_test.conf");
-$SV = $server->CreateProcess ("server", " -ORBDottedDecimalAddresses 1");
-$CL = $client->CreateProcess ("client", " -ORBSvcConf $client_conf");
+$SV = $server->CreateProcess ("server", "-o $server_iorfile -ORBDottedDecimalAddresses 1");
+$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -ORBSvcConf $client_conf");
$status = 0;
@@ -61,10 +61,10 @@ $client->DeleteFile($iorbase);
print STDOUT "\nServer using char translator\n\n";
-$SV2 = $server->CreateProcess ("server", " -ORBDottedDecimalAddresses 1 -ORBSvcConf $server_conf");
-$CL2 = $client->CreateProcess ("client");
+$SV->Arguments ("-o $server_iorfile -ORBDottedDecimalAddresses 1 -ORBSvcConf $server_conf");
+$CL->Arguments ("-k file://$client_iorfile");
-$server_status = $SV2->Spawn ();
+$server_status = $SV->Spawn ();
if ($server_status != 0) {
print STDERR "ERROR: Starting server 2 returned $server_status\n";
exit 1;
@@ -72,17 +72,17 @@ if ($server_status != 0) {
if ($server->WaitForFileTimed ($iorbase,
$server->ProcessStartWaitInterval()) == -1) {
print STDERR "ERROR: cannot find file <$server_iorfile>\n";
- $SV2->Kill (); $SV2->TimedWait (1);
+ $SV->Kill (); $SV->TimedWait (1);
exit 1;
}
-$client_status = $CL2->SpawnWaitKill ($client->ProcessStartWaitInterval ());
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval ());
if ($client_status != 0) {
print STDERR "ERROR: client 2 returned $client_status\n";
$status = 1;
}
-$server_status = $SV2->WaitKill ($server->ProcessStopWaitInterval ());
+$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval ());
if ($server_status != 0) {
print STDERR "ERROR: server 2 returned $server_status\n";
$status = 1;
diff --git a/TAO/tests/CodeSets/simple/server.cpp b/TAO/tests/CodeSets/simple/server.cpp
index 99c7b390ee9..e4861f12313 100644
--- a/TAO/tests/CodeSets/simple/server.cpp
+++ b/TAO/tests/CodeSets/simple/server.cpp
@@ -24,6 +24,35 @@
#include "ace/streams.h"
#include "ace/OS_NS_stdio.h"
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("test.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("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;
+}
// ------------------------------------------------------------
// Servant for associated CORBA object
@@ -80,7 +109,6 @@ private:
// ------------------------------------------------------------
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
-
try
{
// Init the orb
@@ -106,6 +134,9 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
PortableServer::POAManager_var poa_manager =
root_poa->the_POAManager ();
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
// Create a C++ implementation of CORBA object
SimpleImpl* my_impl = 0;
ACE_NEW_RETURN (my_impl,
@@ -123,7 +154,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
// Get the IOR for our object
CORBA::String_var ior = orb->object_to_string (server.in ());
- FILE *output_file= ACE_OS::fopen ("server.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: server.ior"),