summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TAO/ChangeLog14
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/double_start/Terminator.cpp45
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/double_start/Terminator.h13
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/double_start/Test.idl8
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/double_start/Test_i.cpp46
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/double_start/Test_i.h14
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/double_start/client.cpp47
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/double_start/double_start.mpc1
-rwxr-xr-xTAO/orbsvcs/tests/ImplRepo/double_start/run_test.pl2
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/double_start/server.cpp31
10 files changed, 62 insertions, 159 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index e553ad62d51..dc4409779f2 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,17 @@
+Wed Jul 30 16:47:24 UTC 2014 Phil Mesnier <mesnier_p@ociweb.com>
+
+ * orbsvcs/tests/ImplRepo/double_start/Test.idl:
+ * orbsvcs/tests/ImplRepo/double_start/Test_i.h:
+ * orbsvcs/tests/ImplRepo/double_start/Test_i.cpp:
+ * orbsvcs/tests/ImplRepo/double_start/client.cpp:
+ * orbsvcs/tests/ImplRepo/double_start/double_start.mpc:
+ * orbsvcs/tests/ImplRepo/double_start/run_test.pl:
+ * orbsvcs/tests/ImplRepo/double_start/server.cpp:
+ * orbsvcs/tests/ImplRepo/double_start/Terminator.h:
+ * orbsvcs/tests/ImplRepo/double_start/Terminator.cpp:
+ Clean up the test to remove unused code, address a valgrind
+ reported leak.
+
Wed Jul 30 16:04:35 UTC 2014 Phil Mesnier <mesnier_p@ociweb.com>
* tao/DynamicAny/DynAny_i.cpp:
diff --git a/TAO/orbsvcs/tests/ImplRepo/double_start/Terminator.cpp b/TAO/orbsvcs/tests/ImplRepo/double_start/Terminator.cpp
deleted file mode 100644
index 88fb72467bf..00000000000
--- a/TAO/orbsvcs/tests/ImplRepo/double_start/Terminator.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- C++ -*- $Id$ */
-
-#include "Terminator.h"
-#include "ace/Log_Msg.h"
-#include "ace/OS_NS_unistd.h"
-
-int
-Terminator::open(void*)
-{
- if(this->activate (THR_NEW_LWP | THR_JOINABLE,
- 1) == -1)
- {
- ACE_ERROR_RETURN((LM_ERROR,
- ACE_TEXT("Terminator::open Error spawning thread %p\n"),
- "err="),
- -1);
- }
- return 0;
-}
-
-int
-Terminator::svc()
-{
- while (1)
- {
- ACE_Message_Block* mb = 0;
- if (this->getq(mb) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t|%T) ERROR: Terminator::svc() could not get "
- "message block from queue"), -1);
- }
-
- if (mb->msg_type () == ACE_Message_Block::MB_HANGUP)
- {
- mb->release ();
- this->close ();
- break;
- }
- int delay_secs = ACE_OS::atoi(mb->rd_ptr());
- ACE_OS::sleep(delay_secs);
- ACE_OS::abort();
- }
- return 0;
-}
diff --git a/TAO/orbsvcs/tests/ImplRepo/double_start/Terminator.h b/TAO/orbsvcs/tests/ImplRepo/double_start/Terminator.h
deleted file mode 100644
index 29be200f03e..00000000000
--- a/TAO/orbsvcs/tests/ImplRepo/double_start/Terminator.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* -*- C++ -*- $Id$ */
-
-#include "ace/Task_T.h"
-
-class Terminator : public ACE_Task<ACE_MT_SYNCH>
-{
- public:
-
- virtual int open(void*);
-
- virtual int svc();
-};
-
diff --git a/TAO/orbsvcs/tests/ImplRepo/double_start/Test.idl b/TAO/orbsvcs/tests/ImplRepo/double_start/Test.idl
index 05d941a6ce1..ac3641bd6d5 100644
--- a/TAO/orbsvcs/tests/ImplRepo/double_start/Test.idl
+++ b/TAO/orbsvcs/tests/ImplRepo/double_start/Test.idl
@@ -3,14 +3,6 @@
interface Test
{
- // Return the number of the server after a delay
- short get_server_num (in short delay_secs);
-
- // After replying, abort process
- // delay_secs seconds.
- oneway void abort ( in short delay_secs );
-
-
// for testing the crash recovery scenario
void arm ();
diff --git a/TAO/orbsvcs/tests/ImplRepo/double_start/Test_i.cpp b/TAO/orbsvcs/tests/ImplRepo/double_start/Test_i.cpp
index dcea81bada0..e1f3f5a9288 100644
--- a/TAO/orbsvcs/tests/ImplRepo/double_start/Test_i.cpp
+++ b/TAO/orbsvcs/tests/ImplRepo/double_start/Test_i.cpp
@@ -1,41 +1,17 @@
/* -*- C++ -*- $Id$ */
#include "Test_i.h"
-#include "Terminator.h"
-#include "ace/OS_NS_unistd.h"
#include "ace/Log_Msg.h"
-Test_i::Test_i (CORBA::Short server_num, Terminator &terminator)
- : server_num_ (server_num)
- , terminator_ (terminator)
+Test_i::Test_i (CORBA::ORB_ptr orb)
+ : orb_ (CORBA::ORB::_duplicate (orb))
, armed_ (false)
+ , exit_code_ (0)
{
}
Test_i::~Test_i ()
{
- ACE_Message_Block *mb = 0;
- ACE_NEW (mb,
- ACE_Message_Block(0,
- ACE_Message_Block::MB_HANGUP));
- terminator_.putq (mb);
- terminator_.wait ();
-}
-
-CORBA::Short
-Test_i::get_server_num (const CORBA::Short delay_secs)
-{
- ACE_OS::sleep (delay_secs);
- return this->server_num_;
-}
-
-void
-Test_i::abort (CORBA::Short delay_secs)
-{
- ACE_Message_Block *mb = 0;
- ACE_NEW(mb, ACE_Message_Block(2));
- ACE_OS::sprintf(mb->wr_ptr (), "%d", delay_secs);
- terminator_.putq(mb);
}
void
@@ -50,7 +26,19 @@ Test_i::trigger (void)
if (this->armed_)
{
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) BOOM!\n")));
- ACE_OS::exit (1);
+ // ACE_OS::exit (1);
+ this->exit_code_ = 2;
+ this->orb_->shutdown (false);
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P) Click! not armed, returning\n")));
}
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) Click! not armed, returning\n")));
+}
+
+int
+Test_i::exit_code (void) const
+{
+ return exit_code_;
}
diff --git a/TAO/orbsvcs/tests/ImplRepo/double_start/Test_i.h b/TAO/orbsvcs/tests/ImplRepo/double_start/Test_i.h
index 82244717568..61e70f984d4 100644
--- a/TAO/orbsvcs/tests/ImplRepo/double_start/Test_i.h
+++ b/TAO/orbsvcs/tests/ImplRepo/double_start/Test_i.h
@@ -9,29 +9,25 @@
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-class Terminator;
-
class Test_i : public virtual POA_Test
{
public:
//Constructor
- Test_i (short server_num, Terminator &terminator);
+ Test_i (CORBA::ORB_ptr orb);
//Destructor
virtual ~Test_i ();
- virtual CORBA::Short get_server_num (CORBA::Short delay_secs);
-
- virtual void abort (CORBA::Short delay_secs);
-
virtual void arm (void);
virtual void trigger (void);
+ int exit_code (void) const;
+
private:
- CORBA::Short server_num_;
- Terminator& terminator_;
+ CORBA::ORB_var orb_;
bool armed_;
+ int exit_code_;
};
#endif /* TEST_I_H_ */
diff --git a/TAO/orbsvcs/tests/ImplRepo/double_start/client.cpp b/TAO/orbsvcs/tests/ImplRepo/double_start/client.cpp
index 0891c6b0487..844db30bfe0 100644
--- a/TAO/orbsvcs/tests/ImplRepo/double_start/client.cpp
+++ b/TAO/orbsvcs/tests/ImplRepo/double_start/client.cpp
@@ -9,14 +9,13 @@
#include "tao/AnyTypeCode/Any.h"
int request_delay_secs = 0;
-bool server_abort = false;
const ACE_TCHAR *ior = ACE_TEXT ("");
CORBA::ORB_var orb;
int
parse_args (int argc, ACE_TCHAR *argv[])
{
- ACE_Get_Opt get_opts (argc, argv, ACE_TEXT ("k:d:a"));
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT ("k:d:"));
int c;
while ((c = get_opts ()) != -1)
@@ -26,10 +25,6 @@ parse_args (int argc, ACE_TCHAR *argv[])
request_delay_secs = ACE_OS::atoi(get_opts.opt_arg ());
break;
- case 'a':
- server_abort = true;
- break;
-
case 'k':
ior = get_opts.opt_arg ();
break;
@@ -39,7 +34,6 @@ parse_args (int argc, ACE_TCHAR *argv[])
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("usage: %s ")
ACE_TEXT ("-d <request delay in seconds> ")
- ACE_TEXT ("-a [abort server] ")
ACE_TEXT ("\n"),
argv [0]),
-1);
@@ -86,27 +80,6 @@ set_timeout_policy (CORBA::Object_ptr obj, const ACE_Time_Value& to)
}
void
-do_number_test (void)
-{
- CORBA::Object_var obj = orb->resolve_initial_references("Test");
- ACE_ASSERT (!CORBA::is_nil(obj.in()));
- Test_var test = Test::_narrow( obj.in() );
- ACE_ASSERT (!CORBA::is_nil(test.in()));
-
- if (server_abort)
- {
- test->abort (request_delay_secs);
- }
- else
- {
- CORBA::Short n = test->get_server_num (request_delay_secs);
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("Client received reply from server %d\n"),
- n));
- }
-}
-
-void
do_restart_test (void)
{
CORBA::Object_var obj = orb->string_to_object (ior);
@@ -128,20 +101,20 @@ do_restart_test (void)
}
ACE_DEBUG ((LM_DEBUG,
-ACE_TEXT ("client sleeping %d seconds\n"),
-request_delay_secs));
+ ACE_TEXT ("client sleeping %d seconds\n"),
+ request_delay_secs));
ACE_OS::sleep (request_delay_secs);
try
{
test->trigger ();
ACE_DEBUG ((LM_DEBUG,
-ACE_TEXT ("client trigger completed\n")));
+ ACE_TEXT ("client trigger completed\n")));
return;
}
catch (const CORBA::Exception& ex)
{
ACE_DEBUG ((LM_DEBUG,
-ACE_TEXT ("client caught %C during first trigger\n"),
+ ACE_TEXT ("client caught %C during first trigger\n"),
ex._name ()));
}
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("client second trigger\n")));
@@ -157,15 +130,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
if (parse_args (argc, argv) != 0)
return 1;
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("client ior = %s\n"), ior));
- if (ACE_OS::strlen (ior) == 0)
- {
- do_number_test ();
- }
- else
- {
- do_restart_test ();
- }
+ do_restart_test ();
return 0;
}
diff --git a/TAO/orbsvcs/tests/ImplRepo/double_start/double_start.mpc b/TAO/orbsvcs/tests/ImplRepo/double_start/double_start.mpc
index 5000cd48ef1..aebf08d7ffe 100644
--- a/TAO/orbsvcs/tests/ImplRepo/double_start/double_start.mpc
+++ b/TAO/orbsvcs/tests/ImplRepo/double_start/double_start.mpc
@@ -16,7 +16,6 @@ project(*server): portableserver, orbsvcsexe, avoids_minimum_corba, iortable, im
Source_Files {
Test_i.cpp
server.cpp
- Terminator.cpp
TestC.cpp
TestS.cpp
}
diff --git a/TAO/orbsvcs/tests/ImplRepo/double_start/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/double_start/run_test.pl
index 4255d70ee0c..7e26c0e81f5 100755
--- a/TAO/orbsvcs/tests/ImplRepo/double_start/run_test.pl
+++ b/TAO/orbsvcs/tests/ImplRepo/double_start/run_test.pl
@@ -442,7 +442,7 @@ sub double_server_test
return 1;
}
- my $cmdline = $server_cmd . " -o $srviorfile -ORBUseIMR 1 -n 0 $act_initref "
+ my $cmdline = $server_cmd . " -o $srviorfile -ORBUseIMR 1 -m 10 -n 0 $act_initref "
. "-ORBListenEndpoints iiop://127.0.0.1:";
$cmdline = "./restart.sh -e \\\"$cmdline\\\" -p 0 -r 0 -s $objprefix" . "0";
diff --git a/TAO/orbsvcs/tests/ImplRepo/double_start/server.cpp b/TAO/orbsvcs/tests/ImplRepo/double_start/server.cpp
index 964de4acb3f..7252db67e82 100644
--- a/TAO/orbsvcs/tests/ImplRepo/double_start/server.cpp
+++ b/TAO/orbsvcs/tests/ImplRepo/double_start/server.cpp
@@ -4,7 +4,6 @@
// This version uses the Implementation Repository.
#include "Test_i.h"
-#include "Terminator.h"
#include "tao/IORTable/IORTable.h"
#include "tao/PortableServer/Root_POA.h"
@@ -51,13 +50,15 @@ createPOA(PortableServer::POA_ptr root_poa, const char* poa_name)
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
+ int ec = 0;
try {
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ int max_run = 0;
int server_num = 0;
int init_delay_secs = 0;
const ACE_TCHAR *ior_file_name = ACE_TEXT ("");
- ACE_Get_Opt get_opts (argc, argv, ACE_TEXT ("d:n:o:?"));
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT ("d:m:n:o:?"));
int c;
while ((c = get_opts ()) != -1)
@@ -66,6 +67,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
case 'd':
init_delay_secs = ACE_OS::atoi (get_opts.opt_arg ());
break;
+ case 'm':
+ max_run = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
case 'n':
server_num = ACE_OS::atoi (get_opts.opt_arg ());
break;
@@ -93,13 +97,8 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
PortableServer::POA_var test_poa = createPOA(root_poa.in(), poa_name.c_str ());
- Terminator terminator;
- if (terminator.open (0) == -1)
- ACE_ERROR_RETURN((LM_ERROR,
- ACE_TEXT ("main Error opening terminator\n")),-1);
-
- PortableServer::Servant_var<Test_i> test_servant =
- new Test_i(server_num, terminator);
+ Test_i *impl = new Test_i(orb.in());
+ PortableServer::Servant_var<Test_i> test_servant = impl;
PortableServer::ObjectId_var object_id =
PortableServer::string_to_ObjectId("test_object");
@@ -156,8 +155,16 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
out << ACE_OS::getpid () << endl;
}
- orb->run();
-
+ if (max_run > 0)
+ {
+ ACE_Time_Value tv (max_run,0);
+ orb->run (tv);
+ }
+ else
+ {
+ orb->run ();
+ }
+ ec = impl->exit_code ();
root_poa->destroy(1,1);
orb->destroy();
@@ -169,5 +176,5 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
return 1;
}
- return 0;
+ return ec;
}