summaryrefslogtreecommitdiff
path: root/TAO/DevGuideExamples
diff options
context:
space:
mode:
authordbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-11-13 09:21:51 +0000
committerdbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-11-13 09:21:51 +0000
commit38ba87d6f08c5c43a2e6b9efbd6c890933eb5e1a (patch)
tree175329f71ad2787bc9ddda008980212ec73acf97 /TAO/DevGuideExamples
parent2a4b1c0ce4c45aeca7ac97ae8981d57fc9541ce3 (diff)
downloadATCD-38ba87d6f08c5c43a2e6b9efbd6c890933eb5e1a.tar.gz
Fri Nov 13 09:18:57 UTC 2009 Denis Budko <denis.budko@remedy.nl>
* orbsvcs/tests/Bug_3486_Regression/run_test.pl: * orbsvcs/tests/FaultTolerance/IOGRManipulation/run_test.pl: * orbsvcs/tests/Notify/Bug_3663_Regression/run_test.pl: * orbsvcs/tests/Notify/Bug_3646d_Regression/run_test.pl: * orbsvcs/tests/Bug_2137_Regression/run_test.pl: * DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp: * DevGuideExamples/LocalObjects/ServantLocator/MessengerClient.cpp: * DevGuideExamples/LocalObjects/ServantLocator/run_test.pl: * DevGuideExamples/RTCORBA/MessengerServer.cpp: * DevGuideExamples/RTCORBA/MessengerClient.cpp: * DevGuideExamples/RTCORBA/run_test.pl: * tests/Stack_Recursion/run_test.pl: * tests/Timed_Buffered_Oneways/run_test.pl: * tests/Bug_2234_Regression/client.cpp: * tests/Bug_2234_Regression/server.cpp: * tests/Bug_2234_Regression/run_test.pl: * tests/Bug_2768_Regression/server.cpp: * tests/Bug_2768_Regression/run_test.pl: * tests/Blocking_Sync_None/run_test.pl: * tests/Crash_On_Write/run_test.pl: * tests/Bug_3068_Regression/run_test.pl: * tests/CSD_Strategy_Tests/TP_Test_Dynamic/run_test.pl: * tests/Bug_2683_Regression/server.cpp: * tests/Bug_2683_Regression/run_test.pl: * tests/RTScheduling/Scheduling_Interceptor/run_test.pl: * tests/File_IO/run_test.pl: * tests/Bug_1568_Regression/run_test.pl: * tests/Reliable_Oneways/run_sync_with_transport.pl: * tests/Reliable_Oneways/run_sync_none.pl: * tests/Reliable_Oneways/run_sync_with_server.pl: * tests/Reliable_Oneways/run_sync_with_target.pl: * bin/tao_other_tests.lst: * bin/tao_orb_tests.lst: Tests are converted to use new test framework and added to fuzz build.
Diffstat (limited to 'TAO/DevGuideExamples')
-rw-r--r--TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerClient.cpp34
-rw-r--r--TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp37
-rwxr-xr-xTAO/DevGuideExamples/LocalObjects/ServantLocator/run_test.pl74
-rw-r--r--TAO/DevGuideExamples/RTCORBA/MessengerClient.cpp35
-rw-r--r--TAO/DevGuideExamples/RTCORBA/MessengerServer.cpp36
-rwxr-xr-xTAO/DevGuideExamples/RTCORBA/run_test.pl69
6 files changed, 232 insertions, 53 deletions
diff --git a/TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerClient.cpp b/TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerClient.cpp
index 6c066de4b3d..8eb8b435997 100644
--- a/TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerClient.cpp
+++ b/TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerClient.cpp
@@ -2,6 +2,35 @@
#include "MessengerC.h"
#include <iostream>
+#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;
+}
int ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
@@ -9,8 +38,11 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv [])
// Initialize the ORB
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
// Converts the contents of the file to an object reference
- CORBA::Object_var obj = orb->string_to_object ("file://Messenger.ior");
+ CORBA::Object_var obj = orb->string_to_object (ior);
if (CORBA::is_nil (obj.in())) {
std::cerr << "Nill Messenger reference" << std::endl;
return 1;
diff --git a/TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp b/TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp
index 9934b61457d..2d12bde6cd0 100644
--- a/TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp
+++ b/TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp
@@ -6,12 +6,45 @@
#include "tao/AnyTypeCode/TypeCode.h"
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.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;
+}
+
int ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
try {
// Initialize the ORB
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
// Get a reference to the POA
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var rootPOA = PortableServer::POA::_narrow (obj.in());
@@ -53,11 +86,11 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv [])
CORBA::String_var str = orb->object_to_string(messenger_obj.in());
// Write the IOR string to a file
- std::ofstream iorFile("Messenger.ior"); // Throws exception if there's a problem.
+ std::ofstream iorFile(ior_output_file); // Throws exception if there's a problem.
iorFile << str.in();
iorFile.close();
- std::cout << "IOR written to the file Messenger.ior." << std::endl;
+ std::cout << "IOR written to the file " << ior_output_file << std::endl;
// Accept requests from clients.
orb->run();
diff --git a/TAO/DevGuideExamples/LocalObjects/ServantLocator/run_test.pl b/TAO/DevGuideExamples/LocalObjects/ServantLocator/run_test.pl
index 2759901997e..da138171543 100755
--- a/TAO/DevGuideExamples/LocalObjects/ServantLocator/run_test.pl
+++ b/TAO/DevGuideExamples/LocalObjects/ServantLocator/run_test.pl
@@ -1,37 +1,63 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
# $Id$
+# -*- perl -*-
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
- & eval 'exec perl -S $0 $argv:q'
- if 0;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
+$status = 0;
+$debug_level = '0';
-$messenger_ior = "Messenger.ior";
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
-unlink $messenger_ior;
+my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
+my $iorbase = "Messenger.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
# start MessengerServer
-$S = new PerlACE::Process("MessengerServer");
-$S->Spawn();
-if (PerlACE::waitforfile_timed ($messenger_ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file <$implrepo_ior>\n";
- $S->Kill();
+$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile");
+$server_status = $SV->Spawn ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
exit 1;
}
-
-# start MessengerClient
-$C = new PerlACE::Process("MessengerClient");
-
-if ($C->SpawnWaitKill(15) != 0) {
- print STDERR "ERROR: client failed\n";
- $S->Kill();
- exit 1;
+
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
+
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
}
-$S->Kill();
+$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
-unlink $messenger_ior;
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
-exit 0;
+exit $status;
diff --git a/TAO/DevGuideExamples/RTCORBA/MessengerClient.cpp b/TAO/DevGuideExamples/RTCORBA/MessengerClient.cpp
index 873c17036b4..e1df21b61ef 100644
--- a/TAO/DevGuideExamples/RTCORBA/MessengerClient.cpp
+++ b/TAO/DevGuideExamples/RTCORBA/MessengerClient.cpp
@@ -4,6 +4,36 @@
#include "common.h"
#include <iostream>
#include "tao/RTCORBA/RTCORBA.h"
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_file = ACE_TEXT ("file://Messenger.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_file = 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;
+}
+
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
@@ -12,6 +42,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
// Get the RTORB
CORBA::Object_var obj = orb->resolve_initial_references("RTORB");
RTCORBA::RTORB_var rt_orb = RTCORBA::RTORB::_narrow (obj.in());
@@ -26,7 +59,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
}
// Destringify ior
- obj = orb->string_to_object( "file://Messenger.ior" );
+ obj = orb->string_to_object(ior_file);
if( CORBA::is_nil( obj.in() ) ) {
std::cerr << "Nil Messenger reference" << std::endl;
return 1;
diff --git a/TAO/DevGuideExamples/RTCORBA/MessengerServer.cpp b/TAO/DevGuideExamples/RTCORBA/MessengerServer.cpp
index cafb18fc4b3..f28ba301e8f 100644
--- a/TAO/DevGuideExamples/RTCORBA/MessengerServer.cpp
+++ b/TAO/DevGuideExamples/RTCORBA/MessengerServer.cpp
@@ -6,6 +6,35 @@
#include <fstream>
#include <fstream>
#include "tao/RTCORBA/RTCORBA.h"
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.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;
+}
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
@@ -14,6 +43,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
// Get the RTORB.
CORBA::Object_var obj = orb->resolve_initial_references("RTORB");
RTCORBA::RTORB_var rt_orb = RTCORBA::RTORB::_narrow(obj.in());
@@ -81,10 +113,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
CORBA::Object_var messenger_obj =
client_propagated_poa->id_to_reference( oid.in() );
CORBA::String_var str = orb->object_to_string( messenger_obj.in() );
- std::ofstream iorFile( "Messenger.ior" );
+ std::ofstream iorFile(ior_output_file);
iorFile << str.in() << std::endl;
iorFile.close();
- std::cout << "IOR written to file Messenger.ior" << std::endl;
+ std::cout << "IOR written to file " << ior_output_file << std::endl;
// Accept requests
orb->run();
diff --git a/TAO/DevGuideExamples/RTCORBA/run_test.pl b/TAO/DevGuideExamples/RTCORBA/run_test.pl
index dd517dab384..48de78c80c1 100755
--- a/TAO/DevGuideExamples/RTCORBA/run_test.pl
+++ b/TAO/DevGuideExamples/RTCORBA/run_test.pl
@@ -1,39 +1,62 @@
-# $Id$
-
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
+# $Id$
+# -*- perl -*-
-$ior="Messenger.ior";
-unlink $ior;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
-# start MessengerServer
-$S = new PerlACE::Process("MessengerServer");
-$S->Spawn();
-if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file $ior\n";
- $S->Kill();
- exit 1;
+$status = 0;
+$debug_level = '0';
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
}
+my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
+my $iorbase = "Messenger.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
-# start MessengerClient
-$C = new PerlACE::Process("MessengerClient");
+$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile");
+$server_status = $SV->Spawn ();
-if ($C->SpawnWaitKill(10) != 0) {
- $S->Kill();
- exit (1);
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ exit 1;
}
-# clean-up
-$S->Kill();
-unlink $ior;
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
-exit 0;
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
+}
+
+$server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+exit $status;