summaryrefslogtreecommitdiff
path: root/ACE/tests/Service_Config_Test.cpp
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2013-06-27 09:52:46 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2013-06-27 09:52:46 +0000
commit5531eb67c27b37cba02f671b7fb782486fd1da51 (patch)
treed39ac902f97c28f4262f3250439576936c183b2b /ACE/tests/Service_Config_Test.cpp
parent3a008174805d9979e563ffa79736741fb9de5dd0 (diff)
downloadATCD-5531eb67c27b37cba02f671b7fb782486fd1da51.tar.gz
Thu Jun 27 09:50:25 UTC 2013 Johnny Willemsen <jwillemsen@remedy.nl>
* tests/Service_Config_Test.cpp: Extended this test to run the usage of service config with multiple threads to check if we don't leak any TSS keys on Windows when ACE is used from a non ACE thread. With this addition I couldn't reproduce bugzilla 1797, but I still have to double check if the TSS is really triggered by my test addition
Diffstat (limited to 'ACE/tests/Service_Config_Test.cpp')
-rw-r--r--ACE/tests/Service_Config_Test.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/ACE/tests/Service_Config_Test.cpp b/ACE/tests/Service_Config_Test.cpp
index 95d7fba70fa..fb6ada61d00 100644
--- a/ACE/tests/Service_Config_Test.cpp
+++ b/ACE/tests/Service_Config_Test.cpp
@@ -658,6 +658,7 @@ testNonACEThread ()
if (thr_h == 0)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("_beginthreadex")));
+ ++error;
}
else
{
@@ -671,6 +672,7 @@ testNonACEThread ()
{
errno = status;
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("pthread_create")));
+ ++error;
}
else
{
@@ -680,10 +682,12 @@ testNonACEThread ()
if (error != errors_before) // The test failed; see if we can still see it
{
- if (0 != ACE_Service_Config::instance()->find
- (ACE_TEXT ("Test_Object_1_Thr")))
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("Main thr %t cannot find Test_Object_1_Thr\n")));
+ if (0 != ACE_Service_Config::instance()->find (ACE_TEXT ("Test_Object_1_Thr")))
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Main thr %t cannot find Test_Object_1_Thr\n")));
+ ++error;
+ }
else
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Main thr %t DOES find Test_Object_1_Thr\n")));
@@ -695,9 +699,11 @@ testNonACEThread ()
ACE_TEXT ("%p\n"),
ACE_TEXT ("Error removing service")));
++error;
- return;
}
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Non-ACE thread lookup test completed\n")));
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Non-ACE thread lookup test completed\n")));
+ }
}
#endif /* ACE_HAS_WTHREADS || ACE_HAS_PTHREADS */
@@ -714,7 +720,16 @@ run_main (int argc, ACE_TCHAR *argv[])
testLimits (argc, argv);
testrepository (argc, argv);
#if defined (ACE_HAS_WTHREADS) || defined (ACE_HAS_PTHREADS)
- testNonACEThread();
+ unsigned int n_threads = 64;
+#if defined (ACE_DEFAULT_THREAD_KEYS)
+ n_threads = 2 * ACE_DEFAULT_THREAD_KEYS;
+#endif
+ // Test with a large amount of threads to determine whether
+ // TSS works correctly with non ACE threads
+ for (unsigned int i = 0 ; i < n_threads; i++)
+ {
+ testNonACEThread();
+ }
#endif
ACE_END_TEST;