summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authormcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-09-16 10:37:29 +0000
committermcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-09-16 10:37:29 +0000
commitfb328d63fda8a8200fdc7a3324b91340e8ab3d55 (patch)
tree0435b506ac696031a1d94f4359041b2cf2408492 /TAO
parentda77e31b4d9b69393ead839d688244eb3e4845a3 (diff)
downloadATCD-fb328d63fda8a8200fdc7a3324b91340e8ab3d55.tar.gz
Thu Sep 16 10:32:39 UTC 2010 Martin Corino <mcorino@remedy.nl>
* test/Bug_3812_Regression: Removed unused, incomplete and incorrect test. The test attempted to test the problems from the referred bug but instead of testing the code from TAO itself it tested some simulating code in the test itself making it independent of whether TAO was fixed or not. Unfortunately it is not possible to change the test to reliably reproduce the bug (or its being fixed) using more generalized code accessing TAO functionality itself.
Diffstat (limited to 'TAO')
-rw-r--r--TAO/ChangeLog12
-rw-r--r--TAO/tests/Bug_3812_Regression/Bug_3812_Regression.cpp131
-rw-r--r--TAO/tests/Bug_3812_Regression/mock_ps.h13
-rw-r--r--TAO/tests/Bug_3812_Regression/mock_tdi.h12
-rw-r--r--TAO/tests/Bug_3812_Regression/mock_transport.h125
-rwxr-xr-xTAO/tests/Bug_3812_Regression/run_test.pl27
6 files changed, 12 insertions, 308 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 203643adeb6..cbbf683d0dc 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,15 @@
+Thu Sep 16 10:32:39 UTC 2010 Martin Corino <mcorino@remedy.nl>
+
+ * test/Bug_3812_Regression:
+ Removed unused, incomplete and incorrect test.
+ The test attempted to test the problems from the referred bug
+ but instead of testing the code from TAO itself it tested some
+ simulating code in the test itself making it independent of whether
+ TAO was fixed or not.
+ Unfortunately it is not possible to change the test to reliably
+ reproduce the bug (or its being fixed) using more generalized code
+ accessing TAO functionality itself.
+
Thu Sep 16 09:19:30 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
* DevGuideExamples/AMH_AMI/inner_i.cpp:
diff --git a/TAO/tests/Bug_3812_Regression/Bug_3812_Regression.cpp b/TAO/tests/Bug_3812_Regression/Bug_3812_Regression.cpp
deleted file mode 100644
index 44ba44797f1..00000000000
--- a/TAO/tests/Bug_3812_Regression/Bug_3812_Regression.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-// $Id$
-#include "ace/Get_Opt.h"
-#include "ace/Argv_Type_Converter.h"
-#include "ace/SString.h"
-#include "ace/Manual_Event.h"
-#include "ace/Task.h"
-
-#include "tao/Transport_Cache_Manager_T.h"
-#include "tao/ORB.h"
-#include "tao/Condition.h"
-
-class mock_transport;
-class mock_tdi;
-class mock_ps;
-
-static int global_purged_count = 0;
-
-#include "mock_tdi.h"
-#include "mock_transport.h"
-#include "mock_ps.h"
-
-static TCM* tcm = 0;
-static int result = 0;
-static TAO_SYNCH_MUTEX test_lock;
-static TAO_Condition<TAO_SYNCH_MUTEX> test_condition(test_lock);
-static int n_threads = 1;
-
-int
-parse_args (int argc, ACE_TCHAR *argv[])
-{
- ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("t:"));
- int c;
-
- while ((c = get_opts ()) != -1)
- switch (c)
- {
- case 't':
- n_threads = ACE_OS::atoi(get_opts.opt_arg());
- break;
- case '?':
- default:
- ACE_ERROR_RETURN ((LM_ERROR,
- "usage: %s "
- "-t <n_threads>"
- "\n",
- argv [0]),
- -1);
- }
- // Indicates sucessful parsing of the command line
- return 0;
-}
-
-class Client_Task : public ACE_Task_Base
-{
- public :
- Client_Task (mock_tdi& tdi, mock_transport& trans)
- : tdi_ (tdi),
- trans_ (trans)
- {
- }
-
-
- ~Client_Task () {};
-
- void process_listen_point ()
- {
- this->trans_.purge_entry ();
- // Allocate a new char to avoid the cache_transport malloc/free entry
- // on same address which makes it harder to verify test result.
- char*x = new char[1];
- tcm->cache_transport (&tdi_, &trans_);
- this->trans_.make_idle();
- delete x;
- }
-
- int svc ()
- {
- ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, test_lock);
- process_listen_point ();
- test_condition.signal ();
- return 0;
- };
-
-
- private:
- mock_tdi& tdi_;
- mock_transport& trans_;
-};
-
-
-
-
-int
-ACE_TMAIN(int argc, ACE_TCHAR *argv[])
-{
- try
- {
- // We need an ORB to get an ORB core
- CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
-
- if (parse_args (argc, argv) != 0)
- return 1;
-
- size_t const transport_max = 10;
- int cache_maximum = 10;
- int purging_percentage = 20;
- mock_transport mytransport(orb->orb_core ());
- mock_tdi mytdi;
- mock_ps* myps = new mock_ps(1);
- TCM my_cache (purging_percentage, myps, cache_maximum, false, 0);
-
- tcm = &my_cache;
- tcm->cache_transport (&mytdi, &mytransport);
-
- Client_Task client_task(mytdi, mytransport);
- if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, 2, 1) == -1)
- {
- ACE_ERROR ((LM_ERROR, "Error activating client task\n"));
- }
-
- client_task.wait ();
-
- orb->destroy ();
-
- }
- catch (const CORBA::Exception&)
- {
- // Ignore exceptions..
- }
- return result;
-}
diff --git a/TAO/tests/Bug_3812_Regression/mock_ps.h b/TAO/tests/Bug_3812_Regression/mock_ps.h
deleted file mode 100644
index 6c6631d8c07..00000000000
--- a/TAO/tests/Bug_3812_Regression/mock_ps.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// $Id$
-
-class mock_ps
-{
-public:
- mock_ps (int max) : maximum_ (max) {}
- void update_item (mock_transport*) {}
- int cache_maximum () { return this->maximum_;}
-private:
- int maximum_;
-};
-
-
diff --git a/TAO/tests/Bug_3812_Regression/mock_tdi.h b/TAO/tests/Bug_3812_Regression/mock_tdi.h
deleted file mode 100644
index 341b9b31626..00000000000
--- a/TAO/tests/Bug_3812_Regression/mock_tdi.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// $Id$
-
-class mock_tdi
-{
-public:
- mock_tdi () {}
- u_long hash (void) {return static_cast<u_long> (reinterpret_cast<ptrdiff_t> (this));}
- mock_tdi *duplicate (void) {return 0;}
- CORBA::Boolean is_equivalent (const mock_tdi *) {return true;}
-
-};
-
diff --git a/TAO/tests/Bug_3812_Regression/mock_transport.h b/TAO/tests/Bug_3812_Regression/mock_transport.h
deleted file mode 100644
index 4b466ff5a65..00000000000
--- a/TAO/tests/Bug_3812_Regression/mock_transport.h
+++ /dev/null
@@ -1,125 +0,0 @@
-// $Id$
-
-#include "tao/ORB_Core.h"
-
-typedef TAO::Transport_Cache_Manager_T<mock_transport, mock_tdi, mock_ps> TCM;
-
-extern TCM* tcm;
-extern int result;
-extern TAO_SYNCH_MUTEX test_lock;
-extern TAO_Condition<TAO_SYNCH_MUTEX> test_condition;
-
-
-class mock_transport
-{
-public:
- mock_transport (TAO_ORB_Core *orb_core)
- : id_(0)
- , is_connected_(false)
- , entry_(0)
- , purging_order_ (0)
- , purged_count_ (0)
- , handler_lock_ (orb_core->resource_factory ()->create_cached_connection_lock ())
- {}
-
- size_t id (void) const {return id_;}
- void id (size_t id) { this->id_ = id;}
- unsigned long purging_order (void) const {return purging_order_;}
- void purging_order (unsigned long purging_order) { this->purging_order_ = purging_order;}
- bool is_connected (void) const {return is_connected_;}
- void is_connected (bool is_connected) { this->is_connected_ = is_connected;}
- ACE_Event_Handler::Reference_Count add_reference (void) {return 0;}
- ACE_Event_Handler::Reference_Count remove_reference (void) {return 0;}
-
- // Implementation needs be similar to TAO_Transport::cache_map_entry().
- void cache_map_entry (TCM::HASH_MAP_ENTRY *entry) {
- ACE_GUARD (ACE_Lock, ace_mon, *this->handler_lock_);
- ACE_DEBUG ((LM_DEBUG, "(%P|%t)cache_map_entry %X\n", entry));
- this->entry_ = entry;
- }
- TCM::HASH_MAP_ENTRY *cache_map_entry (void) {return this->entry_;}
- void close_connection (void) { purged_count_ = ++global_purged_count;};
- int purged_count (void) { return this->purged_count_;}
- bool can_be_purged (void) { return true;}
-
- // Implementation needs be similar to TAO_Transport::purge_entry().
- int purge_entry (void)
- {
- TCM::HASH_MAP_ENTRY* entry = 0;
- {
- ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1);
- ACE_DEBUG ((LM_DEBUG, "(%P|%t)purge_entry %X\n", this->entry_));
- entry = this->entry_;
- this->entry_ = 0;
- }
- return tcm->purge_entry (entry);
- }
-
- // Implementation needs be similar to TAO_Transport::make_idle().
- //
- // int
- // TAO_Transport::make_idle (void)
- // {
- // if (TAO_debug_level > 3)
- // {
- // ACE_DEBUG ((LM_DEBUG,
- // ACE_TEXT ("TAO (%P|%t) - Transport[%d]::make_idle\n"),
- // this->id ()));
- // }
- //
- // return this->transport_cache_manager ().make_idle (this->cache_map_entry_);
- // }
-
- // Code are added to simulate the situation that the cached entry pointer passed
- // to TCM to make entry idle is deleted by another thread b/c of re-cache transport
- // and cause TCM make idle on an invalid entry. Otherwise we need delay and similar
- // code in TCM::make_idl() to reproduce the problem.
-
- int make_idle (void)
- {
- static bool is_first = true;
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t)make_idle pass entry %X\n", this->entry_));
-
- TCM::HASH_MAP_ENTRY* entry = this->entry_;
-
- // The first thread comes to this point, record the entry
- // and wait for second thread to process listen point which
- // re-cache transport.
- if (is_first)
- {
- is_first = false;
- test_condition.wait ();
- }
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t)make_idle execute on entry %X and now entry %X\n",
- entry, this->entry_));
-
- // When the first thread is at this point, the entry is
- // deleted by second thread, so make idle on the invalid
- // entry cause SEGV. It's possible that the memory is still
- // available then next checking if entry is changed should
- // confirm if the entry is valid or not.
- int ret = tcm->make_idle (entry);
- if (entry != this->entry_)
- {
- ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t)ERROR: Entry was changed ")
- ACE_TEXT ("after passing to TCM and before calling make_idl.\n")));
- result = 1;
- }
-
- return ret;
- }
-
-
-private:
- size_t id_;
- bool is_connected_;
- TCM::HASH_MAP_ENTRY *entry_;
- unsigned long purging_order_;
- /// When did we got purged
- int purged_count_;
- mutable ACE_Lock *handler_lock_;
-};
-
-
diff --git a/TAO/tests/Bug_3812_Regression/run_test.pl b/TAO/tests/Bug_3812_Regression/run_test.pl
deleted file mode 100755
index 033e19742ac..00000000000
--- a/TAO/tests/Bug_3812_Regression/run_test.pl
+++ /dev/null
@@ -1,27 +0,0 @@
-# $Id$
-# -*- perl -*-
-
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
- & eval 'exec perl -S $0 $argv:q'
- if 0;
-
-use lib "$ENV{ACE_ROOT}/bin";
-use PerlACE::TestTarget;
-use strict;
-
-my $status = 0;
-my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
-my $P = $server->CreateProcess ("Bug_3812_Regression");
-print "Running Bug_3812_Regression ...\n";
-my $result = $P->Spawn ();
-if ($result != 0) {
- print "test FAILED\n";
- $status = 1;
-}
-$result = $P->WaitKill($server->ProcessStartWaitInterval());
-if ($result != 0) {
- print "test FAILED\n";
- $status = 1;
-}
-
-exit $status;