diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-07-10 19:12:46 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-07-10 19:12:46 +0000 |
commit | ba3d239c56db331f9b88d597e1fcd9a64a193825 (patch) | |
tree | 5fb6f54c20bb0549d8af2d7bccfaffb6ca5801fd | |
parent | abf7dedf4a24d1493953c27c368242e3be1175b8 (diff) | |
download | ATCD-ba3d239c56db331f9b88d597e1fcd9a64a193825.tar.gz |
ChangeLogTag:Sat Jul 10 13:16:50 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
-rw-r--r-- | tests/ACE_Init_Test.h | 60 | ||||
-rw-r--r-- | tests/ACE_Init_Test_StdAfx.h | 44 | ||||
-rw-r--r-- | tests/Cache_Map_Manager_Test.cpp | 28 | ||||
-rw-r--r-- | tests/Cache_Map_Manager_Test.h | 21 | ||||
-rw-r--r-- | tests/Conn_Test.h | 20 | ||||
-rw-r--r-- | tests/DLL_Test.h | 20 | ||||
-rw-r--r-- | tests/MT_Reactor_Timer_Test.cpp | 31 | ||||
-rw-r--r-- | tests/Map_Test.h | 28 | ||||
-rw-r--r-- | tests/New_Fail_Test.cpp | 78 | ||||
-rw-r--r-- | tests/Priority_Reactor_Test.h | 2 | ||||
-rw-r--r-- | tests/RB_Tree_Test.h | 1 | ||||
-rw-r--r-- | tests/Reactor_Performance_Test.h | 1 | ||||
-rw-r--r-- | tests/TSS_Test_Errno.h | 19 | ||||
-rw-r--r-- | tests/Thread_Pool_Test.cpp | 6 |
14 files changed, 236 insertions, 123 deletions
diff --git a/tests/ACE_Init_Test.h b/tests/ACE_Init_Test.h index bfe7f784a81..cd4d6d386f1 100644 --- a/tests/ACE_Init_Test.h +++ b/tests/ACE_Init_Test.h @@ -1,9 +1,23 @@ +/* -*- C++ -*- */ // $Id$ + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// ACE_Init_Test.h // -// ACE_Init_Test.h : main header file for the ACE_INIT_TEST application +// = DESCRIPTION +// Main header file for the ACE_INIT_TEST application. // +// = AUTHOR +// Steve Huston <shuston@cs.wustl.edu> +// +// ============================================================================ -#if !defined(AFX_ACE_INIT_TEST_H__64FDC9FE_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_) +#ifndef AFX_ACE_INIT_TEST_H__64FDC9FE_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_ #define AFX_ACE_INIT_TEST_H__64FDC9FE_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_ #if _MSC_VER >= 1000 @@ -16,36 +30,30 @@ #include "ACE_Init_Test_Resource.h" // main symbols -///////////////////////////////////////////////////////////////////////////// -// CACE_Init_TestApp: -// See ACE_Init_Test.cpp for the implementation of this class -// - class CACE_Init_TestApp : public CWinApp { + // = TITLE + // See ACE_Init_Test.cpp for the implementation of this class public: - CACE_Init_TestApp(); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CACE_Init_TestApp) - public: - virtual BOOL InitInstance(); - //}}AFX_VIRTUAL - -// Implementation - - //{{AFX_MSG(CACE_Init_TestApp) - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; + CACE_Init_TestApp (void); + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CACE_Init_TestApp) +public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL -///////////////////////////////////////////////////////////////////////////// + // Implementation + + //{{AFX_MSG(CACE_Init_TestApp) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. -#endif // !defined(AFX_ACE_INIT_TEST_H__64FDC9FE_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_) +#endif /* !defined(AFX_ACE_INIT_TEST_H__64FDC9FE_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_) */ diff --git a/tests/ACE_Init_Test_StdAfx.h b/tests/ACE_Init_Test_StdAfx.h index d11f7c7efce..ea1871ec913 100644 --- a/tests/ACE_Init_Test_StdAfx.h +++ b/tests/ACE_Init_Test_StdAfx.h @@ -1,26 +1,44 @@ +/* -*- C++ -*- */ // $Id$ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// ACE_Init_Test_StdAfx.h // +// = DESCRIPTION +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// +// = AUTHOR +// Steve Huston <shuston@cs.wustl.edu> +// +// ============================================================================ -#if !defined(AFX_STDAFX_H__64FDCA02_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_) +#ifndef AFX_STDAFX_H__64FDCA02_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_ #define AFX_STDAFX_H__64FDCA02_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +// Exclude rarely-used stuff from Windows headers +#define VC_EXTRALEAN -#include <afxwin.h> // MFC core and standard components -#include <afxext.h> // MFC extensions +// MFC core and standard components +#include <afxwin.h> +// MFC extensions +#include <afxext.h> #ifndef _AFX_NO_AFXCMN_SUPPORT -#include <afxcmn.h> // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - +// MFC support for Windows Common Controls +#include <afxcmn.h> +#endif /* _AFX_NO_AFXCMN_SUPPORT */ -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. +//{{AFX_INSERT_LOCATION}} Microsoft Developer Studio will insert +//additional declarations immediately before the previous line. -#endif // !defined(AFX_STDAFX_H__64FDCA02_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_) +#endif /* !defined(AFX_STDAFX_H__64FDCA02_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_) */ diff --git a/tests/Cache_Map_Manager_Test.cpp b/tests/Cache_Map_Manager_Test.cpp index c6af6a52252..c6c15c5870c 100644 --- a/tests/Cache_Map_Manager_Test.cpp +++ b/tests/Cache_Map_Manager_Test.cpp @@ -33,7 +33,7 @@ #include "ace/Pair_T.h" #include "ace/Synch.h" #include "ace/Get_Opt.h" -#include "Cache_Map_Manager_Test.h" // hash_key class defined in here +#include "Cache_Map_Manager_Test.h" // Hash_Key class defined in here #if defined(__BORLANDC__) && __BORLANDC__ >= 0x0530 USELIB("..\ace\aced.lib"); @@ -46,9 +46,9 @@ typedef int ATTR; typedef ACE_Pair<VALUE, ATTR> CACHE_VALUE; typedef ACE_Equal_To<KEY> COMPARE_KEYS; -typedef ACE_Hash_Map_Manager_Ex<KEY, CACHE_VALUE, hash_key, ACE_Equal_To<KEY>, ACE_Null_Mutex> +typedef ACE_Hash_Map_Manager_Ex<KEY, CACHE_VALUE, Hash_Key, ACE_Equal_To<KEY>, ACE_Null_Mutex> HASH_MAP_MANAGER; -typedef ACE_Hash_Map_Iterator_Ex<KEY, CACHE_VALUE, hash_key, ACE_Equal_To<KEY>, ACE_Null_Mutex> +typedef ACE_Hash_Map_Iterator_Ex<KEY, CACHE_VALUE, Hash_Key, ACE_Equal_To<KEY>, ACE_Null_Mutex> HASH_MAP_ITERATOR; typedef ACE_Map_Manager<KEY, CACHE_VALUE, ACE_Null_Mutex> @@ -104,7 +104,7 @@ typedef ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CA typedef ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY, MAP_NULL> MAP_NULL_ADAPTER; -typedef ACE_Hash_Cache_Map_Manager<KEY, VALUE, hash_key, ACE_Equal_To<KEY>, HASH_MAP_CACHING_STRATEGY, ATTR> +typedef ACE_Hash_Cache_Map_Manager<KEY, VALUE, Hash_Key, ACE_Equal_To<KEY>, HASH_MAP_CACHING_STRATEGY, ATTR> HASH_MAP_CACHE; typedef ACE_Cache_Map_Manager<KEY, VALUE, MAP_MANAGER, MAP_ITERATOR, MAP_REV_ITERATOR, MAP_CACHING_STRATEGY, ATTR> MAP_CACHE; @@ -601,10 +601,10 @@ template class ACE_Pair<VALUE, ATTR>; template class ACE_Reference_Pair<KEY, VALUE>; template class ACE_Equal_To<KEY>; -template class ACE_Hash_Map_Manager_Ex<KEY, CACHE_VALUE, hash_key, ACE_Equal_To<KEY>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<KEY, CACHE_VALUE, hash_key, ACE_Equal_To<KEY>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<KEY, CACHE_VALUE, hash_key, ACE_Equal_To<KEY>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<KEY, CACHE_VALUE, hash_key, ACE_Equal_To<KEY>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager_Ex<KEY, CACHE_VALUE, Hash_Key, ACE_Equal_To<KEY>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<KEY, CACHE_VALUE, Hash_Key, ACE_Equal_To<KEY>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<KEY, CACHE_VALUE, Hash_Key, ACE_Equal_To<KEY>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<KEY, CACHE_VALUE, Hash_Key, ACE_Equal_To<KEY>, ACE_Null_Mutex>; template class ACE_Hash_Map_Entry<KEY, CACHE_VALUE>; template class ACE_Map_Manager<KEY, CACHE_VALUE, ACE_Null_Mutex>; @@ -649,7 +649,7 @@ template class ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, MAP_MANAGER::reverse_i template class ACE_Cache_Map_Manager<KEY, VALUE, HASH_MAP_MANAGER, HASH_MAP_MANAGER::iterator, HASH_MAP_MANAGER::reverse_iterator, HASH_MAP_CACHING_STRATEGY, ATTR>; template class ACE_Cache_Map_Iterator<KEY, VALUE, HASH_MAP_MANAGER::iterator, HASH_MAP_CACHING_STRATEGY, ATTR>; template class ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, HASH_MAP_MANAGER::reverse_iterator, HASH_MAP_CACHING_STRATEGY, ATTR>; -template class ACE_Hash_Cache_Map_Manager<KEY, VALUE, hash_key, ACE_Equal_To<KEY>, HASH_MAP_CACHING_STRATEGY, ATTR>; +template class ACE_Hash_Cache_Map_Manager<KEY, VALUE, Hash_Key, ACE_Equal_To<KEY>, HASH_MAP_CACHING_STRATEGY, ATTR>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) @@ -657,10 +657,10 @@ template class ACE_Hash_Cache_Map_Manager<KEY, VALUE, hash_key, ACE_Equal_To<KEY #pragma instantiate ACE_Reference_Pair<KEY, VALUE> #pragma instantiate ACE_Equal_To<KEY> -#pragma instantiate ACE_Hash_Map_Manager_Ex<KEY, CACHE_VALUE, hash_key, ACE_Equal_To<KEY>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<KEY, CACHE_VALUE, hash_key, ACE_Equal_To<KEY>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<KEY, CACHE_VALUE, hash_key, ACE_Equal_To<KEY>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<KEY, CACHE_VALUE, hash_key, ACE_Equal_To<KEY>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Manager_Ex<KEY, CACHE_VALUE, Hash_Key, ACE_Equal_To<KEY>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<KEY, CACHE_VALUE, Hash_Key, ACE_Equal_To<KEY>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<KEY, CACHE_VALUE, Hash_Key, ACE_Equal_To<KEY>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<KEY, CACHE_VALUE, Hash_Key, ACE_Equal_To<KEY>, ACE_Null_Mutex> #pragma instantiate ACE_Hash_Map_Entry<KEY, CACHE_VALUE> #pragma instantiate ACE_Map_Manager<KEY, CACHE_VALUE, ACE_Null_Mutex> @@ -705,6 +705,6 @@ template class ACE_Hash_Cache_Map_Manager<KEY, VALUE, hash_key, ACE_Equal_To<KEY #pragma instantiate ACE_Cache_Map_Manager<KEY, VALUE, HASH_MAP_MANAGER, HASH_MAP_MANAGER::iterator, HASH_MAP_MANAGER::reverse_iterator, HASH_MAP_CACHING_STRATEGY, ATTR> #pragma instantiate ACE_Cache_Map_Iterator<KEY, VALUE, HASH_MAP_MANAGER::iterator, HASH_MAP_CACHING_STRATEGY, ATTR> #pragma instantiate ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, HASH_MAP_MANAGER::reverse_iterator, HASH_MAP_CACHING_STRATEGY, ATTR> -#pragma instantiate ACE_Hash_Cache_Map_Manager<KEY, VALUE, hash_key, ACE_Equal_To<KEY>, HASH_MAP_CACHING_STRATEGY, ATTR> +#pragma instantiate ACE_Hash_Cache_Map_Manager<KEY, VALUE, Hash_Key, ACE_Equal_To<KEY>, HASH_MAP_CACHING_STRATEGY, ATTR> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/tests/Cache_Map_Manager_Test.h b/tests/Cache_Map_Manager_Test.h index 54261be9d0c..5f75635a04c 100644 --- a/tests/Cache_Map_Manager_Test.h +++ b/tests/Cache_Map_Manager_Test.h @@ -1,7 +1,22 @@ +/* -*- C++ -*- */ // $Id$ -// Define class needed for generating templates. IBM C++ requires this to -// be in its own file for auto template instantiation. +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// Cache_Map_Manager_Test.h +// +// = DESCRIPTION +// Define class needed for generating templates. IBM C++ requires this to +// be in its own file for auto template instantiation. +// +// = AUTHOR +// Kirthika Parameswaran <kirthika@cs.wustl.edu> +// +// ============================================================================ #ifndef __ACE_CACHE_MAP_MANAGER_TEST_H #define __ACE_CACHE_MAP_MANAGER_TEST_H @@ -10,7 +25,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -class hash_key +class Hash_Key { public: u_long operator () (size_t t) const diff --git a/tests/Conn_Test.h b/tests/Conn_Test.h index c0dc9c37de0..86f7adbf805 100644 --- a/tests/Conn_Test.h +++ b/tests/Conn_Test.h @@ -1,5 +1,23 @@ +/* -*- C++ -*- */ // $Id$ +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// Conn_Test.h +// +// = DESCRIPTION +// Define class needed for generating templates. IBM C++ requires this to +// be in its own file for auto template instantiation. +// +// = AUTHOR +// Irfan Pyarali <irfan@cs.wustl.edu> +// +// ============================================================================ + #include "ace/Service_Config.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -10,6 +28,7 @@ #include "ace/SOCK_Stream.h" class Svc_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> +{ // = TITLE // This class is the product created by both <ACE_Connector> // and <ACE_Acceptor> objects. @@ -18,7 +37,6 @@ class Svc_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> // This class gets its own header file to work around AIX C++ // compiler "features" related to template instantiation... It is // only used by Conn_Test.cpp. -{ public: Svc_Handler (ACE_Thread_Manager * = 0); // Do-nothing constructor. diff --git a/tests/DLL_Test.h b/tests/DLL_Test.h index bbdc085c520..7db2754cbce 100644 --- a/tests/DLL_Test.h +++ b/tests/DLL_Test.h @@ -1,8 +1,22 @@ // $Id$ -// This file has the class definitions needed for template generation in -// DLL_Test.cpp. They have to be in a separate file so AIX xlC can -// find them at auto-instantiate time. +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// DLL_Test.h +// +// = DESCRIPTION +// This file has the class definitions needed for template generation in +// DLL_Test.cpp. They have to be in a separate file so AIX xlC can +// find them at auto-instantiate time. +// +// = AUTHOR +// Kirthika Parameswaran <kirthika@cs.wustl.edu> +// +// ============================================================================ #ifndef ACE_DLL_TEST_H #define ACE_DLL_TEST_H diff --git a/tests/MT_Reactor_Timer_Test.cpp b/tests/MT_Reactor_Timer_Test.cpp index 989bc8cbb35..42a6d2a4902 100644 --- a/tests/MT_Reactor_Timer_Test.cpp +++ b/tests/MT_Reactor_Timer_Test.cpp @@ -256,7 +256,6 @@ Dispatch_Count_Handler::handle_timeout (const ACE_Time_Value &tv, return 0; } - int Dispatch_Count_Handler::verify_results (void) { @@ -268,7 +267,6 @@ Dispatch_Count_Handler::verify_results (void) } - int main (int, ASYS_TCHAR *[]) { @@ -292,7 +290,7 @@ main (int, ASYS_TCHAR *[]) 1); ACE_Time_Value no_waiting (0); - ssize_t events = 0; + size_t events = 0; while (1) { @@ -311,17 +309,22 @@ main (int, ASYS_TCHAR *[]) // All <ACE_MAX_TIMERS> + 2 I/O dispatches (one for <handle_input> // and the other for <handle_exception>) should be counted in // events. - if (events < ACE_MAX_TIMERS + 2) { - ACE_ERROR ((LM_ERROR, ASYS_TEXT ("expected %d events, got %d instead\n"), - ACE_MAX_TIMERS + 2, events)); - ACE_ASSERT (events >= ACE_MAX_TIMERS + 2); - } + if (events < ACE_MAX_TIMERS + 2) + { + ACE_ERROR ((LM_ERROR, + ASYS_TEXT ("expected %d events, got %d instead\n"), + ACE_MAX_TIMERS + 2, + events)); + ACE_ASSERT (events >= ACE_MAX_TIMERS + 2); + } status = callback.verify_results (); - if (status != 0) { - ACE_ERROR ((LM_ERROR, ASYS_TEXT ("Dispatch counting test failed.\n"))); - test_result = 1; - } + if (status != 0) + { + ACE_ERROR ((LM_ERROR, + ASYS_TEXT ("Dispatch counting test failed.\n"))); + test_result = 1; + } #if defined (ACE_HAS_THREADS) @@ -341,7 +344,9 @@ main (int, ASYS_TCHAR *[]) if (status == -1) { ACE_ERROR ((LM_ERROR, - ASYS_TEXT ("%p, errno is %d\n"), "wait ()", errno)); + ASYS_TEXT ("%p, errno is %d\n"), + "wait ()", + errno)); ACE_ASSERT (status != -1); } diff --git a/tests/Map_Test.h b/tests/Map_Test.h index 432ae1a4d57..824b52fc8f4 100644 --- a/tests/Map_Test.h +++ b/tests/Map_Test.h @@ -1,8 +1,23 @@ +/* -*- C++ -*- */ // $Id$ -// This file has the class definitions needed for template generation in -// Map_Test.cpp. They have to be in a separate file so AIX xlC can -// find them at auto-instantiate time. +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// Map_Test.h +// +// = DESCRIPTION +// This file has the class definitions needed for template generation in +// Map_Test.cpp. They have to be in a separate file so AIX xlC can +// find them at auto-instantiate time. +// +// = AUTHOR +// Irfan Pyarali <irfan@cs.wustl.edu> +// +// ============================================================================ #ifndef ACE_MAP_TEST_H #define ACE_MAP_TEST_H @@ -15,12 +30,9 @@ #include "ace/Active_Map_Manager.h" #include "ace/Containers.h" - // Key data type. typedef ACE_Array<char> KEY; -//////////////////////////////////////////////////////////////////////////////// - class Key_Generator { // = TITLE @@ -59,8 +71,6 @@ private: u_long counter_; }; -//////////////////////////////////////////////////////////////////////////////// - class Hash_Key { public: @@ -80,8 +90,6 @@ public: } }; -//////////////////////////////////////////////////////////////////////////////// - class Key_Adapter { public: diff --git a/tests/New_Fail_Test.cpp b/tests/New_Fail_Test.cpp index 82b6d5db501..7fe49e79948 100644 --- a/tests/New_Fail_Test.cpp +++ b/tests/New_Fail_Test.cpp @@ -1,5 +1,5 @@ // $Id$ -// + // ============================================================================ // // = LIBRARY @@ -19,7 +19,7 @@ // new will throw an exception, and trust that the user accepts that risk. // // = AUTHOR -// Steve Huston +// Steve Huston <shuston@riverace.com> // // ============================================================================ @@ -35,54 +35,59 @@ USELIB("..\ace\aced.lib"); //--------------------------------------------------------------------------- #endif /* defined(__BORLANDC__) && __BORLANDC__ >= 0x0530 */ - -// This test allocates all of the heap memory, forcing 'new' to fail because -// of a lack of memory. The ACE_NEW macros should prevent an exception from -// being thrown past the ACE_NEW. If this test doesn't wipe out on an alloc -// exception, it passes. +// This test allocates all of the heap memory, forcing 'new' to fail +// because of a lack of memory. The ACE_NEW macros should prevent an +// exception from being thrown past the ACE_NEW. If this test doesn't +// wipe out on an alloc exception, it passes. // // If it doesn't ever fail an allocation, there's a warning that something is // wrong. The allocated memory is always freed to avoid masking a leak // somewhere else in the test. -static const int BIG_BLOCK = 1024*1024; // 1MB -static const int MAX_ALLOCS_IN_TEST = 4096; // about 4GB max in the test +// 1MB +static const int BIG_BLOCK = 1024*1024; -static void try_ace_new (char **p) +// about 4GB max in the test +static const int MAX_ALLOCS_IN_TEST = 4096; + +static void +try_ace_new (char **p) { ACE_NEW (*p, char[BIG_BLOCK]); return; } - -static char * try_ace_new_return (void) +static char * +try_ace_new_return (void) { - char *p; + char *p = 0; ACE_NEW_RETURN (p, char[BIG_BLOCK], 0); return p; } - int main (int, ASYS_TCHAR *[]) { ACE_START_TEST (ASYS_TEXT ("New_Fail_Test")); int status = 0; - // Some platforms are known to throw an exception on a failed 'new', but - // are customarily built without exception support to improve performance. - // These platforms are noted, and the test passes. - // For new ports, it is wise to let this test run. Depending on intended - // conditions, exceptions can be disabled when the port is complete. + // Some platforms are known to throw an exception on a failed 'new', + // but are customarily built without exception support to improve + // performance. These platforms are noted, and the test passes. + // For new ports, it is wise to let this test run. Depending on + // intended conditions, exceptions can be disabled when the port is + // complete. #if (defined (__SUNPRO_CC) || defined (__GNUG__)) && \ - !defined (ACE_HAS_EXCEPTIONS) - ACE_DEBUG ((LM_NOTICE, ASYS_TEXT ("Out-of-memory will throw an unhandled exception\n"))); + !defined (ACE_HAS_EXCEPTIONS) + ACE_DEBUG ((LM_NOTICE, ASYS_TEXT ("Out-of-memory will throw an unhandled exception\n"))); ACE_DEBUG ((LM_NOTICE, ASYS_TEXT ("Rebuild with exceptions=1 to prevent this, but it may impair performance.\n"))); // Use the static function addresses, to prevent warnings about the // functions not being used. - if (&try_ace_new) /* null */; - if (&try_ace_new_return) /* null */; + if (&try_ace_new) + /* NULL */; + if (&try_ace_new_return) + /* NULL */; #else char *blocks[MAX_ALLOCS_IN_TEST]; @@ -103,13 +108,16 @@ main (int, ASYS_TCHAR *[]) { ACE_ERROR((LM_WARNING, ASYS_TEXT ("Test didn't exhaust all available memory\n"))); - --i; // Back up to valid pointer for deleting + // Back up to valid pointer for deleting. + --i; } else { ACE_ASSERT (blocks[i] == 0); ACE_ASSERT (errno == ENOMEM); - ACE_DEBUG((LM_DEBUG, ASYS_TEXT ("ACE_NEW failed properly at block %d\n"), i)); + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("ACE_NEW failed properly at block %d\n"), + i)); } // Free the memory to try ACE_NEW_RETURN @@ -123,17 +131,20 @@ main (int, ASYS_TCHAR *[]) if (blocks[i] == 0) break; } + if (i == MAX_ALLOCS_IN_TEST) { - ACE_ERROR((LM_WARNING, - ASYS_TEXT ("Test didn't exhaust all available memory\n"))); - --i; // Back up to valid pointer + ACE_ERROR ((LM_WARNING, + ASYS_TEXT ("Test didn't exhaust all available memory\n"))); + // Back up to valid pointer. + --i; } else { ACE_ASSERT (blocks[i] == 0); ACE_ASSERT (errno == ENOMEM); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("ACE_NEW_RETURN failed properly at block %d\n"), + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("ACE_NEW_RETURN failed properly at block %d\n"), i)); } while (i >= 0) @@ -145,11 +156,12 @@ main (int, ASYS_TCHAR *[]) catch (...) { ACE_ERROR ((LM_ERROR, - ASYS_TEXT ("Caught exception during test; ") - ASYS_TEXT ("ACE_bad_alloc not defined correctly, or\n"))); + ASYS_TEXT ("Caught exception during test; ") + ASYS_TEXT ("ACE_bad_alloc not defined correctly, or\n"))); ACE_ERROR ((LM_ERROR, - ASYS_TEXT ("ACE_NEW_THROWS_EXCEPTIONS is not #defined (and should be).\n"))); - status = 1; // Mark test failure + ASYS_TEXT ("ACE_NEW_THROWS_EXCEPTIONS is not #defined (and should be).\n"))); + // Mark test failure + status = 1; } #endif /* ACE_HAS_EXCEPTIONS */ #endif /* __SUNPRO_CC && !ACE_HAS_EXCEPTIONS */ diff --git a/tests/Priority_Reactor_Test.h b/tests/Priority_Reactor_Test.h index a8a5fa57266..fdf17865448 100644 --- a/tests/Priority_Reactor_Test.h +++ b/tests/Priority_Reactor_Test.h @@ -14,7 +14,7 @@ // only used by Priority_Reactor_Test.cpp. // // = AUTHOR -// Carlos O'Ryan +// Carlos O'Ryan <coryan@cs.wustl.edu> // // ============================================================================ diff --git a/tests/RB_Tree_Test.h b/tests/RB_Tree_Test.h index e86c34d42d4..5ace060300d 100644 --- a/tests/RB_Tree_Test.h +++ b/tests/RB_Tree_Test.h @@ -1,3 +1,4 @@ +/* -*- C++ -*- */ // $Id$ // ============================================================================ diff --git a/tests/Reactor_Performance_Test.h b/tests/Reactor_Performance_Test.h index a034a80d9e3..95940abebc1 100644 --- a/tests/Reactor_Performance_Test.h +++ b/tests/Reactor_Performance_Test.h @@ -9,7 +9,6 @@ // Reactor_Performance_Test.h // // = DESCRIPTION -// // This file includes template class definitions for the // Reactor_Performance_Test.cpp program. // diff --git a/tests/TSS_Test_Errno.h b/tests/TSS_Test_Errno.h index 10b7eff1b34..bbec5a05eb3 100644 --- a/tests/TSS_Test_Errno.h +++ b/tests/TSS_Test_Errno.h @@ -1,7 +1,23 @@ /* -*- C++ -*- */ // $Id$ +// ============================================================================ +// +// = FILENAME +// TSS_Test_Errno.h +// +// = DESCRIPTION +// This file contains the definition of Errno. Some compilers need +// it in a .h file for template instantiation (such as AIX C Set +// ++). +// +// = AUTHOR +// Douglas C. Schmidt <schmidt@cs.wustl.edu> +// +// ============================================================================ + class Errno +{ // = TITLE // Define a simple Errno abstraction // @@ -9,7 +25,6 @@ class Errno // This class gets its own header file to work around AIX C++ // compiler "features" related to template instantiation... It is // only used by TSS_Test.cpp. -{ public: int error (void) { return this->errno_; } void error (int i) { this->errno_ = i; } @@ -36,7 +51,7 @@ public: #if defined (ACE_HAS_THREADS) static ACE_Thread_Mutex * - allocate_lock () + allocate_lock (void) { ACE_NEW_RETURN (Errno::lock_, ACE_Thread_Mutex, 0); return Errno::lock_; diff --git a/tests/Thread_Pool_Test.cpp b/tests/Thread_Pool_Test.cpp index b840cbe28bd..631d2c05df6 100644 --- a/tests/Thread_Pool_Test.cpp +++ b/tests/Thread_Pool_Test.cpp @@ -203,9 +203,8 @@ Thread_Pool::open (void *) &this->lock_adapter_), -1); - int i; // We need to define 'i' here to keep EGCS from complaining... - - for (i = this->thr_count (); i > 0; i--) + int i = this->thr_count (); + while (i > 0) { ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%t) EOF, enqueueing NULL block for thread = %d\n"), @@ -220,6 +219,7 @@ Thread_Pool::open (void *) ACE_ERROR ((LM_ERROR, ASYS_TEXT (" (%t) %p\n"), ASYS_TEXT ("put"))); + i--; } mb->release (); |