From 8a0c00861bffa7450a5f0e85c0610c3278f66945 Mon Sep 17 00:00:00 2001 From: schmidt Date: Sun, 17 Nov 1996 19:55:21 +0000 Subject: Jammer! --- tests/Barrier_Test.cpp | 2 +- tests/Buffer_Stream_Test.cpp | 2 +- tests/CPP_Test.cpp | 6 +++--- tests/Future_Test.cpp | 2 +- tests/Handle_Set_Test.cpp | 2 +- tests/Map_Manager_Test.cpp | 25 +++++++++++++++++++++++-- tests/Mem_Map_Test.cpp | 2 +- tests/Message_Queue_Test.cpp | 25 +++++++++++++++++++++++-- tests/Mutex_Test.cpp | 2 +- tests/Naming_Test.cpp | 2 +- tests/Priority_Buffer_Test.cpp | 13 ++++++------- tests/Reactor_Timer_Test.cpp | 3 +-- tests/Reactors_Test.cpp | 2 +- tests/Reader_Writer_Test.cpp | 29 +++++++++++++---------------- tests/Recursive_Mutex_Test.cpp | 2 +- tests/SPIPE_Test.cpp | 6 +++--- tests/SString_Test.cpp | 2 +- tests/SV_Shared_Memory_Test.cpp | 4 +++- tests/Shared_Memory_MM_Test.cpp | 4 ++-- tests/Shared_Memory_SV_Test.cpp | 4 +++- tests/TSS_Test.cpp | 2 +- tests/Task_Test.cpp | 2 +- tests/Thread_Manager_Test.cpp | 2 +- tests/Thread_Pool_Test.cpp | 2 +- tests/Time_Service_Test.cpp | 11 ++++++----- tests/Time_Value_Test.cpp | 2 +- tests/Timer_Queue_Test.cpp | 2 +- tests/Tokens_Test.cpp | 3 +-- tests/UPIPE_SAP_Test.cpp | 27 +++++++++++++-------------- tests/test_config.h | 11 ++++++----- 30 files changed, 122 insertions(+), 81 deletions(-) (limited to 'tests') diff --git a/tests/Barrier_Test.cpp b/tests/Barrier_Test.cpp index c08e49f20b1..958411d29cf 100644 --- a/tests/Barrier_Test.cpp +++ b/tests/Barrier_Test.cpp @@ -66,7 +66,7 @@ tester (Tester_Args *args) int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Barrier_Test.cpp"); ACE_Service_Config daemon (argv[0]); diff --git a/tests/Buffer_Stream_Test.cpp b/tests/Buffer_Stream_Test.cpp index d1757c0c423..efa87d3e9f3 100644 --- a/tests/Buffer_Stream_Test.cpp +++ b/tests/Buffer_Stream_Test.cpp @@ -197,7 +197,7 @@ Consumer::svc (void) int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Buffer_Stream_Test.cpp"); ACE_Service_Config daemon (argv[0]); diff --git a/tests/CPP_Test.cpp b/tests/CPP_Test.cpp index b12d696c861..79d9c112f03 100644 --- a/tests/CPP_Test.cpp +++ b/tests/CPP_Test.cpp @@ -219,8 +219,8 @@ server (void *) return 0; } -void -spawn () +static void +spawn (void) { #if !defined (ACE_WIN32) switch (ACE_OS::fork ()) @@ -252,7 +252,7 @@ spawn () int main (int, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("CPP_Test.cpp"); ACE_DEBUG ((LM_DEBUG, "starting %s test at %u\n", argv[0], ACE_OS::time (0))); spawn (); diff --git a/tests/Future_Test.cpp b/tests/Future_Test.cpp index e09c7dbe4ac..878154fe35b 100644 --- a/tests/Future_Test.cpp +++ b/tests/Future_Test.cpp @@ -308,7 +308,7 @@ static int n_loops = 100; int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Future_Test.cpp"); Scheduler *andres, *peter, *helmut, *matias; diff --git a/tests/Handle_Set_Test.cpp b/tests/Handle_Set_Test.cpp index d41dec7d947..7232fa85ebf 100644 --- a/tests/Handle_Set_Test.cpp +++ b/tests/Handle_Set_Test.cpp @@ -67,7 +67,7 @@ run_test (int count) int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Handle_Set_Test.cpp"); int count = argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_Handle_Set::MAXSIZE; run_test (count); diff --git a/tests/Map_Manager_Test.cpp b/tests/Map_Manager_Test.cpp index 417fa20771c..d58b6b7d6c0 100644 --- a/tests/Map_Manager_Test.cpp +++ b/tests/Map_Manager_Test.cpp @@ -1,6 +1,24 @@ +// ============================================================================ +// $Id$ + +// +// = LIBRARY +// tests +// +// = FILENAME +// Map_Manager_Test.cpp +// +// = DESCRIPTION +// This is a simple test of the ACE_Map_Manager that +// illustrates how to use the forward and reverse iterators. +// +// = AUTHOR +// Irfan Pyarali +// +// ============================================================================ + #include "ace/Map_Manager.h" #include "ace/Synch.h" -#include typedef ACE_Null_Mutex MUTEX; typedef int KEY; @@ -12,8 +30,10 @@ typedef ACE_Map_Reverse_Iterator REVERSE_ITERATOR; typedef ACE_Map_Entry ENTRY; int -main () +main (int argc, char *argv[]) { + ACE_START_TEST ("Map_Manager_Test.cpp"); + const int ITERATIONS = 5; MAP_MANAGER map; @@ -67,5 +87,6 @@ main () } } + ACE_END_TEST; return 0; } diff --git a/tests/Mem_Map_Test.cpp b/tests/Mem_Map_Test.cpp index 387f3e3da63..1a414e5a986 100644 --- a/tests/Mem_Map_Test.cpp +++ b/tests/Mem_Map_Test.cpp @@ -87,7 +87,7 @@ create_test_file () int main (int, char **argv) { - ACE_START_TEST; + ACE_START_TEST ("Mem_Map_Test.cpp"); ACE_LOG_MSG->open (argv[0]); diff --git a/tests/Message_Queue_Test.cpp b/tests/Message_Queue_Test.cpp index 6a57250e3ee..a73784125d3 100644 --- a/tests/Message_Queue_Test.cpp +++ b/tests/Message_Queue_Test.cpp @@ -1,14 +1,34 @@ +// ============================================================================ +// $Id$ + +// +// = LIBRARY +// tests +// +// = FILENAME +// Message_Queue_Test.cpp +// +// = DESCRIPTION +// This is a simple test of the ACE_Message_Queue that +// illustrates how to use the forward and reverse iterators. +// +// = AUTHOR +// Irfan Pyarali +// +// ============================================================================ + #include "ace/Message_Queue.h" #include "ace/Synch.h" -#include typedef ACE_Message_Queue QUEUE; typedef ACE_Message_Queue_Iterator ITERATOR; typedef ACE_Message_Queue_Reverse_Iterator REVERSE_ITERATOR; int -main () +main (int argc, char *argv[]) { + ACE_START_TEST ("Message_Queue_Test.cpp"); + const int ITERATIONS = 5; QUEUE queue; @@ -65,5 +85,6 @@ main () } } + ACE_END_TEST; return 0; } diff --git a/tests/Mutex_Test.cpp b/tests/Mutex_Test.cpp index d37083023a4..a8fbc3a966e 100644 --- a/tests/Mutex_Test.cpp +++ b/tests/Mutex_Test.cpp @@ -25,7 +25,7 @@ int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Mutex_Test.cpp"); char *name = argc == 1 ? "hello" : argv[1]; diff --git a/tests/Naming_Test.cpp b/tests/Naming_Test.cpp index ebc2a043ba1..414c9c1f338 100644 --- a/tests/Naming_Test.cpp +++ b/tests/Naming_Test.cpp @@ -115,7 +115,7 @@ find (ACE_Naming_Context *ns_context, int sign, int result) int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Naming_Test.cpp"); ACE_Naming_Context *ns_context = new ACE_Naming_Context (); ACE_Name_Options *name_options = ns_context->name_options (); diff --git a/tests/Priority_Buffer_Test.cpp b/tests/Priority_Buffer_Test.cpp index 1b436414603..cf0804d8713 100644 --- a/tests/Priority_Buffer_Test.cpp +++ b/tests/Priority_Buffer_Test.cpp @@ -21,14 +21,12 @@ #include "ace/Log_Msg.h" #include "ace/Message_Queue.h" -#include "ace/Thread_Manager.h" #include "ace/Service_Config.h" #include "test_config.h" #if defined (ACE_HAS_THREADS) // Global thread manager. -static ACE_Thread_Manager thr_mgr; static int count = 0; // Make the queue be capable of being *very* large. @@ -87,7 +85,7 @@ static void * producer (ACE_Message_Queue *msg_queue) { // Insert thread into thr_mgr. - ACE_Thread_Control thread_control (&thr_mgr); + ACE_Thread_Control thread_control (ACE_Service_Config::thr_mgr ()); ACE_NEW_THREAD; ACE_Message_Block *mb = 0; @@ -133,17 +131,18 @@ producer (ACE_Message_Queue *msg_queue) int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Priority_Buffer_Test.cpp"); // Message queue. ACE_Message_Queue msg_queue (max_queue); - if (thr_mgr.spawn (ACE_THR_FUNC (producer), (void *) &msg_queue, - THR_NEW_LWP | THR_DETACHED) == -1) + if (ACE_Service_Config::thr_mgr ()->spawn (ACE_THR_FUNC (producer), + (void *) &msg_queue, + THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn"), 1); // Wait for producer and consumer threads to exit. - thr_mgr.wait (); + ACE_Service_Config::thr_mgr ()->wait (); ACE_END_TEST; return 0; diff --git a/tests/Reactor_Timer_Test.cpp b/tests/Reactor_Timer_Test.cpp index fe2a1aff668..d24c2acb0e6 100644 --- a/tests/Reactor_Timer_Test.cpp +++ b/tests/Reactor_Timer_Test.cpp @@ -52,7 +52,7 @@ public: int main (int, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Reactor_Timer_Test.cpp"); ACE_Reactor reactor; @@ -64,7 +64,6 @@ main (int, char *argv[]) t_id[i] = reactor.schedule_timer (&rt[i], (const void *) i, ACE_Time_Value (2 * i + 1)); - while (!done) reactor.handle_events (); diff --git a/tests/Reactors_Test.cpp b/tests/Reactors_Test.cpp index 4c171ebd71b..937d3f28a5f 100644 --- a/tests/Reactors_Test.cpp +++ b/tests/Reactors_Test.cpp @@ -174,7 +174,7 @@ worker (void *args) int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Reactors_Test.cpp"); ACE_Reactor *react1 = ACE_Service_Config::reactor (); ACE_Reactor *react2 = new ACE_Reactor (); diff --git a/tests/Reader_Writer_Test.cpp b/tests/Reader_Writer_Test.cpp index 160eba6de87..dda0841511c 100644 --- a/tests/Reader_Writer_Test.cpp +++ b/tests/Reader_Writer_Test.cpp @@ -21,7 +21,7 @@ #include "ace/Log_Msg.h" #include "ace/Synch.h" #include "ace/Thread.h" -#include "ace/Thread_Manager.h" +#include "ace/Service_Config.h" #include "ace/Get_Opt.h" #include "test_config.h" @@ -48,9 +48,6 @@ static ACE_RW_Mutex rw_mutex; // Count of the number of readers and writers. ACE_Atomic_Op current_readers, current_writers; -// Thread manager -static ACE_Thread_Manager thr_mgr; - // Explain usage and exit. static void print_usage_and_die (void) @@ -95,7 +92,7 @@ parse_args (int argc, char *argv[]) static void * reader (void *) { - ACE_Thread_Control tc (&thr_mgr); + ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); ACE_NEW_THREAD; ACE_DEBUG ((LM_DEBUG, "(%t) reader starting\n")); @@ -134,7 +131,7 @@ reader (void *) static void * writer (void *) { - ACE_Thread_Control tc (&thr_mgr); + ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); ACE_NEW_THREAD; ACE_DEBUG ((LM_DEBUG, "(%t) writer starting\n")); @@ -174,7 +171,7 @@ writer (void *) int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Reader_Writer_Test.cpp"); ACE_LOG_MSG->open (argv[0]); @@ -183,18 +180,18 @@ int main (int argc, char *argv[]) ACE_DEBUG ((LM_DEBUG, "(%t) main thread starting\n")); - if (thr_mgr.spawn_n (n_readers, - ACE_THR_FUNC (reader), - 0, - THR_NEW_LWP) == -1) + if (ACE_Service_Config::thr_mgr ()->spawn_n (n_readers, + ACE_THR_FUNC (reader), + 0, + THR_NEW_LWP) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn_n"), 1); - else if (thr_mgr.spawn_n (n_writers, - ACE_THR_FUNC (writer), - 0, - THR_NEW_LWP) == -1) + else if (ACE_Service_Config::thr_mgr ()->spawn_n (n_writers, + ACE_THR_FUNC (writer), + 0, + THR_NEW_LWP) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn_n"), 1); - thr_mgr.wait (); + ACE_Service_Config::thr_mgr ()->wait (); ACE_DEBUG ((LM_DEBUG, "(%t) exiting main thread\n")); ACE_END_TEST; diff --git a/tests/Recursive_Mutex_Test.cpp b/tests/Recursive_Mutex_Test.cpp index f19d8252210..3ae7bafb8d2 100644 --- a/tests/Recursive_Mutex_Test.cpp +++ b/tests/Recursive_Mutex_Test.cpp @@ -64,7 +64,7 @@ worker (void *arg) int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Recursive_Mutex_Test.cpp"); ACE_Service_Config daemon (argv[0]); ACE_Recursive_Thread_Mutex rm; diff --git a/tests/SPIPE_Test.cpp b/tests/SPIPE_Test.cpp index ef7fb564f67..2e8960ce829 100644 --- a/tests/SPIPE_Test.cpp +++ b/tests/SPIPE_Test.cpp @@ -103,8 +103,8 @@ server (void *) return 0; } -void -spawn () +static void +spawn (void) { #if !defined (ACE_WIN32) switch (ACE_OS::fork ()) @@ -136,7 +136,7 @@ spawn () int main (int, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("SPIPE_Test.cpp"); spawn (); diff --git a/tests/SString_Test.cpp b/tests/SString_Test.cpp index 4285d4fa90e..680eed95da6 100644 --- a/tests/SString_Test.cpp +++ b/tests/SString_Test.cpp @@ -24,7 +24,7 @@ int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("SString_Test.cpp"); ACE_CString s1 ("hello"); ACE_CString s2 ("world"); diff --git a/tests/SV_Shared_Memory_Test.cpp b/tests/SV_Shared_Memory_Test.cpp index 22eae95df7b..8baa4fe414a 100644 --- a/tests/SV_Shared_Memory_Test.cpp +++ b/tests/SV_Shared_Memory_Test.cpp @@ -69,7 +69,8 @@ server (void) int main (int, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("SV_Shared_Memory_Test.cpp"); + switch (ACE_OS::fork ()) { case -1: @@ -80,6 +81,7 @@ main (int, char *argv[]) default: server (); } + ACE_END_TEST; return 0; } diff --git a/tests/Shared_Memory_MM_Test.cpp b/tests/Shared_Memory_MM_Test.cpp index 9634e421a5c..3752fdd76dc 100644 --- a/tests/Shared_Memory_MM_Test.cpp +++ b/tests/Shared_Memory_MM_Test.cpp @@ -89,7 +89,7 @@ server (void *) return 0; } -void +static void spawn () { #if !defined (ACE_WIN32) @@ -122,7 +122,7 @@ spawn () int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Shared_Memory_MM_Test.cpp"); if (ACE_OS::mktemp (shm_key) == 0 || (ACE_OS::unlink (shm_key) == -1 && errno == EPERM)) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", shm_key), 1); diff --git a/tests/Shared_Memory_SV_Test.cpp b/tests/Shared_Memory_SV_Test.cpp index 5a481484e8e..72bc2d6f8af 100644 --- a/tests/Shared_Memory_SV_Test.cpp +++ b/tests/Shared_Memory_SV_Test.cpp @@ -62,7 +62,8 @@ server (void) int main (int argc, char *argv []) { - ACE_START_TEST; + ACE_START_TEST ("Shared_Memory_SV_Test.cpp"); + switch (ACE_OS::fork ()) { case -1: @@ -75,6 +76,7 @@ main (int argc, char *argv []) server (); break; } + ACE_END_TEST; return 0; } diff --git a/tests/TSS_Test.cpp b/tests/TSS_Test.cpp index 37a6d1428c0..966b4e45024 100644 --- a/tests/TSS_Test.cpp +++ b/tests/TSS_Test.cpp @@ -190,7 +190,7 @@ handler (int signum) int main (int, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("TSS_Test.cpp"); ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT); diff --git a/tests/Task_Test.cpp b/tests/Task_Test.cpp index d52eac6bba2..32b21e09082 100644 --- a/tests/Task_Test.cpp +++ b/tests/Task_Test.cpp @@ -92,7 +92,7 @@ Barrier_Task::svc (void) int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Task_Test.cpp"); int n_threads = ACE_MAX_THREADS; int n_iterations = ACE_MAX_ITERATIONS; diff --git a/tests/Thread_Manager_Test.cpp b/tests/Thread_Manager_Test.cpp index b49e3b85c6c..48c163efd0a 100644 --- a/tests/Thread_Manager_Test.cpp +++ b/tests/Thread_Manager_Test.cpp @@ -63,7 +63,7 @@ static const int DEFAULT_ITERATIONS = 100000; int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Thread_Manager_Test.cpp"); ACE_Service_Config daemon; diff --git a/tests/Thread_Pool_Test.cpp b/tests/Thread_Pool_Test.cpp index 00041e69701..764871ee15b 100644 --- a/tests/Thread_Pool_Test.cpp +++ b/tests/Thread_Pool_Test.cpp @@ -189,7 +189,7 @@ produce (Thread_Pool &thread_pool) int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Thread_Pool_Test.cpp"); int n_threads = ACE_MAX_THREADS; ACE_DEBUG ((LM_DEBUG, "(%t) argc = %d, threads = %d\n", diff --git a/tests/Time_Service_Test.cpp b/tests/Time_Service_Test.cpp index 5f54f9401f8..2121106433a 100644 --- a/tests/Time_Service_Test.cpp +++ b/tests/Time_Service_Test.cpp @@ -29,7 +29,7 @@ int main (int, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Time_Service_Test.cpp"); char app[BUFSIZ]; char server_conf[BUFSIZ]; @@ -48,6 +48,7 @@ main (int, char *argv[]) s_argv[3] = 0; ACE_Process server; + if (server.start (s_argv) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p.\n", "Server fork failed"), 0); else @@ -57,8 +58,9 @@ main (int, char *argv[]) s_argv[2] = clerk_conf; ACE_Process clerk; + if (clerk.start (s_argv) == -1) - ACE_ERROR_RETURN ((LM_DEBUG, "%p.\n", "Server fork failed"), 0); + ACE_ERROR_RETURN ((LM_DEBUG, "%p.\n", "Clerk fork failed"), 0); else ACE_DEBUG ((LM_DEBUG, "Server forked with pid = %d.\n", clerk.getpid ())); @@ -66,12 +68,11 @@ main (int, char *argv[]) ACE_OS::sleep (10); if (clerk.kill () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "Kill failed.\n"), -1); + ACE_ERROR_RETURN ((LM_ERROR, "Kill failed for clerk.\n"), -1); if (server.kill () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "Kill failed.\n"), -1); + ACE_ERROR_RETURN ((LM_ERROR, "Kill failed for server.\n"), -1); ACE_END_TEST; - return 0; } diff --git a/tests/Time_Value_Test.cpp b/tests/Time_Value_Test.cpp index 7ee034e7c5d..4278ccf97d0 100644 --- a/tests/Time_Value_Test.cpp +++ b/tests/Time_Value_Test.cpp @@ -24,7 +24,7 @@ int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Time_Value_Test.cpp"); ACE_Time_Value tv1; ACE_Time_Value tv2 (2); diff --git a/tests/Timer_Queue_Test.cpp b/tests/Timer_Queue_Test.cpp index 956e4f38faa..820dad37475 100644 --- a/tests/Timer_Queue_Test.cpp +++ b/tests/Timer_Queue_Test.cpp @@ -37,7 +37,7 @@ public: int main (int, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("Timer_Queue_Test.cpp"); ACE_Timer_Queue tq; Example_Handler eh; diff --git a/tests/Tokens_Test.cpp b/tests/Tokens_Test.cpp index 341f84dc7f0..5690a39f872 100644 --- a/tests/Tokens_Test.cpp +++ b/tests/Tokens_Test.cpp @@ -182,8 +182,7 @@ run_test (ACE_Token_Proxy *A, int main (int argc, char* argv[]) { - ACE_DEBUG ((LM_DEBUG, "%s starting.\n", argv[0])); - ACE_START_TEST; + ACE_START_TEST ("Tokens_Test.cpp"); ACE_Token_Proxy *A, *B, *R, *W; A = new ACE_Local_Mutex ("L Mutex A", 0, 0); diff --git a/tests/UPIPE_SAP_Test.cpp b/tests/UPIPE_SAP_Test.cpp index b93cea88c96..7934c31e26c 100644 --- a/tests/UPIPE_SAP_Test.cpp +++ b/tests/UPIPE_SAP_Test.cpp @@ -21,13 +21,11 @@ #include "ace/Stream.h" #include "ace/UPIPE_Acceptor.h" #include "ace/UPIPE_Connector.h" +#include "ace/Service_Config.h" #include "test_config.h" #if defined (ACE_HAS_THREADS) -// Global thread manager. -static ACE_Thread_Manager thr_mgr; - // Global pattern static ACE_UPIPE_Addr addr ("pattern"); @@ -37,7 +35,7 @@ static void * peer1 (void *) { // Insert thread into thr_mgr. - ACE_Thread_Control thread_control (&thr_mgr); + ACE_Thread_Control thread_control (ACE_Service_Config::thr_mgr ()); ACE_NEW_THREAD; ACE_UPIPE_Stream c_stream; @@ -84,8 +82,8 @@ peer1 (void *) } conbuf[i] = '\0'; - ACE_ASSERT (ACE_OS::strcmp (conbuf, "this is the peer2 response!") - == 0); + ACE_DEBUG ((LM_DEBUG, "(%t) conbuf = %s", conbuf)); + ACE_ASSERT (ACE_OS::strcmp (conbuf, "this is the peer2 response!") == 0); c_stream.close (); return 0; } @@ -94,15 +92,16 @@ static void * peer2 (void *) { // Insert thread into thr_mgr. - ACE_Thread_Control thread_control (&thr_mgr); + ACE_Thread_Control thread_control (ACE_Service_Config::thr_mgr ()); ACE_NEW_THREAD; ACE_UPIPE_Acceptor acc (addr); ACE_UPIPE_Stream s_stream; // Spawn a peer1 thread. - if (thr_mgr.spawn (ACE_THR_FUNC (peer1), (void *) 0, - THR_NEW_LWP | THR_DETACHED) == -1) + if (ACE_Service_Config::thr_mgr ()->spawn (ACE_THR_FUNC (peer1), + (void *) 0, + THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn"), 0); ACE_DEBUG ((LM_DEBUG, "(%t) peer2 starting accept\n")); @@ -145,18 +144,18 @@ peer2 (void *) int main (int argc, char *argv[]) { - ACE_START_TEST; + ACE_START_TEST ("UPIPE_SAP_Test.cpp"); // Spawn a peer2 thread. - if (thr_mgr.spawn (ACE_THR_FUNC (peer2), (void *) 0, - THR_NEW_LWP | THR_DETACHED) == -1) + if (ACE_Service_Config::thr_mgr ()->spawn (ACE_THR_FUNC (peer2), + (void *) 0, + THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn"), 1); // Wait for peer2 and peer1 threads to exit. - thr_mgr.wait (); + ACE_Service_Config::thr_mgr ()->wait (); ACE_END_TEST; - return 0; } #else diff --git a/tests/test_config.h b/tests/test_config.h index 44d11017577..44e99d56bd2 100644 --- a/tests/test_config.h +++ b/tests/test_config.h @@ -47,7 +47,7 @@ public: delete this->output_file_; } - int set_output (char *filename) + int set_output (const char *filename) { char temp[BUFSIZ]; // Ignore the error value since the directory may already exist. @@ -81,13 +81,14 @@ private: static ACE_Test_Output ace_file_stream; -#define ACE_START_TEST \ - if (ace_file_stream.set_output (argv[0]) == -1) \ +#define ACE_START_TEST(NAME) \ + const char *program = argv ? argv[0] : NAME; \ + if (ace_file_stream.set_output (program) == -1) \ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "set_output failed"), -1); \ - ACE_DEBUG ((LM_DEBUG, "starting %s test at %T\n", argv[0])); + ACE_DEBUG ((LM_DEBUG, "starting %s test at %T\n", program)); #define ACE_END_TEST \ - ACE_DEBUG ((LM_DEBUG, "Ending %s test at %T\n", argv[0])); \ + ACE_DEBUG ((LM_DEBUG, "Ending %s test at %T\n", program)); \ ace_file_stream.flush (); #define ACE_NEW_THREAD \ -- cgit v1.2.1