summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-03-13 23:12:22 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-03-13 23:12:22 +0000
commitb44ff547b75023e6216590212262ad12302b9648 (patch)
tree161fdbd0b803fcf09c7cad5e79e50fbd2e4aca5d
parent69ffd08aa8ca4d73ec0fef83a2b8d14a17bc0f37 (diff)
downloadATCD-b44ff547b75023e6216590212262ad12302b9648.tar.gz
ChangeLogTag:Tue Mar 13 15:08:06 2001 Carlos O'Ryan <coryan@uci.edu>
-rw-r--r--TAO/ChangeLogs/ChangeLog-02a31
-rw-r--r--TAO/tao/GIOP_Message_Handler.cpp2
-rw-r--r--TAO/tests/Big_Oneways/Big_Oneways.dsw29
-rw-r--r--TAO/tests/Big_Oneways/Coordinator.cpp70
-rw-r--r--TAO/tests/Big_Oneways/Coordinator.h62
-rw-r--r--TAO/tests/Big_Oneways/Makefile58
-rw-r--r--TAO/tests/Big_Oneways/Peer.cpp46
-rw-r--r--TAO/tests/Big_Oneways/Peer.h47
-rw-r--r--TAO/tests/Big_Oneways/README21
-rw-r--r--TAO/tests/Big_Oneways/Session.cpp210
-rw-r--r--TAO/tests/Big_Oneways/Session.h99
-rw-r--r--TAO/tests/Big_Oneways/Session_Control.cpp75
-rw-r--r--TAO/tests/Big_Oneways/Session_Control.h57
-rw-r--r--TAO/tests/Big_Oneways/Session_Task.cpp19
-rw-r--r--TAO/tests/Big_Oneways/Session_Task.h33
-rw-r--r--TAO/tests/Big_Oneways/Test.idl74
-rw-r--r--TAO/tests/Big_Oneways/client.cpp112
-rw-r--r--TAO/tests/Big_Oneways/client.dsp216
-rwxr-xr-xTAO/tests/Big_Oneways/run_test.pl84
-rw-r--r--TAO/tests/Big_Oneways/server.cpp210
-rw-r--r--TAO/tests/Big_Oneways/server.dsp216
-rw-r--r--TAO/tests/Makefile3
-rw-r--r--TAO/tests/README4
23 files changed, 1776 insertions, 2 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a
index 9dd7857b1de..9ce078ab397 100644
--- a/TAO/ChangeLogs/ChangeLog-02a
+++ b/TAO/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,34 @@
+Tue Mar 13 15:08:06 2001 Carlos O'Ryan <coryan@uci.edu>
+
+ * tests/README:
+ * tests/Makefile:
+ * tests/Big_Oneways/README:
+ * tests/Big_Oneways/Test.idl:
+ * tests/Big_Oneways/Makefile:
+ * tests/Big_Oneways/Big_Oneways.dsw:
+ * tests/Big_Oneways/server.dsp:
+ * tests/Big_Oneways/client.dsp:
+ * tests/Big_Oneways/run_test.pl:
+ * tests/Big_Oneways/Coordinator.h:
+ * tests/Big_Oneways/Coordinator.cpp:
+ * tests/Big_Oneways/Peer.h:
+ * tests/Big_Oneways/Peer.cpp:
+ * tests/Big_Oneways/Session.h:
+ * tests/Big_Oneways/Session.cpp:
+ * tests/Big_Oneways/Session_Control.h:
+ * tests/Big_Oneways/Session_Control.cpp:
+ * tests/Big_Oneways/Session_Task.h:
+ * tests/Big_Oneways/Session_Task.cpp:
+ * tests/Big_Oneways/client.cpp:
+ * tests/Big_Oneways/server.cpp:
+ Add new stress test for the non-blocking I/O features in the
+ ORB. This test is more focussed than LongWrites, and its
+ shutdown sequence is better designed (LongWrites tends to crash
+ after running successfully.)
+
+ * tao/GIOP_Message_Handler.cpp:
+ Fixed unsigned/signed warning
+
Thu Mar 8 19:12:48 2001 Carlos O'Ryan <coryan@uci.edu>
* tao/GIOP_Message_Base.cpp:
diff --git a/TAO/tao/GIOP_Message_Handler.cpp b/TAO/tao/GIOP_Message_Handler.cpp
index d121bf4428f..18f80941750 100644
--- a/TAO/tao/GIOP_Message_Handler.cpp
+++ b/TAO/tao/GIOP_Message_Handler.cpp
@@ -470,7 +470,7 @@ TAO_GIOP_Message_Handler::read_messages (TAO_Transport *transport)
n));
size_t len;
- for (size_t offset = 0; offset < n; offset += len)
+ for (size_t offset = 0; offset < size_t(n); offset += len)
{
len = n - offset;
if (len > 512)
diff --git a/TAO/tests/Big_Oneways/Big_Oneways.dsw b/TAO/tests/Big_Oneways/Big_Oneways.dsw
new file mode 100644
index 00000000000..58b9723d57e
--- /dev/null
+++ b/TAO/tests/Big_Oneways/Big_Oneways.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Big_Oneways server"=.\server.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/tests/Big_Oneways/Coordinator.cpp b/TAO/tests/Big_Oneways/Coordinator.cpp
new file mode 100644
index 00000000000..3d8906e1ecf
--- /dev/null
+++ b/TAO/tests/Big_Oneways/Coordinator.cpp
@@ -0,0 +1,70 @@
+//
+// $Id$
+//
+#include "Coordinator.h"
+
+ACE_RCSID(Big_Oneways, Coordinator, "$Id$")
+
+Coordinator::Coordinator (CORBA::ULong peer_count)
+ : peers_ (0)
+ , peer_count_ (0)
+ , peer_max_ (peer_count)
+{
+ ACE_NEW (this->peers_, Test::Peer_var[this->peer_max_]);
+}
+
+Coordinator::~Coordinator (void)
+{
+ delete[] this->peers_;
+}
+
+int
+Coordinator::has_all_peers (void) const
+{
+ return this->peer_count_ == this->peer_max_;
+}
+
+void
+Coordinator::create_session_list (Test::Session_Control_ptr session_control,
+ Test::Session_List &session_list,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ session_list.length (this->peer_count_);
+ CORBA::ULong count = 0;
+ for (Test::Peer_var *i = this->peers_;
+ i != this->peers_ + this->peer_count_;
+ ++i)
+ {
+ session_list[count++] =
+ (*i)->create_session (session_control, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+}
+
+void
+Coordinator::shutdown_all_peers (CORBA::Environment &ACE_TRY_ENV)
+{
+ for (Test::Peer_var *i = this->peers_;
+ i != this->peers_ + this->peer_count_;
+ ++i)
+ {
+ ACE_TRY
+ {
+ (*i)->shutdown (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY {} ACE_ENDTRY;
+ }
+}
+
+void
+Coordinator::add_peer (Test::Peer_ptr peer,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->peer_count_ >= this->peer_max_)
+ return;
+
+ this->peers_[this->peer_count_++] =
+ Test::Peer::_duplicate (peer);
+}
diff --git a/TAO/tests/Big_Oneways/Coordinator.h b/TAO/tests/Big_Oneways/Coordinator.h
new file mode 100644
index 00000000000..f89335044a8
--- /dev/null
+++ b/TAO/tests/Big_Oneways/Coordinator.h
@@ -0,0 +1,62 @@
+//
+// $Id$
+//
+
+#ifndef BIG_ONEWAYS_COORDINATOR_H
+#define BIG_ONEWAYS_COORDINATOR_H
+#include "ace/pre.h"
+
+#include "TestS.h"
+
+#if defined (_MSC_VER)
+# if (_MSC_VER >= 1200)
+# pragma warning(push)
+# endif /* _MSC_VER >= 1200 */
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+/// Implement the Test::Coordinator interface
+class Coordinator
+ : public virtual POA_Test::Coordinator
+ , public virtual PortableServer::RefCountServantBase
+{
+public:
+ /// Constructor
+ Coordinator (CORBA::ULong peer_count);
+
+ /// Destructor
+ virtual ~Coordinator (void);
+
+ /// Check if all the peers have registered already
+ int has_all_peers (void) const;
+
+ /// Check a session on each peer
+ void create_session_list (Test::Session_Control_ptr session_control,
+ Test::Session_List &session_list,
+ CORBA::Environment &ACE_TRY_ENV);
+
+ /// Shutdown all the peers
+ void shutdown_all_peers (CORBA::Environment &ACE_TRY_ENV);
+
+ // = The skeleton methods
+ virtual void add_peer (Test::Peer_ptr peer,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ /// Store a reference to each peer
+ Test::Peer_var *peers_;
+
+ /// Current number of elements in the array
+ size_t peer_count_;
+
+ /// Array's capacity
+ size_t peer_max_;
+};
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include "ace/post.h"
+#endif /* BIG_ONEWAYS_COORDINATOR_H */
diff --git a/TAO/tests/Big_Oneways/Makefile b/TAO/tests/Big_Oneways/Makefile
new file mode 100644
index 00000000000..ef0bf8c6ce4
--- /dev/null
+++ b/TAO/tests/Big_Oneways/Makefile
@@ -0,0 +1,58 @@
+#----------------------------------------------------------------------------
+#
+# $Id$
+#
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+ifndef TAO_ROOT
+ TAO_ROOT = $(ACE_ROOT)/TAO
+endif # ! TAO_ROOT
+
+LDLIBS = -lTAO
+
+IDL_FILES = Test
+IDL_SRC = TestC.cpp TestS.cpp
+BIN = server client
+
+SRC = $(addsuffix .cpp, $(BIN) Coordinator Peer Session Session_Control Session_Task) $(IDL_SRC)
+
+CLIENT_OBJS = client.o TestC.o TestS.o Peer.o Session.o Session_Task.o
+SERVER_OBJS = server.o TestC.o TestS.o Coordinator.o Session_Control.o
+
+TAO_IDLFLAGS += -Ge 1
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(TAO_ROOT)/rules.tao.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+include $(TAO_ROOT)/taoconfig.mk
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+.PRECIOUS: $(foreach ext, $(IDL_EXT), Test$(ext))
+
+server: $(addprefix $(VDIR),$(SERVER_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(TAO_SRVR_LIBS) $(POSTLINK)
+
+client: $(addprefix $(VDIR),$(CLIENT_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(TAO_SRVR_LIBS) $(POSTLINK)
+
+realclean: clean
+ -$(RM) $(foreach ext, $(IDL_EXT), Test$(ext))
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/tests/Big_Oneways/Peer.cpp b/TAO/tests/Big_Oneways/Peer.cpp
new file mode 100644
index 00000000000..fbb85bcea96
--- /dev/null
+++ b/TAO/tests/Big_Oneways/Peer.cpp
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+#include "Peer.h"
+#include "Session.h"
+
+ACE_RCSID(Big_Oneways, Peer, "$Id$")
+
+Peer::Peer (CORBA::ORB_ptr orb)
+ : orb_ (CORBA::ORB::_duplicate (orb))
+{
+}
+
+Peer::~Peer (void)
+{
+}
+
+Test::Session_ptr
+Peer::create_session (Test::Session_Control_ptr control,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ Session *session_impl;
+ ACE_NEW_THROW_EX (session_impl,
+ Session (control),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (Test::Session::_nil ());
+ PortableServer::ServantBase_var transfer_ownership (session_impl);
+
+ return session_impl->_this (ACE_TRY_ENV);
+}
+
+void
+Peer::shutdown (CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Peer::shutdown, waiting for threads\n"));
+
+ // Wait for all the threads.
+ ACE_Thread_Manager::instance ()->wait ();
+
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Peer::shutdown, shutting down ORB\n"));
+ this->orb_->shutdown (0, ACE_TRY_ENV);
+}
diff --git a/TAO/tests/Big_Oneways/Peer.h b/TAO/tests/Big_Oneways/Peer.h
new file mode 100644
index 00000000000..b2e502f6072
--- /dev/null
+++ b/TAO/tests/Big_Oneways/Peer.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+
+#ifndef BIG_ONEWAYS_PEER_H
+#define BIG_ONEWAYS_PEER_H
+#include "ace/pre.h"
+
+#include "TestS.h"
+
+#if defined (_MSC_VER)
+# if (_MSC_VER >= 1200)
+# pragma warning(push)
+# endif /* _MSC_VER >= 1200 */
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+/// Implement the Test::Peer interface
+class Peer
+ : public virtual POA_Test::Peer
+ , public virtual PortableServer::RefCountServantBase
+{
+public:
+ /// Constructor
+ Peer (CORBA::ORB_ptr orb);
+
+ /// Destructor
+ virtual ~Peer (void);
+
+ // = The skeleton methods
+ virtual Test::Session_ptr create_session (Test::Session_Control_ptr control,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual void shutdown (CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ /// Keep a pointer to the ORB to shutdown cleanly
+ CORBA::ORB_var orb_;
+};
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include "ace/post.h"
+#endif /* BIG_ONEWAYS_PEER_H */
diff --git a/TAO/tests/Big_Oneways/README b/TAO/tests/Big_Oneways/README
new file mode 100644
index 00000000000..ed389e9009c
--- /dev/null
+++ b/TAO/tests/Big_Oneways/README
@@ -0,0 +1,21 @@
+/**
+
+@page Big_Oneways Test README File
+
+ This is a stress test for the non-blocking I/O features in the
+ORB. The test connects multiple peer processes together. Each
+process sends messages to all its peers, using multiple threads to
+generate the messages. Without non-blocking I/O the system soon
+deadlocks.
+
+ This is part of the regression testsuite for:
+
+http://ace.cs.wustl.edu/bugzilla/show_bug.cgi?id=132
+
+ To run the test use the run_test.pl script:
+
+$ ./run_test.pl
+
+ the script returns 0 if the test was successful.
+
+*/
diff --git a/TAO/tests/Big_Oneways/Session.cpp b/TAO/tests/Big_Oneways/Session.cpp
new file mode 100644
index 00000000000..5c031aaf4b1
--- /dev/null
+++ b/TAO/tests/Big_Oneways/Session.cpp
@@ -0,0 +1,210 @@
+//
+// $Id$
+//
+#include "Session.h"
+
+ACE_RCSID(Big_Oneways, Session, "$Id$")
+
+Session::Session (Test::Session_Control_ptr control)
+ : control_ (Test::Session_Control::_duplicate (control))
+ , running_ (0)
+ , thread_count_ (0)
+ , payload_size_ (0)
+ , message_count_ (0)
+ , active_thread_count_ (0)
+ , expected_messages_ (0)
+ , task_ (this)
+{
+}
+
+Session::~Session (void)
+{
+}
+
+int
+Session::svc (void)
+{
+ /// Automatically decrease the reference count at the end of the
+ /// thread
+ PortableServer::ServantBase_var auto_decrement (this);
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ // Use the same payload over and over
+ Test::Payload payload (this->payload_size_);
+ payload.length (this->payload_size_);
+
+ // Get the number of peers just once.
+ CORBA::ULong session_count =
+ this->other_sessions_.length ();
+
+ for (CORBA::ULong i = 0; i != this->message_count_; ++i)
+ {
+#if 0
+ if (i % 500 == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Session::svc, "
+ "sending message %d\n",
+ i));
+ }
+#endif /* 0 */
+ for (CORBA::ULong j = 0; j != session_count; ++j)
+ {
+ this->other_sessions_[j]->receive_payload (payload,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ }
+
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, -1);
+ this->active_thread_count_--;
+ this->check_for_termination (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+void
+Session::start (const Test::Session_List &other_sessions,
+ CORBA::ULong payload_size,
+ CORBA::ULong thread_count,
+ CORBA::ULong message_count,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Test::Already_Running,
+ Test::No_Peers))
+{
+ if (other_sessions.length () == 0)
+ ACE_THROW (Test::No_Peers ());
+
+ ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_);
+ if (this->running_)
+ ACE_THROW (Test::Already_Running ());
+
+ this->other_sessions_ = other_sessions;
+ this->payload_size_ = payload_size;
+ this->thread_count_ = thread_count;
+ this->message_count_ = message_count;
+
+ this->expected_messages_ =
+ (other_sessions.length ()
+ * this->thread_count_
+ * this->message_count_);
+
+ for (CORBA::ULong i = 0; i != this->thread_count_; ++i)
+ {
+ // Increase the reference count because the new thread will have
+ // access to this object....
+ ACE_TRY
+ {
+ this->_add_ref (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ if (this->task_.activate (
+ THR_NEW_LWP | THR_JOINABLE, 1, 1) == -1)
+ {
+ this->_remove_ref (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ this->running_ = 1;
+ this->active_thread_count_++;
+ }
+ }
+ ACE_CATCHANY {} ACE_ENDTRY;
+ }
+
+ if (this->running_ == 0)
+ {
+ /// None of the threads are running, this session is useless at
+ /// this point, report the problem and destroy the local objects
+ this->terminate (0, ACE_TRY_ENV);
+ ACE_CHECK;
+ }
+}
+
+void
+Session::receive_payload (const Test::Payload &the_payload,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (the_payload.length () != this->payload_size_)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "ERROR: (%P|%t) Session::receive_payload, "
+ "unexpected payload size (%d != %d)\n",
+ the_payload.length (), this->payload_size_));
+ }
+ ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_);
+ this->expected_messages_--;
+
+#if 0
+ int verbose = this->expected_messages_ % 500 == 0;
+ if (this->expected_messages_ < 500)
+ verbose = (this->expected_messages_ % 100 == 0);
+ if (this->expected_messages_ < 100)
+ verbose = (this->expected_messages_ % 10 == 0);
+ if (this->expected_messages_ < 10)
+ verbose = 1;
+
+ if (verbose)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Session::receive_payload, "
+ "%d messages to go\n",
+ this->expected_messages_));
+ }
+#endif /* 0 */
+ this->check_for_termination (ACE_TRY_ENV);
+}
+
+void
+Session::check_for_termination (CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC (())
+{
+ if (this->expected_messages_ > 0
+ || this->active_thread_count_ > 0)
+ return;
+
+ this->terminate (1, ACE_TRY_ENV);
+}
+
+void
+Session::terminate (CORBA::Boolean success,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC (())
+{
+ // Make sure local resources are released
+ ACE_TRY_EX(LOCAL)
+ {
+ PortableServer::POA_var poa =
+ this->_default_POA (ACE_TRY_ENV);
+ ACE_CHECK;
+ PortableServer::ObjectId_var oid =
+ poa->servant_to_id (this, ACE_TRY_ENV);
+ ACE_CHECK;
+ poa->deactivate_object (oid.in (), ACE_TRY_ENV);
+ ACE_CHECK;
+ }
+ ACE_CATCHANY {} ACE_ENDTRY;
+
+ // Make sure that global resources are released
+ ACE_TRY_EX(GLOBAL)
+ {
+ this->control_->session_finished (success,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK_EX(GLOBAL);
+ }
+ ACE_CATCHANY {} ACE_ENDTRY;
+
+}
diff --git a/TAO/tests/Big_Oneways/Session.h b/TAO/tests/Big_Oneways/Session.h
new file mode 100644
index 00000000000..5823b15c7c9
--- /dev/null
+++ b/TAO/tests/Big_Oneways/Session.h
@@ -0,0 +1,99 @@
+//
+// $Id$
+//
+
+#ifndef BIG_ONEWAYS_SESSION_H
+#define BIG_ONEWAYS_SESSION_H
+#include "ace/pre.h"
+
+#include "TestS.h"
+#include "Session_Task.h"
+
+#if defined (_MSC_VER)
+# if (_MSC_VER >= 1200)
+# pragma warning(push)
+# endif /* _MSC_VER >= 1200 */
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+/// Implement the Test::Session interface
+class Session
+ : public virtual POA_Test::Session
+ , public virtual PortableServer::RefCountServantBase
+{
+public:
+ /// Constructor
+ Session (Test::Session_Control_ptr control);
+
+ /// Destructor
+ virtual ~Session (void);
+
+ /// Run one of the experiment threads
+ int svc (void);
+
+ // = The skeleton methods
+ virtual void start (const Test::Session_List &other_sessions,
+ CORBA::ULong payload_size,
+ CORBA::ULong thread_count,
+ CORBA::ULong message_count,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Test::Already_Running,
+ Test::No_Peers));
+
+ virtual void receive_payload (const Test::Payload &the_payload,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ /// Helper function used to report any problems and destroy local
+ /// resources
+ void terminate (CORBA::Boolean success,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC (());
+
+ /// Helper function used to report any problems and destroy local
+ /// resources
+ void check_for_termination (CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC (());
+
+private:
+ /// Synchronize the internal state
+ ACE_SYNCH_MUTEX mutex_;
+
+ /// Keep a reference to the Session_Control, this is used to report
+ /// when the test finishes.
+ Test::Session_Control_var control_;
+
+ /// Keep track of wether the test is running.
+ int running_;
+
+ /// The other session objects participating in the test
+ Test::Session_List other_sessions_;
+
+ /// Size of each message
+ CORBA::ULong payload_size_;
+
+ /// Number of threads
+ CORBA::ULong thread_count_;
+
+ /// Number of messages to send
+ CORBA::ULong message_count_;
+
+ /// The number of threads currently running, when this reaches 0 the
+ /// session destroys itself.
+ int active_thread_count_;
+
+ /// Number of messages expected
+ CORBA::ULong expected_messages_;
+
+ /// Helper class to run svc() in a separate thread
+ Session_Task task_;
+};
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include "ace/post.h"
+#endif /* BIG_ONEWAYS_SESSION_H */
diff --git a/TAO/tests/Big_Oneways/Session_Control.cpp b/TAO/tests/Big_Oneways/Session_Control.cpp
new file mode 100644
index 00000000000..f0f5c3bd4b4
--- /dev/null
+++ b/TAO/tests/Big_Oneways/Session_Control.cpp
@@ -0,0 +1,75 @@
+//
+// $Id$
+//
+#include "Session_Control.h"
+
+ACE_RCSID(Big_Oneways, Session_Control, "$Id$")
+
+Session_Control::Session_Control (CORBA::ULong session_count)
+ : session_count_ (session_count)
+ , success_ (1)
+{
+}
+
+int
+Session_Control::all_sessions_finished (void) const
+{
+ return this->session_count_ == 0;
+}
+
+Session_Control::~Session_Control (void)
+{
+ if (this->session_count_ == 0 && this->success_)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Session_Control::~Session_control, "
+ " good, all sessions did finish\n"));
+ }
+ else if (session_count_ != 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "ERROR: (%P|%t) Session_Control::~Session_control, "
+ " %d sessions did not finish\n",
+ this->session_count_));
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "ERROR: (%P|%t) Session_Control::~Session_control, "
+ " some sessions failed\n"));
+ }
+}
+
+void
+Session_Control::session_finished (CORBA::Boolean success,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_);
+ if (this->session_count_ == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "ERROR: (%P|%t) Session_Control::session_finished, "
+ "unexpected callback\n"));
+ }
+ if (success == 0)
+ this->success_ = 0;
+
+ this->session_count_--;
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Session_Control::session_finished, "
+ "%d sessions to go\n",
+ this->session_count_));
+ if (session_count_ == 0)
+ {
+ PortableServer::POA_var poa =
+ this->_default_POA (ACE_TRY_ENV);
+ ACE_CHECK;
+ PortableServer::ObjectId_var oid =
+ poa->servant_to_id (this, ACE_TRY_ENV);
+ ACE_CHECK;
+ poa->deactivate_object (oid.in (), ACE_TRY_ENV);
+ ACE_CHECK;
+ }
+
+}
diff --git a/TAO/tests/Big_Oneways/Session_Control.h b/TAO/tests/Big_Oneways/Session_Control.h
new file mode 100644
index 00000000000..09c19dbaaba
--- /dev/null
+++ b/TAO/tests/Big_Oneways/Session_Control.h
@@ -0,0 +1,57 @@
+//
+// $Id$
+//
+
+#ifndef BIG_ONEWAYS_SESSION_CONTROL_H
+#define BIG_ONEWAYS_SESSION_CONTROL_H
+#include "ace/pre.h"
+
+#include "TestS.h"
+
+#if defined (_MSC_VER)
+# if (_MSC_VER >= 1200)
+# pragma warning(push)
+# endif /* _MSC_VER >= 1200 */
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+/// Implement the Test::Session_Control interface
+class Session_Control
+ : public virtual POA_Test::Session_Control
+ , public virtual PortableServer::RefCountServantBase
+{
+public:
+ /// Constructor
+ /**
+ * @param session_count Number of session objects in the experiment.
+ */
+ Session_Control (CORBA::ULong session_count);
+
+ /// Destructor
+ virtual ~Session_Control (void);
+
+ /// Return 1 when all sessions have finished
+ int all_sessions_finished (void) const;
+
+ // = The skeleton methods
+ virtual void session_finished (CORBA::Boolean success,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ /// Synchronize the internal state
+ ACE_SYNCH_MUTEX mutex_;
+
+ /// The type of test
+ CORBA::ULong session_count_;
+
+ /// Set to falso if any session reported a failure
+ CORBA::Boolean success_;
+};
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include "ace/post.h"
+#endif /* BIG_ONEWAYS_SESSION_CONTROL_H */
diff --git a/TAO/tests/Big_Oneways/Session_Task.cpp b/TAO/tests/Big_Oneways/Session_Task.cpp
new file mode 100644
index 00000000000..bd992a66e5d
--- /dev/null
+++ b/TAO/tests/Big_Oneways/Session_Task.cpp
@@ -0,0 +1,19 @@
+//
+// $Id$
+//
+
+#include "Session_Task.h"
+#include "Session.h"
+
+ACE_RCSID(Big_Oneways, Session_Task, "$Id$")
+
+Session_Task::Session_Task (Session *session)
+ : session_ (session)
+{
+}
+
+int
+Session_Task::svc (void)
+{
+ return this->session_->svc ();
+}
diff --git a/TAO/tests/Big_Oneways/Session_Task.h b/TAO/tests/Big_Oneways/Session_Task.h
new file mode 100644
index 00000000000..2ef3bf69925
--- /dev/null
+++ b/TAO/tests/Big_Oneways/Session_Task.h
@@ -0,0 +1,33 @@
+//
+// $Id$
+//
+
+#ifndef BIG_ONEWAYS_SESSION_TASK_H
+#define BIG_ONEWAYS_SESSION_TASK_H
+#include "ace/pre.h"
+
+#include "ace/Task.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+class Session;
+
+/// Implement a Task to run the experiments using multiple threads.
+class Session_Task : public ACE_Task_Base
+{
+public:
+ /// Constructor
+ Session_Task (Session *session);
+
+ /// Thread entry point
+ int svc (void);
+
+private:
+ /// Reference to the test interface
+ Session *session_;
+};
+
+#include "ace/post.h"
+#endif /* BIG_ONEWAYS_SESSION_TASK_H */
diff --git a/TAO/tests/Big_Oneways/Test.idl b/TAO/tests/Big_Oneways/Test.idl
new file mode 100644
index 00000000000..45a00a4144e
--- /dev/null
+++ b/TAO/tests/Big_Oneways/Test.idl
@@ -0,0 +1,74 @@
+//
+// $Id$
+//
+
+module Test
+{
+ /// The message type, just used to send a lot of data on each
+ /// request
+ typedef sequence<octet> Payload;
+
+ /// A session is a single instance of the test
+ interface Session;
+ typedef sequence<Session> Session_List;
+
+ /// A session control is used to determine if all the Session in an
+ /// experiment have finished.
+ /**
+ * @param success If false then the session failed, the experiment
+ * is successful only if all sessions finish successfully
+ */
+ interface Session_Control
+ {
+ void session_finished (in boolean success);
+ };
+
+ /// A Peer is used to create sessions
+ interface Peer
+ {
+ /// Create a new session
+ Session create_session (in Session_Control control);
+
+ /// Shutdown the peer
+ oneway void shutdown ();
+ };
+
+ /// The Session already has an experiment running.
+ exception Already_Running {};
+
+ /// The experiment requires at least two Sessions
+ exception No_Peers {};
+
+ interface Session
+ {
+ /// Start the test, send messages to all the peers
+ /**
+ * @param other_sessions The list of sessions participating in the
+ * experiment, this list must not include the session
+ * receiving the start() call.
+ * @param payload_size The size of each message
+ * @param thread_count The number of threads that each session
+ * must create
+ * @param message_count How many messages does each thread send.
+ */
+ void start (in Session_List other_sessions,
+ in unsigned long payload_size,
+ in unsigned long thread_count,
+ in unsigned long message_count)
+ raises (Already_Running, No_Peers);
+
+ /// Receive the payload
+ oneway void receive_payload (in Payload the_payload);
+ };
+
+ interface Coordinator
+ {
+ /// Add a new peer.
+ /**
+ * The coordinator starts the test by calling <send_oneways> on
+ * all peers. How does it decide to do that is application
+ * specific.
+ */
+ void add_peer (in Peer the_peer);
+ };
+};
diff --git a/TAO/tests/Big_Oneways/client.cpp b/TAO/tests/Big_Oneways/client.cpp
new file mode 100644
index 00000000000..a3a9cf522b2
--- /dev/null
+++ b/TAO/tests/Big_Oneways/client.cpp
@@ -0,0 +1,112 @@
+// $Id$
+
+#include "Peer.h"
+#include "ace/Get_Opt.h"
+
+ACE_RCSID(Big_Oneways, client, "$Id$")
+
+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.optarg;
+ 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[])
+{
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::Object_var poa_object =
+ orb->resolve_initial_references("RootPOA", ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (poa_object.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (poa_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Panic got a nil RootPOA\n"),
+ 1);
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var tmp =
+ orb->string_to_object(ior, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ Test::Coordinator_var coordinator =
+ Test::Coordinator::_narrow(tmp.in (), ACE_TRY_ENV);
+ if (CORBA::is_nil (coordinator.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "Nil coordinator reference <%s>\n",
+ ior),
+ 1);
+ }
+
+ Peer *peer_impl;
+ ACE_NEW_RETURN (peer_impl,
+ Peer (orb.in ()),
+ 1);
+ PortableServer::ServantBase_var peer_owner_transfer(peer_impl);
+
+ Test::Peer_var peer =
+ peer_impl->_this (ACE_TRY_ENV);
+
+ poa_manager->activate (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ coordinator->add_peer (peer.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ orb->run (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ root_poa->destroy (1, 1, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ orb->destroy (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Exception caught:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/tests/Big_Oneways/client.dsp b/TAO/tests/Big_Oneways/client.dsp
new file mode 100644
index 00000000000..10b2c24608f
--- /dev/null
+++ b/TAO/tests/Big_Oneways/client.dsp
@@ -0,0 +1,216 @@
+# Microsoft Developer Studio Project File - Name="Big_Oneways Client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Big_Oneways Client - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak" CFG="Big_Oneways Client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Big_Oneways Client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Big_Oneways Client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Big_Oneways Client - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../../" /I "../../" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 TAO.lib TAO_PortableServer.lib ace.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\tao\PortableServer" /libpath:"..\..\..\ace" /libpath:"..\..\tao"
+
+!ELSEIF "$(CFG)" == "Big_Oneways Client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../../" /I "../../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 TAOd.lib TAO_PortableServerd.lib aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\tao\PortableServer" /libpath:"..\..\..\ace" /libpath:"..\..\tao"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Big_Oneways Client - Win32 Release"
+# Name "Big_Oneways Client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".cpp"
+# Begin Source File
+
+SOURCE=.\Coordinator.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestS.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=.\Coordinator.h
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ".idl"
+# Begin Source File
+
+SOURCE=.\Test.idl
+
+!IF "$(CFG)" == "Big_Oneways Client - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+USERDEP__TEST_="..\..\..\bin\Release\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler
+InputPath=.\Test.idl
+InputName=Test
+
+BuildCmds= \
+ ..\..\..\bin\Release\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Big_Oneways Client - Win32 Debug"
+
+USERDEP__TEST_="..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler
+InputPath=.\Test.idl
+InputName=Test
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter ".i"
+# Begin Source File
+
+SOURCE=.\TestC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestS.i
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/Big_Oneways/run_test.pl b/TAO/tests/Big_Oneways/run_test.pl
new file mode 100755
index 00000000000..a73477ca3b3
--- /dev/null
+++ b/TAO/tests/Big_Oneways/run_test.pl
@@ -0,0 +1,84 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib '../../../bin';
+use PerlACE::Run_Test;
+use Getopt::Std;
+
+local ($opt_i, $opt_b);
+
+if (!getopts ('i:b:')) {
+ print "Usage: run_test.pl [-b payload_size] [-i iterations]\n";
+ exit 1;
+}
+
+my $server_args = " -p 3";
+if (defined $opt_i) {
+ $server_args .= " -i ".$opt_i;
+}
+if (defined $opt_b) {
+ $server_args .= " -b ".$opt_b;
+}
+
+$iorfile = PerlACE::LocalFile ("server.ior");
+
+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");
+ $CL2 = new PerlACE::Process ("client", " -k file://$iorfile");
+ $CL3 = new PerlACE::Process ("client", " -k file://$iorfile");
+
+
+ $SV->Spawn ();
+
+ if (PerlACE::waitforfile_timed ($iorfile, 5) == -1) {
+ print STDERR "ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+ }
+
+ $CL1->Spawn ();
+ $CL2->Spawn ();
+ $CL3->Spawn ();
+
+ $client1 = $CL1->WaitKill (300);
+
+ if ($client1 != 0) {
+ print STDERR "ERROR: client 1 returned $client1\n";
+ $status = 1;
+ }
+
+ $client2 = $CL2->WaitKill (300);
+
+ if ($client2 != 0) {
+ print STDERR "ERROR: client 2 returned $client2\n";
+ $status = 1;
+ }
+
+ $client3 = $CL3->WaitKill (300);
+
+ if ($client3 != 0) {
+ print STDERR "ERROR: client 3 returned $client3\n";
+ $status = 1;
+ }
+
+ $server = $SV->TerminateWaitKill (5);
+
+ if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ $status = 1;
+ }
+}
+
+unlink $iorfile;
+
+exit $status;
diff --git a/TAO/tests/Big_Oneways/server.cpp b/TAO/tests/Big_Oneways/server.cpp
new file mode 100644
index 00000000000..a64abc22d9d
--- /dev/null
+++ b/TAO/tests/Big_Oneways/server.cpp
@@ -0,0 +1,210 @@
+// $Id$
+
+#include "Coordinator.h"
+#include "Session_Control.h"
+#include "ace/Get_Opt.h"
+
+ACE_RCSID(Big_Oneways, server, "$Id$")
+
+const char *ior_output_file = "test.ior";
+CORBA::ULong peer_count = 4;
+int event_size = 1024;
+int event_count = 1000;
+int thread_count = 4;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "o:p:b:i:n:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.optarg;
+ break;
+
+ case 'p':
+ peer_count = ACE_OS::atoi (get_opts.optarg);
+ break;
+
+ case 'b':
+ event_size = ACE_OS::atoi (get_opts.optarg);
+ break;
+
+ case 'i':
+ event_count = ACE_OS::atoi (get_opts.optarg);
+ break;
+
+ case 'n':
+ thread_count = ACE_OS::atoi (get_opts.optarg);
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile> "
+ "-o <peer_count> "
+ "-b <event_size> "
+ "-i <event_count> "
+ "-n <thread_count> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::Object_var poa_object =
+ orb->resolve_initial_references("RootPOA", ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (poa_object.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (poa_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Panic got a nil RootPOA\n"),
+ 1);
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ Coordinator *coordinator_impl;
+ ACE_NEW_RETURN (coordinator_impl,
+ Coordinator (peer_count),
+ 1);
+ PortableServer::ServantBase_var coordinator_owner_transfer(coordinator_impl);
+
+ Test::Coordinator_var coordinator =
+ coordinator_impl->_this (ACE_TRY_ENV);
+
+ CORBA::String_var ior =
+ orb->object_to_string (coordinator.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // If the ior_output_file exists, output the ior to it
+ 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",
+ ior_output_file),
+ 1);
+ ACE_OS::fprintf (output_file, "%s", ior.in ());
+ ACE_OS::fclose (output_file);
+
+ poa_manager->activate (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Waiting for peers . . . "));
+ for (int i = 0;
+ i != 30 && !coordinator_impl->has_all_peers ();
+ ++i)
+ {
+ ACE_Time_Value tv (1, 0);
+ orb->run (tv, ACE_TRY_ENV);
+ }
+ ACE_DEBUG ((LM_DEBUG, "done.\n"));
+
+ if (!coordinator_impl->has_all_peers ())
+ {
+ ACE_ERROR ((LM_DEBUG,
+ "ERROR: timeout, some peers failed to register\n"));
+ return 1;
+ }
+
+ Session_Control *session_control_impl;
+ ACE_NEW_RETURN (session_control_impl,
+ Session_Control (peer_count),
+ 1);
+ PortableServer::ServantBase_var session_control_owner_transfer(session_control_impl);
+
+ Test::Session_Control_var session_control =
+ session_control_impl->_this (ACE_TRY_ENV);
+
+ Test::Session_List session_list;
+ coordinator_impl->create_session_list (session_control.in (),
+ session_list,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ ACE_ASSERT (session_list.length () == peer_count);
+
+ CORBA::ULong j;
+ for (j = 0; j != peer_count; ++j)
+ {
+ // Make a copy of the sessions, excluding the j-th element
+ Test::Session_List other_sessions (peer_count - 1);
+ other_sessions.length (peer_count - 1);
+ CORBA::ULong count = 0;
+ for (CORBA::ULong k = 0; k != peer_count; ++k)
+ {
+ if (k == j)
+ continue;
+ other_sessions[count++] =
+ Test::Session::_duplicate (session_list[k]);
+ }
+
+ session_list[j]->start (other_sessions,
+ event_size,
+ thread_count,
+ event_count,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "Waiting for sessions . . . \n"));
+ for (int k = 0;
+ k != 300 && !session_control_impl->all_sessions_finished ();
+ ++k)
+ {
+ ACE_Time_Value tv (1, 0);
+ orb->run (tv, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+
+ if (!session_control_impl->all_sessions_finished ())
+ {
+ ACE_ERROR ((LM_ERROR,
+ "ERROR: timeout waiting for sessions\n"));
+ return 1;
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "All sessions finished . . . \n"));
+ coordinator_impl->shutdown_all_peers (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ root_poa->destroy (1, 1, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ orb->destroy (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Exception caught:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/tests/Big_Oneways/server.dsp b/TAO/tests/Big_Oneways/server.dsp
new file mode 100644
index 00000000000..f3574552e3b
--- /dev/null
+++ b/TAO/tests/Big_Oneways/server.dsp
@@ -0,0 +1,216 @@
+# Microsoft Developer Studio Project File - Name="Big_Oneways Server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Big_Oneways Server - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak" CFG="Big_Oneways Server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Big_Oneways Server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Big_Oneways Server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Big_Oneways Server - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../../" /I "../../" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 TAO.lib TAO_PortableServer.lib ace.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\tao\PortableServer" /libpath:"..\..\..\ace" /libpath:"..\..\tao"
+
+!ELSEIF "$(CFG)" == "Big_Oneways Server - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../../" /I "../../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 TAOd.lib TAO_PortableServerd.lib aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\tao\PortableServer" /libpath:"..\..\..\ace" /libpath:"..\..\tao"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Big_Oneways Server - Win32 Release"
+# Name "Big_Oneways Server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".cpp"
+# Begin Source File
+
+SOURCE=.\Coordinator.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestS.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=.\Coordinator.h
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ".idl"
+# Begin Source File
+
+SOURCE=.\Test.idl
+
+!IF "$(CFG)" == "Big_Oneways Server - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+USERDEP__TEST_="..\..\..\bin\Release\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler
+InputPath=.\Test.idl
+InputName=Test
+
+BuildCmds= \
+ ..\..\..\bin\Release\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Big_Oneways Server - Win32 Debug"
+
+USERDEP__TEST_="..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler
+InputPath=.\Test.idl
+InputName=Test
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter ".i"
+# Begin Source File
+
+SOURCE=.\TestC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestS.i
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/Makefile b/TAO/tests/Makefile
index 56445df150f..b6c0e0ae48f 100644
--- a/TAO/tests/Makefile
+++ b/TAO/tests/Makefile
@@ -56,7 +56,8 @@ DIRS = CDR \
QtTests \
Multiple \
LongWrites \
- Queued_Message_Test
+ Queued_Message_Test \
+ Big_Oneways
ifndef TAO_ROOT
TAO_ROOT = $(ACE_ROOT)/TAO
diff --git a/TAO/tests/README b/TAO/tests/README
index e955d64a30a..69ebd2b1584 100644
--- a/TAO/tests/README
+++ b/TAO/tests/README
@@ -13,6 +13,10 @@ how to run the following tests:
This is a simple test for AMI callback model in combination with
timeouts (relative roundtrip timeout policy).
+ . Big_Oneways
+
+ Stress test non-blocking I/O features in the ORB.
+
. Bidirectional
This is a test that exercises the birectional GIOP connection