summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-02-16 13:38:35 +0000
committersma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-02-16 13:38:35 +0000
commit40578fa56aa17012733422c1bbc0c258fdc26a43 (patch)
tree1e44d7c5a05c29906a3bac235a54f99a4fc73290
parent043a0faa17c6031c667e1eb8e2216499193a17a4 (diff)
downloadATCD-40578fa56aa17012733422c1bbc0c258fdc26a43.tar.gz
ChangeLogEntry: Thu Feb 16 12:35:00 UTC Simon Massey <sma@prismtech.com>
-rw-r--r--TAO/ChangeLog10
-rw-r--r--TAO/tests/Portable_Interceptors/AdvSlotDblCpy/AdvSlotDblCpy.mpc28
-rw-r--r--TAO/tests/Portable_Interceptors/AdvSlotDblCpy/InvokeMe.idl12
-rw-r--r--TAO/tests/Portable_Interceptors/AdvSlotDblCpy/README18
-rw-r--r--TAO/tests/Portable_Interceptors/AdvSlotDblCpy/client.cpp39
-rwxr-xr-xTAO/tests/Portable_Interceptors/AdvSlotDblCpy/run_test.pl50
-rw-r--r--TAO/tests/Portable_Interceptors/AdvSlotDblCpy/server.cpp238
7 files changed, 395 insertions, 0 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 47d41f3a55a..580297fcdf0 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,13 @@
+Thu Feb 16 12:35:00 UTC Simon Massey <sma@prismtech.com>
+
+ * tests/Portable_Interceptors/AdvSlotDblCpy/AdvSlotDblCpy.mpc:
+ * tests/Portable_Interceptors/AdvSlotDblCpy/client.cpp:
+ * tests/Portable_Interceptors/AdvSlotDblCpy/InvokeMe.idl:
+ * tests/Portable_Interceptors/AdvSlotDblCpy/README:
+ * tests/Portable_Interceptors/AdvSlotDblCpy/run_test.pl:
+ * tests/Portable_Interceptors/AdvSlotDblCpy/server.cpp:
+ Added regression test for Bugzilla 2403
+
Thu Feb 16 09:21:51 UTC Johnny Willemsen <jwillemsen@remedy.nl>
* TAOACE.mwc:
diff --git a/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/AdvSlotDblCpy.mpc b/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/AdvSlotDblCpy.mpc
new file mode 100644
index 00000000000..0242f6d3360
--- /dev/null
+++ b/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/AdvSlotDblCpy.mpc
@@ -0,0 +1,28 @@
+// $Id$
+project(*idl): taoidldefaults {
+ IDL_Files {
+ InvokeMe.idl
+ }
+ custom_only = 1
+}
+
+project(*Server): taoserver, pi_server, exceptions {
+ after += *idl
+ Source_Files {
+ InvokeMeS.cpp
+ InvokeMeC.cpp
+ server.cpp
+ }
+ IDL_Files {
+ }
+}
+
+project(*Client): taoclient, exceptions {
+ after += *idl
+ Source_Files {
+ InvokeMeC.cpp
+ client.cpp
+ }
+ IDL_Files {
+ }
+}
diff --git a/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/InvokeMe.idl b/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/InvokeMe.idl
new file mode 100644
index 00000000000..a6f58fd0b93
--- /dev/null
+++ b/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/InvokeMe.idl
@@ -0,0 +1,12 @@
+// file : StateTransfer.idl
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+interface InvokeMe
+{
+ void
+ invoke_me ();
+
+ oneway void
+ shutdown ();
+};
diff --git a/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/README b/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/README
new file mode 100644
index 00000000000..c9f42f4be72
--- /dev/null
+++ b/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/README
@@ -0,0 +1,18 @@
+This test checks that simply calling GetSlot works at every
+Server side interception point.
+
+This used to trigger the following assert in the send_reply
+interception point if the slot had not actually been updated
+after the RSC->TSC logical copy that occurs after the
+"receive_request_service_contexts" (such as in the
+"receive_request" or the actual IDL interface implementation
+code) before the logical copy TSC->RSC that then occurs
+before the "send_reply" interception point.
+
+send_reply -> get_slot(TSC) -> long (62) SERVER
+send_reply -> get_slot(RSC)
+ACE_ASSERT: file ...\TAO\tao\PI\PICurrent_Impl.cpp, line 53
+assertion failed for 'this->lc_slot_table_ !=
+&this->slot_table_'.Aborting...
+
+The test should complete without exceptions or this assert.
diff --git a/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/client.cpp b/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/client.cpp
new file mode 100644
index 00000000000..ae99342acb9
--- /dev/null
+++ b/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/client.cpp
@@ -0,0 +1,39 @@
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "InvokeMeC.h"
+
+namespace
+{
+ class always
+ {
+ const InvokeMe_ptr server_;
+ public:
+ always(const InvokeMe_ptr x):server_(x) {}
+ ~always()
+ {
+ ACE_DEBUG ((LM_DEBUG, "\n"));
+ server_->shutdown ();
+ }
+ };
+}
+
+int
+main (int argc, char *argv[])
+{
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+
+ if (argc != 2)
+ {
+ ACE_DEBUG ((LM_ERROR, "Usage: %s <ior>\n", argv[0]));
+ return -1;
+ }
+
+ CORBA::Object_var obj = orb->string_to_object (argv[1]);
+ InvokeMe_var server = InvokeMe::_narrow (obj.in ());
+
+ always Shutdown( server ); // When goes out of scope!
+ server->invoke_me ();
+
+ return 0;
+}
diff --git a/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/run_test.pl b/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/run_test.pl
new file mode 100755
index 00000000000..6adfc99fd7b
--- /dev/null
+++ b/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/run_test.pl
@@ -0,0 +1,50 @@
+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;
+
+$status = 0;
+$file = PerlACE::LocalFile ("server.ior");
+
+unlink $file;
+
+if (PerlACE::is_vxworks_test()) {
+ $SV = new PerlACE::ProcessVX ("server", "");
+}
+else {
+ $SV = new PerlACE::Process ("server", "");
+}
+$CL = new PerlACE::Process ("client", "file://$file");
+
+print STDERR "\n\n==== Running advanced slot double copy test\n";
+
+$SV->Spawn ();
+
+if (PerlACE::waitforfile_timed ($file, 15) == -1) {
+ print STDERR "ERROR: cannot find file <$file>\n";
+ $SV->Kill ();
+ exit 1;
+}
+
+$client = $CL->SpawnWaitKill (60);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
+}
+
+$server = $SV->WaitKill (5);
+
+if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ $status = 1;
+}
+
+unlink $file;
+
+exit $status;
diff --git a/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/server.cpp b/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/server.cpp
new file mode 100644
index 00000000000..1070fbc05b5
--- /dev/null
+++ b/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/server.cpp
@@ -0,0 +1,238 @@
+// author : Boris Kolpackov <boris@kolpackov.net>
+// cvs-id : $Id$
+
+#include "tao/LocalObject.h"
+#include "tao/ORBInitializer_Registry.h"
+
+#include "tao/PI/PI.h"
+#include "tao/PI_Server/PI_Server.h"
+
+#include "ace/OS_NS_stdio.h"
+
+#include "InvokeMeS.h"
+
+using namespace CORBA;
+using namespace PortableServer;
+using namespace PortableInterceptor;
+
+namespace
+{
+ PortableInterceptor::SlotId slot_id;
+
+ void getMySlot(
+ PortableInterceptor::ServerRequestInfo_ptr ri,
+ PortableInterceptor::Current_ptr pi_current,
+ const char *location)
+ {
+ CORBA::String_var
+ op= ri->operation ();
+
+ const bool correctOperation=
+ (0 == ACE_OS::strcmp( op, "invoke_me" ));
+
+ if (correctOperation)
+ {
+ CORBA::Any_var data;
+
+ ACE_DEBUG ((LM_DEBUG, "SERVER %s -> get_slot(TSC) -> is ", location));
+ data= pi_current->get_slot( slot_id );
+ CORBA::TypeCode_var
+ tc= data->type();
+ if (tc->kind() == CORBA::tk_null)
+ ACE_DEBUG ((LM_DEBUG, "EMPTY\n"));
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, "UNKNOWN TYPE\n"));
+ throw INTERNAL ();
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "SERVER %s -> get_slot(RSC) -> is ", location));
+ data= ri->get_slot( slot_id );
+
+ tc= data->type();
+ if (tc->kind() == CORBA::tk_null)
+ ACE_DEBUG ((LM_DEBUG, "EMPTY\n"));
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, "WRONG TYPE\n"));
+ throw INTERNAL();
+ }
+ }
+ }
+}
+
+//
+//
+class InvokeMeImpl: public virtual POA_InvokeMe
+{
+public:
+ InvokeMeImpl (ORB_ptr orb)
+ : orb_ (ORB::_duplicate (orb))
+ {
+ }
+
+ virtual void invoke_me() throw (SystemException)
+ {
+ ACE_DEBUG ((LM_DEBUG, "invoke_me\n"));
+ }
+
+ virtual void
+ shutdown () throw (SystemException)
+ {
+ ACE_DEBUG ((LM_DEBUG, "\nServer is shutting down.\n"));
+ this->orb_->shutdown (0);
+ }
+
+private:
+ ORB_var orb_;
+};
+
+
+//
+//
+class ReplicaController: public virtual ServerRequestInterceptor,
+ public virtual TAO_Local_RefCounted_Object
+{
+ PortableInterceptor::Current_ptr pi_current_;
+public:
+ ReplicaController ( PortableInterceptor::Current_ptr pi_current )
+ : pi_current_( pi_current )
+ {
+ }
+
+ virtual char*
+ name () throw (SystemException)
+ {
+ return string_dup ("ReplicaController");
+ }
+
+ virtual void
+ destroy () throw (SystemException)
+ {
+ }
+
+#if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1
+ virtual void
+ tao_ft_interception_point (ServerRequestInfo_ptr ri, OctetSeq_out)
+ throw (SystemException, ForwardRequest)
+ {
+ getMySlot( ri, this->pi_current_, "tao_ft_interception_point" );
+ }
+#endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/
+
+ virtual void
+ receive_request_service_contexts (ServerRequestInfo_ptr ri)
+ throw (SystemException, ForwardRequest)
+ {
+ getMySlot( ri, this->pi_current_, "receive_request_service_contexts" );
+ }
+
+ virtual void
+ receive_request (ServerRequestInfo_ptr ri)
+ throw (SystemException, ForwardRequest)
+ {
+ getMySlot( ri, this->pi_current_, "receive_request" );
+ }
+
+ virtual void
+ send_reply (ServerRequestInfo_ptr ri) throw (SystemException)
+ {
+ getMySlot( ri, this->pi_current_, "send_reply" );
+ }
+
+ virtual void
+ send_exception (ServerRequestInfo_ptr ri)
+ throw (SystemException, ForwardRequest)
+ {
+ getMySlot( ri, this->pi_current_, "send_exception" );
+ }
+
+ virtual void
+ send_other (ServerRequestInfo_ptr ri)
+ throw (SystemException, ForwardRequest)
+ {
+ getMySlot( ri, this->pi_current_, "send_other" );
+ }
+};
+
+
+//
+//
+class ORB_Initializer : public virtual ORBInitializer,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+ virtual void
+ pre_init (ORBInitInfo_ptr) throw (SystemException)
+ {
+ }
+
+ virtual void
+ post_init (ORBInitInfo_ptr info) throw (SystemException)
+ {
+ CORBA::Object_var obj =
+ info->resolve_initial_references ("PICurrent");
+
+ PortableInterceptor::Current_var pi_current =
+ PortableInterceptor::Current::_narrow (obj.in ());
+
+ slot_id = info->allocate_slot_id ();
+ ACE_DEBUG ((LM_DEBUG, "Allocated slot with id %d.\n", slot_id));
+
+ ServerRequestInterceptor_var
+ interceptor (new ReplicaController (pi_current.in ()));
+ info->add_server_request_interceptor (interceptor.in ());
+ }
+};
+
+int
+main (int argc, char *argv[])
+{
+ ORBInitializer_var orb_initializer (new ORB_Initializer ());
+ register_orb_initializer (orb_initializer.in ());
+
+ ORB_var orb (ORB_init (argc, argv));
+
+ Object_var obj (orb->resolve_initial_references ("RootPOA"));
+
+ POA_var root_poa (POA::_narrow (obj.in ()));
+ POAManager_var poa_manager (root_poa->the_POAManager ());
+
+ InvokeMeImpl* impl = new InvokeMeImpl (orb.in ());
+ ServantBase_var impl_var (impl);
+
+ InvokeMe_var ref (impl->_this ());
+ String_var ior (orb->object_to_string (ref.in ()));
+
+ poa_manager->activate ();
+
+
+ // Dump the ior.
+ //
+ FILE *output_file= ACE_OS::fopen ("server.ior", "w");
+ if (output_file == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open output file <%s> for writing "
+ "IOR: %s",
+ ior.in ()),
+ 1);
+ }
+
+ ACE_OS::fprintf (output_file, "%s", ior.in ());
+ ACE_OS::fclose (output_file);
+
+ ACE_DEBUG ((LM_DEBUG, "Server is ready, IOR is in 'server.ior'\n"));
+
+
+ // Run the ORB event loop.
+ //
+ orb->run ();
+
+ root_poa->destroy (1, 1);
+ orb->destroy ();
+
+ ACE_DEBUG ((LM_DEBUG, "Event loop finished.\n"));
+
+ return 0;
+}