diff options
Diffstat (limited to 'tests/Process_Strategy_Test.cpp')
-rw-r--r-- | tests/Process_Strategy_Test.cpp | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/tests/Process_Strategy_Test.cpp b/tests/Process_Strategy_Test.cpp index c60e343395c..6c7e52b43e8 100644 --- a/tests/Process_Strategy_Test.cpp +++ b/tests/Process_Strategy_Test.cpp @@ -135,7 +135,7 @@ Options::concurrency_strategy (void) return this->concurrency_strategy_; } -const char * +const ASYS_TCHAR * Options::filename (void) { return this->filename_; @@ -161,32 +161,32 @@ Options::~Options (void) } int -Options::parse_args (int argc, char *argv[]) +Options::parse_args (int argc, ASYS_TCHAR *argv[]) { - ACE_Get_Opt get_opt (argc, argv, "p:c:f:"); + ACE_Get_Opt get_opt (argc, argv, ASYS_TEXT ("p:c:f:")); - this->filename_ = ACE_TEMP_FILE_NAME_A; + this->filename_ = ASYS_TEXT (ACE_TEMP_FILE_NAME_A); for (int c; (c = get_opt ()) != -1; ) switch (c) { case 'c': if (ACE_OS::strcmp (get_opt.optarg, - "REACTIVE") == 0) + ASYS_TEXT ("REACTIVE")) == 0) OPTIONS::instance ()->concurrency_type (Options::REACTIVE); #if !defined (ACE_LACKS_FORK) else if (ACE_OS::strcmp (get_opt.optarg, - "PROCESS") == 0) + ASYS_TEXT ("PROCESS")) == 0) OPTIONS::instance ()->concurrency_type (Options::PROCESS); #endif /* !ACE_LACKS_FORK */ #if defined (ACE_HAS_THREADS) else if (ACE_OS::strcmp (get_opt.optarg, - "THREAD") == 0) + ASYS_TEXT ("THREAD")) == 0) OPTIONS::instance ()->concurrency_type (Options::THREAD); #endif /* ACE_HAS_THREADS */ else ACE_DEBUG ((LM_DEBUG, - "WARNING: concurrency strategy \"%s\" is not supported\n", + ASYS_TEXT ("WARNING: concurrency strategy \"%s\" is not supported\n"), get_opt.optarg)); break; case 'f': @@ -194,22 +194,22 @@ Options::parse_args (int argc, char *argv[]) break; default: ACE_DEBUG ((LM_DEBUG, - "usage: %n [-f (filename)] [-c (concurrency strategy)]\n%a", 1)); + ASYS_TEXT ("usage: %n [-f (filename)] [-c (concurrency strategy)]\n%a"), 1)); /* NOTREACHED */ } // Initialize the file lock. Note that this object lives beyond the // lifetime of the Acceptor. - if (this->file_lock_.open (ACE_WIDE_STRING (this->filename_), + if (this->file_lock_.open (ASYS_ONLY_WIDE_STRING (this->filename_), O_RDWR | O_CREAT, ACE_DEFAULT_FILE_PERMS) == -1) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "open"), + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("open")), -1); ACE_DEBUG ((LM_DEBUG, - "(%P|%t) opening %s on handle %d.\n", + ASYS_TEXT ("(%P|%t) opening %s on handle %d.\n"), this->filename_, this->file_lock_.get_handle ())); @@ -220,8 +220,8 @@ Options::parse_args (int argc, char *argv[]) (const void *) &count, sizeof count) != sizeof count) ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "write")); + ASYS_TEXT ("(%P|%t) %p\n"), + ASYS_TEXT ("write"))); // Initialize the Concurrency strategy. switch (this->concurrency_type_) @@ -283,7 +283,7 @@ Options::concurrency_type (Options::Concurrency_Type cs) Counting_Service::Counting_Service (ACE_Thread_Manager *) { ACE_DEBUG ((LM_DEBUG, - "(%P|%t) creating the Counting_Service\n")); + ASYS_TEXT ("(%P|%t) creating the Counting_Service\n"))); } // Read the current value from the shared file and return it to the @@ -295,7 +295,7 @@ Counting_Service::read (void) ACE_READ_GUARD_RETURN (ACE_File_Lock, ace_mon, OPTIONS::instance ()->file_lock (), -1); ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reading on handle %d.\n", + ASYS_TEXT ("(%P|%t) reading on handle %d.\n"), OPTIONS::instance ()->file_lock ().get_handle ())); int count; @@ -304,8 +304,8 @@ Counting_Service::read (void) sizeof count, 0) != sizeof count) ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) %p\n", - "read"), + ASYS_TEXT ("(%P|%t) %p\n"), + ASYS_TEXT ("read")), -1); char buf[BUFSIZ]; @@ -313,13 +313,13 @@ Counting_Service::read (void) "count = %d\n", count); ACE_DEBUG ((LM_DEBUG, - "(%P|%t) count = %d\n", + ASYS_TEXT ("(%P|%t) count = %d\n"), count)); if (this->peer ().send_n (buf, n) != n) ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) %p\n", - "send_n"), + ASYS_TEXT ("(%P|%t) %p\n"), + ASYS_TEXT ("send_n")), -1); return 0; } @@ -332,7 +332,7 @@ Counting_Service::inc (void) ACE_WRITE_GUARD_RETURN (ACE_File_Lock, ace_mon, OPTIONS::instance ()->file_lock (), -1); ACE_DEBUG ((LM_DEBUG, - "(%P|%t) incrementing on handle %d.\n", + ASYS_TEXT ("(%P|%t) incrementing on handle %d.\n"), OPTIONS::instance ()->file_lock ().get_handle ())); int count; @@ -341,12 +341,12 @@ Counting_Service::inc (void) sizeof count, 0) != sizeof count) ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) %p\n", - "read"), + ASYS_TEXT ("(%P|%t) %p\n"), + ASYS_TEXT ("read")), -1); ACE_DEBUG ((LM_DEBUG, - "(%P|%t) incrementing count from %d to %d\n", + ASYS_TEXT ("(%P|%t) incrementing count from %d to %d\n"), count, count + 1)); count++; @@ -356,8 +356,8 @@ Counting_Service::inc (void) sizeof count, 0) != sizeof count) ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) %p\n", - "write"), + ASYS_TEXT ("(%P|%t) %p\n"), + ASYS_TEXT ("write")), -1); return 0; } @@ -371,7 +371,7 @@ Counting_Service::handle_input (ACE_HANDLE) char buf[BUFSIZ]; ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reading from peer on %d\n", + ASYS_TEXT ("(%P|%t) reading from peer on %d\n"), this->peer ().get_handle ())); size_t len; @@ -389,7 +389,7 @@ Counting_Service::handle_input (ACE_HANDLE) else { ACE_DEBUG ((LM_DEBUG, - "(%P|%t) %d bytes of input on %d is %*s\n", + ASYS_TEXT ("(%P|%t) %d bytes of input on %d is %*s\n"), bytes, this->peer ().get_handle (), bytes, @@ -405,7 +405,7 @@ Counting_Service::handle_input (ACE_HANDLE) return this->inc (); else ACE_DEBUG ((LM_DEBUG, - "(%P|%t) no match...\n")); + ASYS_TEXT ("(%P|%t) no match...\n"))); return 0; } } @@ -414,7 +414,7 @@ int Counting_Service::svc (void) { ACE_DEBUG ((LM_DEBUG, - "(%P|%t) handling thread\n")); + ASYS_TEXT ("(%P|%t) handling thread\n"))); while (this->handle_input () >= 0) continue; @@ -440,7 +440,7 @@ int Counting_Service::open (void *) { ACE_DEBUG ((LM_DEBUG, - "(%P|%t) opening service\n")); + ASYS_TEXT ("(%P|%t) opening service\n"))); if (OPTIONS::instance ()->concurrency_type () == Options::PROCESS) { @@ -451,7 +451,7 @@ Counting_Service::open (void *) continue; ACE_DEBUG ((LM_DEBUG, - "(%P|%t) About to exit from the child\n")); + ASYS_TEXT ("(%P|%t) About to exit from the child\n"))); // Exit the child. ACE_OS::exit (0); @@ -482,12 +482,12 @@ client (void *arg) for (i = 0; i < ACE_MAX_ITERATIONS; i++) { ACE_DEBUG ((LM_DEBUG, - "(%P|%t) client iteration %d\n", + ASYS_TEXT ("(%P|%t) client iteration %d\n"), i)); if (connector.connect (stream, server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "open"), + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("open")), 0); command = "inc"; command_len = ACE_OS::strlen (command); @@ -496,8 +496,8 @@ client (void *arg) &command_len, sizeof command_len, command, command_len) == -1) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "send"), + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("send")), 0); command = "read"; command_len = ACE_OS::strlen (command); @@ -506,23 +506,23 @@ client (void *arg) &command_len, sizeof command_len, command, command_len) == -1) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "send"), + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("send")), 0); else if (stream.recv (buf, sizeof buf) <= 0) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "recv"), + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("recv")), 0); // ACE_DEBUG ((LM_DEBUG, - // "(%P|%t) client iteration %d, buf = %s\n", + // ASYS_TEXT ("(%P|%t) client iteration %d, buf = %s\n"), // i, buf)); if (stream.close () == -1) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "close"), + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("close")), 0); } @@ -532,20 +532,20 @@ client (void *arg) if (connector.connect (stream, server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "open"), + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("open")), 0); else if (stream.send (4, &command_len, sizeof command_len, command, command_len) == -1) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "send"), + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("send")), 0); else if ((bytes_read = stream.recv (buf, sizeof buf)) <= 0) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "recv"), + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("recv")), 0); else { @@ -556,7 +556,7 @@ client (void *arg) size_t count = ACE_OS::atoi (ACE_OS::strrchr (buf, ' ')); ACE_DEBUG ((LM_DEBUG, - "(%P|%t) count = %d\n", + ASYS_TEXT ("(%P|%t) count = %d\n"), count)); // Make sure that the count is correct. ACE_ASSERT (count == ACE_MAX_ITERATIONS); @@ -564,8 +564,8 @@ client (void *arg) if (stream.close () == -1) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "close"), + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("close")), 0); // Remove the filename. @@ -590,14 +590,14 @@ server (void *) } int -main (int argc, char *argv[]) +main (int argc, ASYS_TCHAR *argv[]) { - ACE_START_TEST ("Process_Strategy_Test"); + ACE_START_TEST (ASYS_TEXT ("Process_Strategy_Test")); if (OPTIONS::instance ()->parse_args (argc, argv) == -1) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "parse_args"), + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("parse_args")), -1); ACCEPTOR acceptor; @@ -613,13 +613,13 @@ main (int argc, char *argv[]) OPTIONS::instance ()->concurrency_strategy ()) == -1 || acceptor.acceptor ().get_local_addr (server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "open"), + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("open")), -1); else { ACE_DEBUG ((LM_DEBUG, - "(%P|%t) starting server at port %d\n", + ASYS_TEXT ("(%P|%t) starting server at port %d\n"), server_addr.get_port_number ())); #if !defined (ACE_LACKS_FORK) @@ -631,8 +631,8 @@ main (int argc, char *argv[]) { case -1: ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n%a", - "fork failed")); + ASYS_TEXT ("(%P|%t) %p\n%a"), + ASYS_TEXT ("fork failed"))); exit (-1); /* NOTREACHED */ case 0: @@ -650,22 +650,22 @@ main (int argc, char *argv[]) (void *) 0, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n%a", - "thread create failed")); + ASYS_TEXT ("(%P|%t) %p\n%a"), + ASYS_TEXT ("thread create failed"))); if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client), (void *) &server_addr, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n%a", - "thread create failed")); + ASYS_TEXT ("(%P|%t) %p\n%a"), + ASYS_TEXT ("thread create failed"))); // Wait for the threads to exit. ACE_Thread_Manager::instance ()->wait (); #else ACE_ERROR ((LM_ERROR, - "(%P|%t) only one thread may be run in a process on this platform\n%a", + ASYS_TEXT ("(%P|%t) only one thread may be run in a process on this platform\n%a"), 1)); #endif /* ACE_HAS_THREADS */ } |