summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-30 13:11:41 +0000
committervzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-30 13:11:41 +0000
commitb132bae7c7dff8e78ddb2a73db95165097da3a7c (patch)
tree33f1f79cfacc36da7c6c368a826addfba3609939
parent3cd1871d8732d7d5d20622a3996298bd03042104 (diff)
downloadATCD-b132bae7c7dff8e78ddb2a73db95165097da3a7c.tar.gz
Fri Oct 30 13:08:30 UTC 2009 Vladimir Zykov <vladimir.zykov@prismtech.com>
* tests/Bug_3748_Regression/client.cpp: * tests/Bug_3748_Regression/Bug_3748_Regression.mpc: * tests/Bug_3748_Regression/Server_ORBInitializer.h: * tests/Bug_3748_Regression/Hello.cpp: * tests/Bug_3748_Regression/Test.idl: * tests/Bug_3748_Regression/server.cpp: * tests/Bug_3748_Regression/Test_Protocols_Hooks.cpp: * tests/Bug_3748_Regression/Makefile.am: * tests/Bug_3748_Regression/Hello.h: * tests/Bug_3748_Regression/Test_Protocols_Hooks.h: * tests/Bug_3748_Regression/README: * tests/Bug_3748_Regression/run_test.pl: * tests/Bug_3748_Regression/Server_ORBInitializer.cpp: * bin/tao_orb_tests.lst: Complitely rewrote the test for bug#3748 and changed configs in which this test can run.
-rw-r--r--TAO/ChangeLog19
-rw-r--r--TAO/bin/tao_orb_tests.lst2
-rw-r--r--TAO/tests/Bug_3748_Regression/Bug_3748_Regression.mpc4
-rw-r--r--TAO/tests/Bug_3748_Regression/Hello.cpp4
-rw-r--r--TAO/tests/Bug_3748_Regression/Hello.h3
-rw-r--r--TAO/tests/Bug_3748_Regression/Makefile.am2
-rw-r--r--TAO/tests/Bug_3748_Regression/README8
-rw-r--r--TAO/tests/Bug_3748_Regression/Server_ORBInitializer.cpp41
-rw-r--r--TAO/tests/Bug_3748_Regression/Server_ORBInitializer.h44
-rw-r--r--TAO/tests/Bug_3748_Regression/Test.idl2
-rw-r--r--TAO/tests/Bug_3748_Regression/Test_Protocols_Hooks.cpp190
-rw-r--r--TAO/tests/Bug_3748_Regression/Test_Protocols_Hooks.h109
-rw-r--r--TAO/tests/Bug_3748_Regression/client.cpp33
-rwxr-xr-xTAO/tests/Bug_3748_Regression/run_test.pl23
-rw-r--r--TAO/tests/Bug_3748_Regression/server.cpp145
15 files changed, 457 insertions, 172 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 47978558b6d..0a2370fb22c 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,22 @@
+Fri Oct 30 13:08:30 UTC 2009 Vladimir Zykov <vladimir.zykov@prismtech.com>
+
+ * tests/Bug_3748_Regression/client.cpp:
+ * tests/Bug_3748_Regression/Bug_3748_Regression.mpc:
+ * tests/Bug_3748_Regression/Server_ORBInitializer.h:
+ * tests/Bug_3748_Regression/Hello.cpp:
+ * tests/Bug_3748_Regression/Test.idl:
+ * tests/Bug_3748_Regression/server.cpp:
+ * tests/Bug_3748_Regression/Test_Protocols_Hooks.cpp:
+ * tests/Bug_3748_Regression/Makefile.am:
+ * tests/Bug_3748_Regression/Hello.h:
+ * tests/Bug_3748_Regression/Test_Protocols_Hooks.h:
+ * tests/Bug_3748_Regression/README:
+ * tests/Bug_3748_Regression/run_test.pl:
+ * tests/Bug_3748_Regression/Server_ORBInitializer.cpp:
+ * bin/tao_orb_tests.lst:
+ Complitely rewrote the test for bug#3748 and changed configs
+ in which this test can run.
+
Fri Oct 30 06:15:53 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl>
Merged changes from Jeff for port/porttype/mirrorport to head
diff --git a/TAO/bin/tao_orb_tests.lst b/TAO/bin/tao_orb_tests.lst
index b5295ab3ec9..5fdff6fb0ba 100644
--- a/TAO/bin/tao_orb_tests.lst
+++ b/TAO/bin/tao_orb_tests.lst
@@ -167,7 +167,7 @@ TAO/tests/Bug_3695_Regression/run_test.pl:
TAO/tests/Bug_3701_Regression/run_test.pl:
TAO/tests/Bug_3743_Regression/run_test.pl: !NO_IFR !LabVIEW_RT !WinCE !FUZZ
TAO/tests/Bug_3746_Regression/run_test.pl:
-TAO/tests/Bug_3748_Regression/run_test.pl: !ST
+TAO/tests/Bug_3748_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS
TAO/tests/DIOP/run_test.pl: !ST !NO_DIOP !ACE_FOR_TAO !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ
TAO/tests/DIOP/run_test_ipv6.pl: IPV6 !ST !NO_DIOP !ACE_FOR_TAO !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ
TAO/tests/RTCORBA/Activate_Object_Multiple_ORBs/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST
diff --git a/TAO/tests/Bug_3748_Regression/Bug_3748_Regression.mpc b/TAO/tests/Bug_3748_Regression/Bug_3748_Regression.mpc
index fbab84719e4..324361185ce 100644
--- a/TAO/tests/Bug_3748_Regression/Bug_3748_Regression.mpc
+++ b/TAO/tests/Bug_3748_Regression/Bug_3748_Regression.mpc
@@ -9,10 +9,12 @@ project(*idl): taoidldefaults {
custom_only = 1
}
-project(*Server): taoserver {
+project(*Server): taoserver, pi {
after += *idl
Source_Files {
Hello.cpp
+ Server_ORBInitializer.cpp
+ Test_Protocols_Hooks.cpp
server.cpp
}
Source_Files {
diff --git a/TAO/tests/Bug_3748_Regression/Hello.cpp b/TAO/tests/Bug_3748_Regression/Hello.cpp
index 409faf5ca1f..df5dc90d3d9 100644
--- a/TAO/tests/Bug_3748_Regression/Hello.cpp
+++ b/TAO/tests/Bug_3748_Regression/Hello.cpp
@@ -5,9 +5,8 @@
ACE_RCSID(Hello, Hello, "$Id$")
-Hello::Hello (CORBA::ORB_ptr orb, CORBA::ORB_ptr shutdown_orb)
+Hello::Hello (CORBA::ORB_ptr orb)
: orb_ (CORBA::ORB::_duplicate (orb))
- , shutdown_orb_ (CORBA::ORB::_duplicate (shutdown_orb))
{
}
@@ -21,5 +20,4 @@ void
Hello::shutdown (void)
{
this->orb_->shutdown (0);
- this->shutdown_orb_->shutdown (0);
}
diff --git a/TAO/tests/Bug_3748_Regression/Hello.h b/TAO/tests/Bug_3748_Regression/Hello.h
index 2546959336c..f87205c3011 100644
--- a/TAO/tests/Bug_3748_Regression/Hello.h
+++ b/TAO/tests/Bug_3748_Regression/Hello.h
@@ -14,7 +14,7 @@ class Hello
{
public:
/// Constructor
- Hello (CORBA::ORB_ptr orb, CORBA::ORB_ptr shutdown_orb);
+ Hello (CORBA::ORB_ptr orb);
// = The skeleton methods
virtual char * get_string (void);
@@ -25,7 +25,6 @@ private:
/// Use an ORB reference to conver strings to objects and shutdown
/// the application.
CORBA::ORB_var orb_;
- CORBA::ORB_var shutdown_orb_;
};
#include /**/ "ace/post.h"
diff --git a/TAO/tests/Bug_3748_Regression/Makefile.am b/TAO/tests/Bug_3748_Regression/Makefile.am
index a0e2286e095..b75b16b2db8 100644
--- a/TAO/tests/Bug_3748_Regression/Makefile.am
+++ b/TAO/tests/Bug_3748_Regression/Makefile.am
@@ -85,6 +85,8 @@ server_SOURCES = \
Hello.cpp \
TestC.cpp \
TestS.cpp \
+ Server_ORBInitializer.cpp \
+ Test_Protocols_Hooks.cpp \
server.cpp \
Hello.h
diff --git a/TAO/tests/Bug_3748_Regression/README b/TAO/tests/Bug_3748_Regression/README
index 1b68002f165..d3007b6409d 100644
--- a/TAO/tests/Bug_3748_Regression/README
+++ b/TAO/tests/Bug_3748_Regression/README
@@ -1,5 +1,7 @@
// $Id$
-This test uses big value for -ORBIPHopLimit to simulate failure in
-TAO_IIOP_Connection_Handler::open(). Later could lead to connection
-handler leak.
+This test registers orb initializer which in turn registers Test_Protocol_Hooks.
+This is necessary for emulation of failure in TAO_IIOP_Connection_Handler::open()
+and probable in this case handle leak.
+TAO_IIOP_Connection_Handler::open() calls server_protocol_properties_at_orb_level()
+in Test_Protocol_Hooks and we throw an exception to make it fail.
diff --git a/TAO/tests/Bug_3748_Regression/Server_ORBInitializer.cpp b/TAO/tests/Bug_3748_Regression/Server_ORBInitializer.cpp
new file mode 100644
index 00000000000..1b36e3681df
--- /dev/null
+++ b/TAO/tests/Bug_3748_Regression/Server_ORBInitializer.cpp
@@ -0,0 +1,41 @@
+// -*- C++ -*-
+//
+// $Id$
+//
+
+#include "Server_ORBInitializer.h"
+#include "Test_Protocols_Hooks.h"
+#include "tao/ORB_Core.h"
+#include "tao/PI/ORBInitInfo.h"
+
+ACE_RCSID (Bug_3748_Regression,
+ Server_ORBInitializer,
+ "$Id$")
+
+Server_ORBInitializer::Server_ORBInitializer (void)
+{
+}
+
+void
+Server_ORBInitializer::pre_init (
+ PortableInterceptor::ORBInitInfo_ptr info)
+{
+ // Narrow to a TAO_ORBInitInfo object to get access to the
+ // orb_core() TAO extension.
+ TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info);
+
+ if (CORBA::is_nil (tao_info.in ()))
+ {
+ throw ::CORBA::INTERNAL ();
+ }
+
+ tao_info->orb_core ()->orb_params ()->protocols_hooks_name ("Test_Protocols_Hooks");
+ ACE_Service_Config::process_directive (ace_svc_desc_Test_Protocols_Hooks);
+}
+
+void
+Server_ORBInitializer::post_init (
+ PortableInterceptor::ORBInitInfo_ptr)
+{
+ // No-op.
+}
diff --git a/TAO/tests/Bug_3748_Regression/Server_ORBInitializer.h b/TAO/tests/Bug_3748_Regression/Server_ORBInitializer.h
new file mode 100644
index 00000000000..6bffdffaf04
--- /dev/null
+++ b/TAO/tests/Bug_3748_Regression/Server_ORBInitializer.h
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+//
+// $Id$
+//
+
+#ifndef TAO_SERVER_ORB_INITIALIZER_H
+#define TAO_SERVER_ORB_INITIALIZER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/PI.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+/// Server ORB initializer.
+class Server_ORBInitializer :
+ public virtual PortableInterceptor::ORBInitializer,
+ public virtual ::CORBA::LocalObject
+{
+public:
+ /// Constructor
+ Server_ORBInitializer (void);
+
+ virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info);
+
+ virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info);
+};
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_SERVER_ORB_INITIALIZER_H */
diff --git a/TAO/tests/Bug_3748_Regression/Test.idl b/TAO/tests/Bug_3748_Regression/Test.idl
index 3c0976e106d..41f10f04d02 100644
--- a/TAO/tests/Bug_3748_Regression/Test.idl
+++ b/TAO/tests/Bug_3748_Regression/Test.idl
@@ -5,6 +5,8 @@
/// Put the interfaces in a module, to avoid global namespace pollution
module Test
{
+ const unsigned long expected_failure_number = 5000;
+
/// A very simple interface
interface Hello
{
diff --git a/TAO/tests/Bug_3748_Regression/Test_Protocols_Hooks.cpp b/TAO/tests/Bug_3748_Regression/Test_Protocols_Hooks.cpp
new file mode 100644
index 00000000000..549f696ee66
--- /dev/null
+++ b/TAO/tests/Bug_3748_Regression/Test_Protocols_Hooks.cpp
@@ -0,0 +1,190 @@
+// -*- C++ -*-
+//
+// $Id$
+//
+
+#include "Test_Protocols_Hooks.h"
+#include "TestC.h"
+
+ACE_RCSID (Test,
+ Test_Protocols_Hooks,
+ "$Id$")
+
+Test_Protocols_Hooks::Test_Protocols_Hooks (void)
+ : failure_count_ (0)
+{
+}
+
+
+Test_Protocols_Hooks::~Test_Protocols_Hooks (void)
+{
+}
+
+void
+Test_Protocols_Hooks::init_hooks (TAO_ORB_Core *)
+{
+ // No-op.
+}
+
+CORBA::Boolean
+Test_Protocols_Hooks::set_client_network_priority (IOP::ProfileId,
+ TAO_Stub *)
+{
+ return false;
+}
+
+CORBA::Boolean
+Test_Protocols_Hooks::set_server_network_priority (IOP::ProfileId,
+ CORBA::Policy *)
+{
+ return false;
+}
+
+void
+Test_Protocols_Hooks::server_protocol_properties_at_orb_level (
+ TAO_IIOP_Protocol_Properties &)
+{
+ if (++this->failure_count_ < Test::expected_failure_number)
+ throw ::CORBA::INTERNAL ();
+}
+
+void
+Test_Protocols_Hooks::client_protocol_properties_at_orb_level (
+ TAO_IIOP_Protocol_Properties &)
+{
+ // No-op.
+}
+
+void
+Test_Protocols_Hooks::server_protocol_properties_at_orb_level (
+ TAO_UIOP_Protocol_Properties &)
+{
+ // No-op.
+}
+
+void
+Test_Protocols_Hooks::client_protocol_properties_at_orb_level (
+ TAO_UIOP_Protocol_Properties &)
+{
+ // No-op.
+}
+
+void
+Test_Protocols_Hooks::server_protocol_properties_at_orb_level (
+ TAO_SHMIOP_Protocol_Properties &)
+{
+ // No-op.
+}
+
+void
+Test_Protocols_Hooks::client_protocol_properties_at_orb_level (
+ TAO_SHMIOP_Protocol_Properties &)
+{
+ // No-op.
+}
+
+void
+Test_Protocols_Hooks::server_protocol_properties_at_orb_level (
+ TAO_DIOP_Protocol_Properties &)
+{
+ // No-op.
+}
+
+void
+Test_Protocols_Hooks::client_protocol_properties_at_orb_level (
+ TAO_DIOP_Protocol_Properties &)
+{
+ // No-op.
+}
+
+void
+Test_Protocols_Hooks::server_protocol_properties_at_orb_level (
+ TAO_SCIOP_Protocol_Properties &)
+{
+ // No-op.
+}
+
+void
+Test_Protocols_Hooks::client_protocol_properties_at_orb_level (
+ TAO_SCIOP_Protocol_Properties &)
+{
+ // No-op.
+}
+
+CORBA::Long
+Test_Protocols_Hooks::get_dscp_codepoint (void)
+{
+ return -1;
+}
+
+void
+Test_Protocols_Hooks::get_selector_hook (
+ CORBA::Policy *,
+ CORBA::Boolean &,
+ CORBA::Short &)
+{
+ // No-op.
+}
+
+void
+Test_Protocols_Hooks::get_selector_bands_policy_hook (
+ CORBA::Policy *,
+ CORBA::Short,
+ CORBA::Short &,
+ CORBA::Short &,
+ bool &
+ )
+{
+ // No-op.
+}
+
+int
+Test_Protocols_Hooks::get_thread_CORBA_priority (CORBA::Short &)
+{
+ return -1;
+}
+
+int
+Test_Protocols_Hooks::get_thread_native_priority (
+ CORBA::Short &)
+{
+ return -1;
+}
+
+int
+Test_Protocols_Hooks::get_thread_CORBA_and_native_priority (
+ CORBA::Short &,
+ CORBA::Short &)
+{
+ return -1;
+}
+
+int
+Test_Protocols_Hooks::get_thread_implicit_CORBA_priority (CORBA::Short &)
+{
+ return -1;
+}
+
+int
+Test_Protocols_Hooks::restore_thread_CORBA_and_native_priority (
+ CORBA::Short,
+ CORBA::Short
+ )
+{
+ return -1;
+}
+
+int
+Test_Protocols_Hooks::set_thread_CORBA_priority (CORBA::Short)
+{
+ return -1;
+}
+
+ACE_STATIC_SVC_DEFINE (Test_Protocols_Hooks,
+ ACE_TEXT ("Test_Protocols_Hooks"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (Test_Protocols_Hooks),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (ACE_Local_Service, Test_Protocols_Hooks)
diff --git a/TAO/tests/Bug_3748_Regression/Test_Protocols_Hooks.h b/TAO/tests/Bug_3748_Regression/Test_Protocols_Hooks.h
new file mode 100644
index 00000000000..e3f4ff62c3c
--- /dev/null
+++ b/TAO/tests/Bug_3748_Regression/Test_Protocols_Hooks.h
@@ -0,0 +1,109 @@
+// -*- C++ -*-
+//
+// $Id$
+//
+
+#ifndef TEST_PROTOCOLS_HOOKS_H
+#define TEST_PROTOCOLS_HOOKS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Protocols_Hooks.h"
+
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+class Test_Protocols_Hooks : public TAO_Protocols_Hooks
+{
+public:
+ /// Constructor
+ Test_Protocols_Hooks (void);
+
+ /// Destructor
+ virtual ~Test_Protocols_Hooks (void);
+
+ /// Initialize the protocols hooks instance.
+ void init_hooks (TAO_ORB_Core *orb_core);
+
+ CORBA::Boolean set_client_network_priority (IOP::ProfileId protocol_tag,
+ TAO_Stub *stub);
+
+ CORBA::Boolean set_server_network_priority (IOP::ProfileId protocol_tag,
+ CORBA::Policy *policy);
+
+ void server_protocol_properties_at_orb_level (
+ TAO_IIOP_Protocol_Properties &protocol_properties);
+
+ void client_protocol_properties_at_orb_level (
+ TAO_IIOP_Protocol_Properties &protocol_properties);
+
+ void server_protocol_properties_at_orb_level (
+ TAO_UIOP_Protocol_Properties &protocol_properties);
+
+ void client_protocol_properties_at_orb_level (
+ TAO_UIOP_Protocol_Properties &protocol_properties);
+
+ void server_protocol_properties_at_orb_level (
+ TAO_SHMIOP_Protocol_Properties &protocol_properties);
+
+ void client_protocol_properties_at_orb_level (
+ TAO_SHMIOP_Protocol_Properties &protocol_properties);
+
+ void server_protocol_properties_at_orb_level (
+ TAO_DIOP_Protocol_Properties &protocol_properties);
+
+ void client_protocol_properties_at_orb_level (
+ TAO_DIOP_Protocol_Properties &protocol_properties);
+
+ void server_protocol_properties_at_orb_level (
+ TAO_SCIOP_Protocol_Properties &protocol_properties);
+
+ void client_protocol_properties_at_orb_level (
+ TAO_SCIOP_Protocol_Properties &protocol_properties);
+
+ CORBA::Long get_dscp_codepoint (void);
+
+ void get_selector_hook (CORBA::Policy *model_policy,
+ CORBA::Boolean
+ &is_client_propagated,
+ CORBA::Short &server_priority);
+
+ void get_selector_bands_policy_hook (CORBA::Policy *bands_policy,
+ CORBA::Short priority,
+ CORBA::Short &min_priority,
+ CORBA::Short &max_priority,
+ bool &in_range);
+
+ /**
+ * Accessor and modifier to the current thread priority, used to
+ * implement the RTCORBA::Current interface, but it is faster for
+ * some critical components.
+ */
+ //@{
+ int get_thread_CORBA_priority (CORBA::Short &priority);
+
+ int get_thread_native_priority (CORBA::Short &);
+
+ int get_thread_CORBA_and_native_priority (CORBA::Short &, CORBA::Short &);
+
+ int get_thread_implicit_CORBA_priority (CORBA::Short&);
+
+ int set_thread_CORBA_priority (CORBA::Short);
+
+ int restore_thread_CORBA_and_native_priority (CORBA::Short,
+ CORBA::Short);
+
+ //@}
+
+private:
+ CORBA::ULong failure_count_;
+};
+
+ACE_STATIC_SVC_DECLARE_EXPORT (ACE_Local_Service, Test_Protocols_Hooks)
+ACE_FACTORY_DECLARE (ACE_Local_Service, Test_Protocols_Hooks)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_RT_PROTOCOLS_HOOKS_H */
diff --git a/TAO/tests/Bug_3748_Regression/client.cpp b/TAO/tests/Bug_3748_Regression/client.cpp
index 96b9ce71fb6..ae5452bb14a 100644
--- a/TAO/tests/Bug_3748_Regression/client.cpp
+++ b/TAO/tests/Bug_3748_Regression/client.cpp
@@ -6,12 +6,11 @@
ACE_RCSID(Hello, client, "$Id$")
const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior");
-const ACE_TCHAR *shutdown_ior = ACE_TEXT ("file://shutdown_test.ior");
int
parse_args (int argc, ACE_TCHAR *argv[])
{
- ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:s:"));
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
int c;
while ((c = get_opts ()) != -1)
@@ -21,16 +20,11 @@ parse_args (int argc, ACE_TCHAR *argv[])
ior = get_opts.opt_arg ();
break;
- case 's':
- shutdown_ior = get_opts.opt_arg ();
- break;
-
case '?':
default:
ACE_ERROR_RETURN ((LM_ERROR,
"usage: %s "
- "-k <ior> "
- "-s <shutdown_ior>"
+ "-k <ior>"
"\n",
argv [0]),
-1);
@@ -61,8 +55,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
1);
}
- int encountered_failures = 0;
- for (int i = 0; i < 5000; ++i)
+ CORBA::ULong encountered_failures = 0;
+ for (CORBA::ULong i = 0; i < Test::expected_failure_number; ++i)
{
try
{
@@ -70,7 +64,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
}
catch (::CORBA::Exception const &)
{
- if (++encountered_failures % 500 == 0)
+ CORBA::ULong const modulo = Test::expected_failure_number / 10;
+ if (++encountered_failures % modulo == 0)
{
#if 1
ACE_DEBUG ((LM_DEBUG,
@@ -84,19 +79,9 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
ACE_ERROR ((LM_ERROR,
"ERROR: No expected exceptions occured.\n"));
- tmp = orb->string_to_object(shutdown_ior);
-
- Test::Hello_var shutdown_hello = Test::Hello::_narrow(tmp.in ());
-
- if (CORBA::is_nil (shutdown_hello.in ()))
- {
- ACE_ERROR_RETURN ((LM_DEBUG,
- "Nil Test::Hello reference <%s>\n",
- shutdown_ior),
- 1);
- }
-
- shutdown_hello->shutdown ();
+ // By this time the server should accept the connection and
+ // must handle shutdown gracefully.
+ hello->shutdown ();
orb->destroy ();
}
diff --git a/TAO/tests/Bug_3748_Regression/run_test.pl b/TAO/tests/Bug_3748_Regression/run_test.pl
index 654e35f9ca4..e848fa81021 100755
--- a/TAO/tests/Bug_3748_Regression/run_test.pl
+++ b/TAO/tests/Bug_3748_Regression/run_test.pl
@@ -21,18 +21,13 @@ my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 fail
my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
my $iorbase = "server.ior";
-my $shutdown_iorbase = "shutdown.ior";
my $server_iorfile = $server->LocalFile ($iorbase);
my $client_iorfile = $client->LocalFile ($iorbase);
-my $shutdown_server_iorfile = $server->LocalFile ($shutdown_iorbase);
-my $shutdown_client_iorfile = $client->LocalFile ($shutdown_iorbase);
$server->DeleteFile($iorbase);
$client->DeleteFile($iorbase);
-$server->DeleteFile($shutdown_iorbase);
-$client->DeleteFile($shutdown_iorbase);
-$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile -s $shutdown_server_iorfile");
-$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -s file://$shutdown_client_iorfile");
+$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("client", "-k file://$client_iorfile");
$server_status = $SV->Spawn ();
if ($server_status != 0) {
@@ -40,7 +35,7 @@ if ($server_status != 0) {
exit 1;
}
-if ($server->WaitForFileTimed ($shutdown_iorbase,
+if ($server->WaitForFileTimed ($iorbase,
$server->ProcessStartWaitInterval()) == -1) {
print STDERR "ERROR: cannot find file <$server_iorfile>\n";
$SV->Kill (); $SV->TimedWait (1);
@@ -57,16 +52,6 @@ if ($client->PutFile ($iorbase) == -1) {
$SV->Kill (); $SV->TimedWait (1);
exit 1;
}
-if ($server->GetFile ($shutdown_iorbase) == -1) {
- print STDERR "ERROR: cannot retrieve file <$shutdown_server_iorfile>\n";
- $SV->Kill (); $SV->TimedWait (1);
- exit 1;
-}
-if ($client->PutFile ($shutdown_iorbase) == -1) {
- print STDERR "ERROR: cannot set file <$shutdown_client_iorfile>\n";
- $SV->Kill (); $SV->TimedWait (1);
- exit 1;
-}
$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
@@ -84,7 +69,5 @@ if ($server_status != 0) {
$server->DeleteFile($iorbase);
$client->DeleteFile($iorbase);
-$server->DeleteFile($shutdown_iorbase);
-$client->DeleteFile($shutdown_iorbase);
exit $status;
diff --git a/TAO/tests/Bug_3748_Regression/server.cpp b/TAO/tests/Bug_3748_Regression/server.cpp
index 913ba8f85d5..a9aa0da25f4 100644
--- a/TAO/tests/Bug_3748_Regression/server.cpp
+++ b/TAO/tests/Bug_3748_Regression/server.cpp
@@ -1,22 +1,21 @@
// $Id$
#include "Hello.h"
+#include "Server_ORBInitializer.h"
#include "ace/Get_Opt.h"
#include "ace/OS_NS_stdio.h"
-#include "ace/Task.h"
-#include "ace/ARGV.h"
+#include "tao/ORBInitializer_Registry.h"
ACE_RCSID (Hello,
server,
"$Id$")
const ACE_TCHAR *ior_output_file = ACE_TEXT ("test.ior");
-const ACE_TCHAR *shutdown_ior_output_file = ACE_TEXT ("shutdown_test.ior");
int
parse_args (int argc, ACE_TCHAR *argv[])
{
- ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:s:h"));
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:h"));
int c;
while ((c = get_opts ()) != -1)
@@ -26,15 +25,10 @@ parse_args (int argc, ACE_TCHAR *argv[])
ior_output_file = get_opts.opt_arg ();
break;
- case 's':
- shutdown_ior_output_file = get_opts.opt_arg ();
- break;
-
case 'h':
ACE_ERROR_RETURN ((LM_ERROR,
"usage: %s "
- "-o <iorfile> "
- "-s <shutdown_iorfile>"
+ "-o <iorfile>"
"\n",
argv [0]),
-1);
@@ -43,56 +37,30 @@ parse_args (int argc, ACE_TCHAR *argv[])
return 0;
}
-class Server_Task : public ACE_Task_Base
-{
-public:
- /// Constructor
- Server_Task (CORBA::ORB_ptr orb,
- ACE_Thread_Manager *thr_mgr)
- : ACE_Task_Base (thr_mgr)
- , orb_ (CORBA::ORB::_duplicate (orb))
- {
- }
-
- /// Thread entry point
- int svc (void)
- {
- try
- {
- this->orb_->run ();
- }
- catch (const CORBA::Exception&)
- {
- return -1;
- }
- return 0;
- }
-
-private:
- /// Reference to the ORB
- CORBA::ORB_var orb_;
-};
-
int
-prepare_one_server (int argc, ACE_TCHAR *argv[],
- ACE_TCHAR const *output_filename,
- CORBA::ORB_out orb,
- CORBA::ORB_ptr shutdown_orb,
- PortableServer::POA_out root_poa,
- Hello *&hello_impl)
+ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
- // Use output_filename as an ORB's name, just to
- // obtain a unique ORB.
- orb =
- CORBA::ORB_init (argc, argv,
- ACE_TEXT_ALWAYS_CHAR (output_filename));
+ PortableInterceptor::ORBInitializer_ptr temp_initializer = 0;
+
+ ACE_NEW_RETURN (temp_initializer,
+ Server_ORBInitializer (),
+ -1); // No exceptions yet!
+ PortableInterceptor::ORBInitializer_var initializer =
+ temp_initializer;
+
+ PortableInterceptor::register_orb_initializer (initializer.in ());
+
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
CORBA::Object_var poa_object =
orb->resolve_initial_references("RootPOA");
- root_poa =
+ PortableServer::POA_var root_poa =
PortableServer::POA::_narrow (poa_object.in ());
if (CORBA::is_nil (root_poa))
@@ -102,9 +70,11 @@ prepare_one_server (int argc, ACE_TCHAR *argv[],
PortableServer::POAManager_var poa_manager = root_poa->the_POAManager ();
+ Hello *hello_impl = 0;
ACE_NEW_RETURN (hello_impl,
- Hello (orb, shutdown_orb),
+ Hello (orb),
1);
+ PortableServer::ServantBase_var owner_transfer(hello_impl);
PortableServer::ObjectId_var id =
root_poa->activate_object (hello_impl);
@@ -116,84 +86,23 @@ prepare_one_server (int argc, ACE_TCHAR *argv[],
CORBA::String_var ior = orb->object_to_string (hello.in ());
// Output the IOR to the <output_filename>
- FILE *output_file= ACE_OS::fopen (output_filename, "w");
+ FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
if (output_file == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open output file for writing IOR: %s\n",
- output_filename),
+ ior_output_file),
1);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
poa_manager->activate ();
- }
- catch (const CORBA::Exception& ex)
- {
- ex._tao_print_exception ("Exception caught:");
- return 1;
- }
-
- return 0;
-}
-
-int
-ACE_TMAIN(int argc, ACE_TCHAR *argv[])
-{
- try
- {
- ACE_ARGV_T<ACE_TCHAR> saved;
- for (int i = 0; i < argc; ++i)
- {
- saved.add (argv[i]);
- }
- saved.add (ACE_TEXT ("-ORBIPHopLimit"));
- saved.add (ACE_TEXT ("10000"));
-
- if (parse_args (argc, argv) != 0)
- return 1;
-
- CORBA::ORB_var orb;
- CORBA::ORB_out orb_param (orb);
- PortableServer::POA_var root_poa;
- PortableServer::POA_out root_poa_param (root_poa);
-
- Hello *hello_impl = 0;
- if (prepare_one_server (saved.argc (), saved.argv (), ior_output_file,
- orb_param, CORBA::ORB::_nil (), root_poa_param, hello_impl))
- return 1;
- PortableServer::ServantBase_var owner_transfer(hello_impl);
-
- CORBA::ORB_var shutdown_orb;
- CORBA::ORB_out shutdown_orb_param (shutdown_orb);
- PortableServer::POA_var shutdown_root_poa;
- PortableServer::POA_out shutdown_root_poa_param (shutdown_root_poa);
-
- Hello *shutdown_hello_impl = 0;
- if (prepare_one_server (argc, argv, shutdown_ior_output_file,
- shutdown_orb_param, orb.in (),
- shutdown_root_poa_param,
- shutdown_hello_impl))
- return 1;
- PortableServer::ServantBase_var shutdown_owner_transfer(shutdown_hello_impl);
-
- Server_Task server_task (shutdown_orb.in (),
- ACE_Thread_Manager::instance ());
- if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, 1) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "Error activating server task\n"),
- 1);
- }
orb->run ();
+
ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n"));
+
root_poa->destroy (1, 1);
orb->destroy ();
-
- ACE_Thread_Manager::instance ()->wait ();
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutdown server - event loop finished\n"));
- shutdown_root_poa->destroy (1, 1);
- shutdown_orb->destroy ();
}
catch (const CORBA::Exception& ex)
{