summaryrefslogtreecommitdiff
path: root/TAO/tests/LongWrites
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-04-24 08:02:58 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-04-24 08:02:58 +0000
commite588f487fe14b34a642a62bd0cb53877a42b4793 (patch)
tree8c0bc2f7aa508472a4fd98dfca9d6afd60130f52 /TAO/tests/LongWrites
parentad7f2d4ae4273710073d841fe5afccaf14e6718a (diff)
downloadATCD-e588f487fe14b34a642a62bd0cb53877a42b4793.tar.gz
ChangeLogTag:Tue Apr 24 00:21:54 2001 Carlos O'Ryan <coryan@uci.edu>
Diffstat (limited to 'TAO/tests/LongWrites')
-rw-r--r--TAO/tests/LongWrites/Coordinator.cpp12
-rw-r--r--TAO/tests/LongWrites/Coordinator.h17
-rw-r--r--TAO/tests/LongWrites/Makefile4
-rw-r--r--TAO/tests/LongWrites/Receiver.cpp29
-rw-r--r--TAO/tests/LongWrites/Receiver.h9
-rw-r--r--TAO/tests/LongWrites/Sender.cpp79
-rw-r--r--TAO/tests/LongWrites/Sender.h37
-rw-r--r--TAO/tests/LongWrites/Sender_Task.cpp33
-rw-r--r--TAO/tests/LongWrites/Sender_Task.h45
-rw-r--r--TAO/tests/LongWrites/Test.idl10
-rw-r--r--TAO/tests/LongWrites/client.cpp49
-rwxr-xr-xTAO/tests/LongWrites/run_test.pl66
-rw-r--r--TAO/tests/LongWrites/server.cpp29
13 files changed, 363 insertions, 56 deletions
diff --git a/TAO/tests/LongWrites/Coordinator.cpp b/TAO/tests/LongWrites/Coordinator.cpp
index 8520ae19963..d9e382e42d0 100644
--- a/TAO/tests/LongWrites/Coordinator.cpp
+++ b/TAO/tests/LongWrites/Coordinator.cpp
@@ -5,8 +5,11 @@
ACE_RCSID(LongWrites, Coordinator, "$Id$")
-Coordinator::Coordinator (void)
- : shutdown_called_ (0)
+Coordinator::Coordinator (CORBA::ULong initial_payload_size,
+ CORBA::Long test_iterations)
+ : initial_payload_size_ (initial_payload_size)
+ , test_iterations_ (test_iterations)
+ , shutdown_called_ (0)
, pairs_count_ (0)
, pairs_length_ (16)
{
@@ -59,12 +62,13 @@ Coordinator::start (CORBA::Environment &ACE_TRY_ENV)
}
}
- CORBA::ULong event_size = 256 * 1024;
+ CORBA::ULong event_size = this->initial_payload_size_;
ACE_DEBUG ((LM_DEBUG, "Running with payload = %d\n",
event_size));
for (size_t j = 0; j != this->pairs_count_; ++j)
{
- this->pairs_[j].sender->send_events (100, event_size,
+ this->pairs_[j].sender->send_events (this->test_iterations_,
+ event_size,
ACE_TRY_ENV);
ACE_CHECK;
}
diff --git a/TAO/tests/LongWrites/Coordinator.h b/TAO/tests/LongWrites/Coordinator.h
index db00336489a..9fe37a8e699 100644
--- a/TAO/tests/LongWrites/Coordinator.h
+++ b/TAO/tests/LongWrites/Coordinator.h
@@ -22,7 +22,8 @@ class Coordinator
{
public:
/// Constructor
- Coordinator (void);
+ Coordinator (CORBA::ULong initial_payload_size,
+ CORBA::Long test_iterations);
/// Destructor
virtual ~Coordinator (void);
@@ -46,13 +47,27 @@ public:
};
private:
+ /// Initial payload size
+ CORBA::ULong initial_payload_size_;
+
+ /// Number of iterations performed by each server.
+ CORBA::Long test_iterations_;
+
+ /// Synchronize internal data structure
ACE_SYNCH_MUTEX mutex_;
+ /// Set to 1 once the test has shutdown
int shutdown_called_;
+ /** @name List of pairs
+ *
+ * Implement a simple list of pairs
+ */
+ //@{
size_t pairs_count_;
size_t pairs_length_;
Pair* pairs_;
+ //@}
};
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
diff --git a/TAO/tests/LongWrites/Makefile b/TAO/tests/LongWrites/Makefile
index 07e5024de83..011d622d2c3 100644
--- a/TAO/tests/LongWrites/Makefile
+++ b/TAO/tests/LongWrites/Makefile
@@ -18,9 +18,9 @@ IDL_FILES = Test
IDL_SRC = TestC.cpp TestS.cpp
BIN = server client
-SRC = $(addsuffix .cpp, $(BIN) Receiver Sender Coordinator) $(IDL_SRC)
+SRC = $(addsuffix .cpp, $(BIN) Receiver Sender Sender_Task Coordinator) $(IDL_SRC)
-CLIENT_OBJS = client.o TestC.o TestS.o Receiver.o Sender.o
+CLIENT_OBJS = client.o TestC.o TestS.o Receiver.o Sender.o Sender_Task.o
SERVER_OBJS = server.o TestC.o TestS.o Coordinator.o
TAO_IDLFLAGS += -Ge 1
diff --git a/TAO/tests/LongWrites/Receiver.cpp b/TAO/tests/LongWrites/Receiver.cpp
index 6425de4a18a..7d7f23ea44c 100644
--- a/TAO/tests/LongWrites/Receiver.cpp
+++ b/TAO/tests/LongWrites/Receiver.cpp
@@ -11,6 +11,13 @@ Receiver::Receiver (void)
{
}
+CORBA::ULong
+Receiver::message_count (void)
+{
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return this->message_count_;
+}
+
void
Receiver::dump_results ()
{
@@ -31,5 +38,25 @@ Receiver::receive_data (const Test::Payload &payload,
this->message_count_++;
this->byte_count_ += payload.length ();
- ACE_DEBUG ((LM_DEBUG, "Receiver::receive_data\n"));
+ if (this->message_count_ % 100 == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) Receiver::receive_data %d\n",
+ this->message_count_));
+ }
+}
+
+void
+Receiver::receive_data_oneway (const Test::Payload &payload,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->receive_data (payload, ACE_TRY_ENV);
+}
+
+Test::Payload *
+Receiver::return_data (const Test::Payload &payload,
+ CORBA::Environment &)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return new Test::Payload (payload);
}
diff --git a/TAO/tests/LongWrites/Receiver.h b/TAO/tests/LongWrites/Receiver.h
index 5242259d81f..8a0b50d1d05 100644
--- a/TAO/tests/LongWrites/Receiver.h
+++ b/TAO/tests/LongWrites/Receiver.h
@@ -27,6 +27,9 @@ public:
/// Constructor
Receiver (void);
+ /// Return the number of messages received so far
+ CORBA::ULong message_count (void);
+
/// Print out the results
void dump_results (void);
@@ -34,6 +37,12 @@ public:
virtual void receive_data (const Test::Payload &payload,
CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual void receive_data_oneway (const Test::Payload &payload,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual Test::Payload *return_data (const Test::Payload &payload,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException));
private:
ACE_SYNCH_MUTEX mutex_;
diff --git a/TAO/tests/LongWrites/Sender.cpp b/TAO/tests/LongWrites/Sender.cpp
index 3d7926feb3b..e3dab2ee42b 100644
--- a/TAO/tests/LongWrites/Sender.cpp
+++ b/TAO/tests/LongWrites/Sender.cpp
@@ -5,10 +5,13 @@
ACE_RCSID(LongWrites, Sender, "$Id$")
-Sender::Sender (void)
- : receiver_count_ (0)
+Sender::Sender (int test_type)
+ : test_type_ (test_type)
+ , receiver_count_ (0)
, receiver_length_ (16)
, shutdown_called_ (0)
+ , event_count_ (0)
+ , sender_task_ (this)
{
ACE_NEW (this->receivers_, Test::Receiver_var[this->receiver_length_]);
}
@@ -18,6 +21,17 @@ Sender::~Sender (void)
delete[] this->receivers_;
}
+int
+Sender::test_done (CORBA::ULong message_count)
+{
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return
+ (this->event_count_ != 0
+ && this->receiver_count_ != 0
+ && this->shutdown_called_ != 0
+ && (4 * this->receiver_count_
+ * this->event_count_ <= message_count));
+}
int
Sender::shutdown_called (void)
@@ -28,9 +42,10 @@ Sender::shutdown_called (void)
void
Sender::add_receiver (Test::Receiver_ptr receiver,
- CORBA::Environment &)
+ CORBA::Environment &)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_);
if (this->receiver_count_ == this->receiver_length_)
{
this->receiver_length_ *= 2;
@@ -47,35 +62,79 @@ Sender::add_receiver (Test::Receiver_ptr receiver,
void
Sender::send_events (CORBA::Long event_count,
- CORBA::ULong event_size,
- CORBA::Environment &ACE_TRY_ENV)
+ CORBA::ULong event_size,
+ CORBA::Environment &)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ {
+ ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_);
+ this->event_count_ = event_count;
+ }
+
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Sender::send_events - starting threads\n"));
+
+ this->sender_task_.run_test (4, event_count, event_size);
+
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Sender::send_events - threads are active\n"));
+}
+
+int
+Sender::run_test (CORBA::Long event_count,
+ CORBA::ULong event_size)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+
Test::Payload payload(event_size); payload.length(event_size);
+ for (CORBA::ULong j = 0; j != event_size; ++j)
+ {
+ payload[j] = CORBA::Octet(j % 256);
+ }
for (CORBA::Long i = 0; i != event_count; ++i)
{
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) - running iteration %d\n", i));
for (size_t j = 0; j != this->receiver_count_; ++j)
{
ACE_TRY
{
- this->receivers_[j]->receive_data (payload,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
+ if (this->test_type_ == Sender::TEST_ONEWAY)
+ {
+ this->receivers_[j]->receive_data_oneway (payload,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ else if (this->test_type_ == Sender::TEST_WRITE)
+ {
+ this->receivers_[j]->receive_data (payload,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ Test::Payload_var retval =
+ this->receivers_[j]->return_data (payload,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCH (CORBA::TRANSIENT, ignored)
+ {
}
ACE_CATCHANY
{
+ return -1;
}
ACE_ENDTRY;
}
}
+ return 0;
}
void
Sender::shutdown (CORBA::Environment &)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutting down\n"));
ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_);
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutting down\n"));
this->shutdown_called_ = 1;
}
diff --git a/TAO/tests/LongWrites/Sender.h b/TAO/tests/LongWrites/Sender.h
index 0bcbea6d50e..219d108174a 100644
--- a/TAO/tests/LongWrites/Sender.h
+++ b/TAO/tests/LongWrites/Sender.h
@@ -7,6 +7,7 @@
#include "ace/pre.h"
#include "TestS.h"
+#include "Sender_Task.h"
#if defined (_MSC_VER)
# if (_MSC_VER >= 1200)
@@ -22,14 +23,36 @@ class Sender
{
public:
/// Constructor
- Sender (void);
+ Sender (int test_type);
/// Destructor
virtual ~Sender (void);
+ /// Control the type of test
+ enum {
+ /// Run the test using receive_data_oneway() operations
+ TEST_ONEWAY,
+ /// Run the test using receive_data() operations
+ TEST_WRITE,
+ /// Run the test using return_data() operations
+ TEST_READ_WRITE,
+ };
+
+ /// Run the test in a separate thread
+ int run_test (CORBA::Long event_count,
+ CORBA::ULong event_size);
+
+ /// Return 1 after <shutdown> is invoked and all the messages are
+ /// received.
+ int test_done (CORBA::ULong message_count);
+
/// Return 1 after <shutdown> is invoked
int shutdown_called (void);
+ /// Return 1 if the test is finished, assuming <message_count>
+ /// messages have been received by the local Receiver
+ int iteration_done (CORBA::ULong messsage_count);
+
// = The skeleton methods
virtual void add_receiver (Test::Receiver_ptr receiver,
CORBA::Environment &ACE_TRY_ENV)
@@ -42,13 +65,25 @@ public:
ACE_THROW_SPEC ((CORBA::SystemException));
private:
+ /// The type of test
+ int test_type_;
+
+ /// Synchronize the internal state
ACE_SYNCH_MUTEX mutex_;
+ /// Keep track of all the receivers
size_t receiver_count_;
size_t receiver_length_;
Test::Receiver_var *receivers_;
+ /// Set to 1 if the shutdown() operations was called.
int shutdown_called_;
+
+ /// Setup event count
+ CORBA::ULong event_count_;
+
+ /// Used to run the threads
+ Sender_Task sender_task_;
};
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
diff --git a/TAO/tests/LongWrites/Sender_Task.cpp b/TAO/tests/LongWrites/Sender_Task.cpp
new file mode 100644
index 00000000000..42a94d37f3e
--- /dev/null
+++ b/TAO/tests/LongWrites/Sender_Task.cpp
@@ -0,0 +1,33 @@
+//
+// $Id$
+//
+
+#include "Sender_Task.h"
+#include "Sender.h"
+
+ACE_RCSID(LongWrites, Sender_Task, "$Id$")
+
+Sender_Task::Sender_Task (Sender *sender)
+ : sender_ (sender)
+ , event_count_ (0)
+ , event_size_ (0)
+{
+}
+
+int
+Sender_Task::run_test (int thread_count,
+ CORBA::Long event_count,
+ CORBA::ULong event_size)
+{
+ this->event_count_ = event_count;
+ this->event_size_ = event_size;
+
+ return this->activate (THR_NEW_LWP | THR_JOINABLE, thread_count, 1);
+}
+
+int
+Sender_Task::svc (void)
+{
+ return this->sender_->run_test (this->event_count_,
+ this->event_size_);
+}
diff --git a/TAO/tests/LongWrites/Sender_Task.h b/TAO/tests/LongWrites/Sender_Task.h
new file mode 100644
index 00000000000..562923a9df7
--- /dev/null
+++ b/TAO/tests/LongWrites/Sender_Task.h
@@ -0,0 +1,45 @@
+//
+// $Id$
+//
+
+#ifndef LONGWRITES_SENDER_TASK_H
+#define LONGWRITES_SENDER_TASK_H
+#include "ace/pre.h"
+
+#include "tao/corbafwd.h"
+#include "ace/Task.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+class Sender;
+
+/// Implement a Task to run the experiments using multiple threads.
+class Sender_Task : public ACE_Task_Base
+{
+public:
+ /// Constructor
+ Sender_Task (Sender *sender);
+
+ /// Run the experiment using the configuration below
+ int run_test (int thread_count,
+ CORBA::Long event_count,
+ CORBA::ULong event_size);
+
+ /// Thread entry point
+ int svc (void);
+
+private:
+ /// Reference to the test interface
+ Sender *sender_;
+
+ /// Total number of events
+ CORBA::Long event_count_;
+
+ /// Size of each message
+ CORBA::ULong event_size_;
+};
+
+#include "ace/post.h"
+#endif /* LONGWRITES_SENDER_TASK_H */
diff --git a/TAO/tests/LongWrites/Test.idl b/TAO/tests/LongWrites/Test.idl
index 43d2eb7c3a3..de5dcee47ae 100644
--- a/TAO/tests/LongWrites/Test.idl
+++ b/TAO/tests/LongWrites/Test.idl
@@ -8,7 +8,13 @@ module Test
interface Receiver {
/// Receive a big payload
- oneway void receive_data (in Payload the_payload);
+ oneway void receive_data_oneway (in Payload the_payload);
+
+ /// Receive a big payload, using a twoway
+ void receive_data (in Payload the_payload);
+
+ /// Return the same data, useful to check the server side
+ Payload return_data (in Payload the_payload);
};
interface Sender {
@@ -20,7 +26,7 @@ module Test
in unsigned long event_size);
/// Shutdown the sender
- oneway void shutdown();
+ void shutdown();
};
interface Coordinator {
diff --git a/TAO/tests/LongWrites/client.cpp b/TAO/tests/LongWrites/client.cpp
index 5557ded8776..2c890404d66 100644
--- a/TAO/tests/LongWrites/client.cpp
+++ b/TAO/tests/LongWrites/client.cpp
@@ -8,23 +8,39 @@ ACE_RCSID(LongWrites, client, "$Id$")
const char *ior = "file://test.ior";
+int test_type = Sender::TEST_ONEWAY;
+
int
parse_args (int argc, char *argv[])
{
- ACE_Get_Opt get_opts (argc, argv, "k:");
+ ACE_Get_Opt get_opts (argc, argv, "k:t:");
int c;
while ((c = get_opts ()) != -1)
switch (c)
{
case 'k':
- ior = get_opts.optarg;
- break;
+ ior = get_opts.optarg;
+ break;
+ case 't':
+ if (ACE_OS_String::strcasecmp(get_opts.optarg, "ONEWAY") == 0)
+ test_type = Sender::TEST_ONEWAY;
+ else if (ACE_OS_String::strcasecmp(get_opts.optarg, "WRITE") == 0)
+ test_type = Sender::TEST_WRITE;
+ else if (ACE_OS_String::strcasecmp(get_opts.optarg, "READ_WRITE") == 0)
+ test_type = Sender::TEST_READ_WRITE;
+ else
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unknown test type %s\n",
+ get_opts.optarg), 1);
+ break;
+
case '?':
default:
ACE_ERROR_RETURN ((LM_ERROR,
"usage: %s "
- "-k <ior>"
+ "-k <ior> "
+ "-t <test_type (ONEWAY,WRITE,READ_WRITE)> "
"\n",
argv [0]),
-1);
@@ -90,7 +106,7 @@ main (int argc, char *argv[])
Sender *sender_impl;
ACE_NEW_RETURN (sender_impl,
- Sender,
+ Sender (test_type),
1);
PortableServer::ServantBase_var sender_owner_transfer(sender_impl);
@@ -105,18 +121,38 @@ main (int argc, char *argv[])
ACE_TRY_ENV);
ACE_TRY_CHECK;
- while (!sender_impl->shutdown_called ())
+ for (int i = 0; i != 600; ++i)
{
ACE_Time_Value tv(1, 0);
orb->run (tv, ACE_TRY_ENV);
ACE_TRY_CHECK;
+
+ CORBA::ULong message_count =
+ receiver_impl->message_count ();
+ if (sender_impl->test_done (message_count))
+ break;
}
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) - client event loop done\n"));
+
+ ACE_Thread_Manager::instance ()->wait ();
+
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) client - threads finished\n"));
root_poa->destroy (1, 1, ACE_TRY_ENV);
ACE_TRY_CHECK;
orb->destroy (ACE_TRY_ENV);
ACE_TRY_CHECK;
+
+ CORBA::ULong message_count =
+ receiver_impl->message_count ();
+ if (!sender_impl->test_done (message_count))
+ {
+ ACE_ERROR ((LM_ERROR,
+ "ERROR: missing messages, only received %d\n",
+ message_count));
+ }
}
ACE_CATCHANY
{
@@ -126,5 +162,6 @@ main (int argc, char *argv[])
}
ACE_ENDTRY;
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) - client finished\n"));
return 0;
}
diff --git a/TAO/tests/LongWrites/run_test.pl b/TAO/tests/LongWrites/run_test.pl
index 71eafcca0b4..8b6f21474a8 100755
--- a/TAO/tests/LongWrites/run_test.pl
+++ b/TAO/tests/LongWrites/run_test.pl
@@ -7,54 +7,76 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
use lib '../../../bin';
use PerlACE::Run_Test;
+use Getopt::Std;
+
+local ($opt_i, $opt_p);
+
+if (!getopts ('i:p:')) {
+ print "Usage: run_test.pl [-p payload_size] [-i iterations]\n";
+ exit 1;
+}
+
+my $server_args = "";
+if (defined $opt_i) {
+ $server_args .= " -i ".$opt_i;
+}
+if (defined $opt_p) {
+ $server_args .= " -p ".$opt_p;
+}
$iorfile = PerlACE::LocalFile ("server.ior");
-unlink $iorfile;
-$SV = new PerlACE::Process ("server", "-o $iorfile");
-$CL1 = new PerlACE::Process ("client", " -k file://$iorfile ");
-$CL2 = new PerlACE::Process ("client", " -k file://$iorfile ");
-$CL3 = new PerlACE::Process ("client", " -k file://$iorfile ");
+foreach my $i ("ONEWAY") { # , "WRITE", "READ_WRITE") {
+
+ print "================ Running test $i ================\n";
+
+
+ unlink $iorfile;
+ $SV = new PerlACE::Process ("server", "-o $iorfile $server_args");
+ $CL1 = new PerlACE::Process ("client", " -k file://$iorfile -t $i");
+ $CL2 = new PerlACE::Process ("client", " -k file://$iorfile -t $i");
+ $CL3 = new PerlACE::Process ("client", " -k file://$iorfile -t $i");
-$SV->Spawn ();
+ $SV->Spawn ();
-if (PerlACE::waitforfile_timed ($iorfile, 5) == -1) {
+ if (PerlACE::waitforfile_timed ($iorfile, 5) == -1) {
print STDERR "ERROR: cannot find file <$iorfile>\n";
$SV->Kill (); $SV->TimedWait (1);
exit 1;
-}
+ }
-$CL1->Spawn (60);
-$CL2->Spawn (60);
-$CL3->Spawn (60);
+ $CL1->Spawn (1200);
+ $CL2->Spawn (1200);
+ $CL3->Spawn (1200);
-$client1 = $CL1->WaitKill (60);
+ $client1 = $CL1->WaitKill (60);
-if ($client1 != 0) {
+ if ($client1 != 0) {
print STDERR "ERROR: client 1 returned $client1\n";
$status = 1;
-}
+ }
-$client2 = $CL2->WaitKill (60);
+ $client2 = $CL2->WaitKill (60);
-if ($client2 != 0) {
+ if ($client2 != 0) {
print STDERR "ERROR: client 2 returned $client2\n";
$status = 1;
-}
+ }
-$client3 = $CL3->WaitKill (60);
+ $client3 = $CL3->WaitKill (60);
-if ($client3 != 0) {
+ if ($client3 != 0) {
print STDERR "ERROR: client 3 returned $client3\n";
$status = 1;
-}
+ }
-$server = $SV->TerminateWaitKill (5);
+ $server = $SV->TerminateWaitKill (5);
-if ($server != 0) {
+ if ($server != 0) {
print STDERR "ERROR: server returned $server\n";
$status = 1;
+ }
}
unlink $iorfile;
diff --git a/TAO/tests/LongWrites/server.cpp b/TAO/tests/LongWrites/server.cpp
index b57cafb201c..b431d67845b 100644
--- a/TAO/tests/LongWrites/server.cpp
+++ b/TAO/tests/LongWrites/server.cpp
@@ -8,23 +8,37 @@ ACE_RCSID(LongWrites, server, "$Id$")
const char *ior_output_file = "test.ior";
+CORBA::ULong initial_event_size = 64 * 1024;
+CORBA::Long test_iterations = 50;
+
int
parse_args (int argc, char *argv[])
{
- ACE_Get_Opt get_opts (argc, argv, "o:");
+ ACE_Get_Opt get_opts (argc, argv, "o:p:i:");
int c;
while ((c = get_opts ()) != -1)
switch (c)
{
case 'o':
- ior_output_file = get_opts.optarg;
- break;
+ ior_output_file = get_opts.optarg;
+ break;
+
+ case 'p':
+ initial_event_size = ACE_OS::atoi (get_opts.optarg);
+ break;
+
+ case 'i':
+ test_iterations = ACE_OS::atoi (get_opts.optarg);
+ break;
+
case '?':
default:
ACE_ERROR_RETURN ((LM_ERROR,
"usage: %s "
- "-o <iorfile>"
+ "-o <iorfile> "
+ "-p <payload_size> "
+ "-i <test_iterations> "
"\n",
argv [0]),
-1);
@@ -64,7 +78,8 @@ main (int argc, char *argv[])
Coordinator *coordinator_impl;
ACE_NEW_RETURN (coordinator_impl,
- Coordinator,
+ Coordinator (initial_event_size,
+ test_iterations),
1);
PortableServer::ServantBase_var coordinator_owner_transfer(coordinator_impl);
@@ -73,7 +88,7 @@ main (int argc, char *argv[])
ACE_TRY_CHECK;
CORBA::String_var ior =
- orb->object_to_string (coordinator.in (), ACE_TRY_ENV);
+ orb->object_to_string (coordinator.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
// If the ior_output_file exists, output the ior to it
@@ -82,7 +97,7 @@ main (int argc, char *argv[])
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open output file for writing IOR: %s",
ior_output_file),
- 1);
+ 1);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);