summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2009-06-15 07:45:10 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2009-06-15 07:45:10 +0000
commiteb8c1c98b68e72561db73422a6c6f3ea1ad19708 (patch)
tree5ae4cc6bb93b38a6cd86b2348ad639f176493433
parentc2fdf91997fa35a02bb01316a6688f91d6267a44 (diff)
downloadATCD-eb8c1c98b68e72561db73422a6c6f3ea1ad19708.tar.gz
Mon Jun 15 07:45:04 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl>
* tests/Bug_3673_Regression_Test.cpp: * tests/run_test.lst: * tests/tests.mpc: Added a new test for bugzilla 3673, this test whether exception handling works correctly. This doesn't work with CB2007 which is really a compiler bug. This test makes it easier to see if other compilers have the same bug
-rw-r--r--ACE/ChangeLog10
-rw-r--r--ACE/tests/Bug_3673_Regression_Test.cpp97
-rw-r--r--ACE/tests/run_test.lst1
-rw-r--r--ACE/tests/tests.mpc7
4 files changed, 115 insertions, 0 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index 418fcb08633..13484030e90 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,13 @@
+Mon Jun 15 07:45:04 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * tests/Bug_3673_Regression_Test.cpp:
+ * tests/run_test.lst:
+ * tests/tests.mpc:
+ Added a new test for bugzilla 3673, this test whether exception handling
+ works correctly. This doesn't work with CB2007 which is really a compiler
+ bug. This test makes it easier to see if other compilers have the same
+ bug
+
Fri Jun 12 19:05:43 UTC 2009 Adam Mitz <mitza@ociweb.com>
* ace/OS_NS_sys_socket.inl:
diff --git a/ACE/tests/Bug_3673_Regression_Test.cpp b/ACE/tests/Bug_3673_Regression_Test.cpp
new file mode 100644
index 00000000000..c074edbd1c9
--- /dev/null
+++ b/ACE/tests/Bug_3673_Regression_Test.cpp
@@ -0,0 +1,97 @@
+/**
+ * @file Bug_3673_Regression_Test.cpp
+ *
+ * $Id$
+ *
+ * Reproduces the problems reported in bug 3673
+ * http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=3673
+ */
+
+#include "test_config.h"
+#include "ace/ACE.h"
+#include "ace/OS_NS_stdio.h"
+
+ACE_RCSID (tests,
+ Bug_3673_Regression_Test,
+ "$Id$")
+
+#if defined (ACE_HAS_EXCEPTIONS)
+static bool construct_alpha = false;
+static bool destruct_alpha = false;
+static bool construct_beta = false;
+static bool destruct_beta = false;
+
+template <typename T>
+struct Alpha
+{
+ Alpha() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("construct alpha\n"))); construct_alpha = true;}
+ ~Alpha() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("destruct alpha\n"))); destruct_alpha = true;}
+};
+
+struct Beta
+{
+ Beta() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("construct beta\n"))); construct_beta = true;}
+ ~Beta() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("destruct bepha\n"))); destruct_beta = true;}
+};
+
+struct Test
+{
+ Alpha<int> a;
+ Beta b;
+
+ Test() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("throw oops\n"))); throw "oops"; }
+};
+#endif
+
+int
+run_main (int, ACE_TCHAR *[])
+{
+ ACE_START_TEST (ACE_TEXT ("Bug_3673_Regression_Test"));
+ int result = 0;
+
+#if defined (ACE_HAS_EXCEPTIONS)
+ bool caught_excep = false;
+ try
+ {
+ Test test;
+ }
+ catch (...)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Caugt exception!\n")));
+ caught_excep = true;
+ }
+
+ if (!caught_excep)
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not caugt exception\n")));
+ ++result;
+ }
+ if (!construct_alpha)
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("Constructor alpha not called\n")));
+ ++result;
+ }
+ if (!construct_beta)
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("Constructor beta not called\n")));
+ ++result;
+ }
+ if (!destruct_alpha)
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("Destructor alpha not called\n")));
+ ++result;
+ }
+ if (!destruct_beta)
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("Destructor beta not called\n")));
+ ++result;
+ }
+#else
+ ACE_ERROR ((LM_INFO,
+ ACE_TEXT ("C++ exception support not enabled on this platform\n")));
+#endif /* ACE_HAS_EXCEPTIONS */
+
+ ACE_END_TEST;
+
+ return result;
+}
diff --git a/ACE/tests/run_test.lst b/ACE/tests/run_test.lst
index d5fdfeedba3..f75e9bb5e98 100644
--- a/ACE/tests/run_test.lst
+++ b/ACE/tests/run_test.lst
@@ -50,6 +50,7 @@ Bug_3500_Regression_Test
Bug_3532_Regression_Test
Bug_3541_Regression_Test
Bug_3505_Regression_Test
+Bug_3673_Regression_Test
CDR_Array_Test: !ACE_FOR_TAO
CDR_File_Test: !ACE_FOR_TAO
CDR_Test
diff --git a/ACE/tests/tests.mpc b/ACE/tests/tests.mpc
index 0dc4ec19ad0..8ee5cef9ce8 100644
--- a/ACE/tests/tests.mpc
+++ b/ACE/tests/tests.mpc
@@ -360,6 +360,13 @@ project(Bug_3541_Regression_Test) : acetest {
}
}
+project(Bug_3673_Regression_Test) : acetest {
+ exename = Bug_3673_Regression_Test
+ Source_Files {
+ Bug_3673_Regression_Test.cpp
+ }
+}
+
project(Cache Map Manager Test) : acetest {
exename = Cache_Map_Manager_Test
Source_Files {