diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-03-10 15:17:18 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-03-10 15:17:18 +0000 |
commit | 42494f90fc2d04cc79cbf2a5b98b4f9cfab35e76 (patch) | |
tree | 33f00494ebb630d40bab7b9cbc280efe91b48e71 | |
parent | 7a7f53bb100a8d406b78ebdc24a48b798cee78e4 (diff) | |
download | ATCD-42494f90fc2d04cc79cbf2a5b98b4f9cfab35e76.tar.gz |
ChangeLogTag:Sat Mar 10 07:05:16 2001 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
-rw-r--r-- | tests/Log_Msg_Test.cpp | 2 | ||||
-rw-r--r-- | tests/Logging_Strategy_Test.cpp | 52 | ||||
-rw-r--r-- | tests/Mem_Map_Test.cpp | 53 | ||||
-rw-r--r-- | tests/Time_Service_Test.cpp | 2 |
4 files changed, 73 insertions, 36 deletions
diff --git a/tests/Log_Msg_Test.cpp b/tests/Log_Msg_Test.cpp index 6e74f6373cd..343b5159dc8 100644 --- a/tests/Log_Msg_Test.cpp +++ b/tests/Log_Msg_Test.cpp @@ -386,7 +386,7 @@ test_ostream (void) // Set the ostream back to NULL to prevent "later functions using myostream". ACE_LOG_MSG->msg_ostream (ace_file_stream::instance ()->output_file ()); ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("Read %d bytes, rather than expected %d bytes\n",) + ACE_TEXT ("Read %d bytes, rather than expected %d bytes\n"), size, info.size_), -1); diff --git a/tests/Logging_Strategy_Test.cpp b/tests/Logging_Strategy_Test.cpp index 3cd63e9d5d9..15966342de7 100644 --- a/tests/Logging_Strategy_Test.cpp +++ b/tests/Logging_Strategy_Test.cpp @@ -65,7 +65,7 @@ cdecl_decoration (ACE_TCHAR const *func_name) } // Global variables. -static ACE_TCHAR *file_name; +static ACE_TCHAR *file_name = 0; static int max_size_files = 0; static int max_num_files = 0; static int interval_time = 0; @@ -291,7 +291,8 @@ remove_files (void) static int parse_args (int argc, char* argv []) { - ACE_OS::printf ("Specifications:\n"); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Specifications:\n"))); ACE_Get_Opt get_opt (argc, argv, "s:i:m:f:n:o"); int c; @@ -301,30 +302,40 @@ parse_args (int argc, char* argv []) { case 's': file_name = get_opt.optarg; - ACE_OS::printf ("File name: %s\n", file_name); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("File name: %s\n"), + file_name)); break; case 'i': interval_time = atoi (get_opt.optarg); - ACE_OS::printf ("Interval time (s): %d\n", interval_time); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Interval time (s): %d\n"), + interval_time)); break; case 'm': max_size_files = atoi (get_opt.optarg); - ACE_OS::printf ("Maximum size (KB): %d\n", max_size_files); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Maximum size (KB): %d\n"), + max_size_files)); break; case 'f': - ACE_OS::printf ("Modes: %s\n", get_opt.optarg); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Modes: %s\n"), + get_opt.optarg)); break; case 'n': max_num_files = atoi (get_opt.optarg); - ACE_OS::printf ("Maximum files number: %d\n", max_num_files); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Maximum files number: %d\n"), + max_num_files)); break; case 'o': - ACE_OS::printf ("Ordering files activated\n"); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Ordering files activated\n"))); order_state = 1; break; @@ -356,7 +367,7 @@ int main (int argc, char *argv[]) defined (__hpux) // Implement the dynamic entries via main arguments - ACE_LOG_MSG -> open (argv[0]); + ACE_LOG_MSG->open (argv[0]); if (parse_args (argc, argv) == -1) ACE_ERROR_RETURN ((LM_ERROR, @@ -365,22 +376,25 @@ int main (int argc, char *argv[]) ACE_TCHAR arg_str[250]; sprintf (arg_str, - "dynamic Logger Service_Object *ACE:_make_ACE_Logging_Strategy()\" "); - - for(int i=1; i<argc;i++) - { - ACE_OS_String::strcat(arg_str,argv[i]); - ACE_OS_String::strcat(arg_str, " "); - } + "dynamic Logger Service_Object *ACE:_make_ACE_Logging_Strategy() \""); + + if (argc > 1) + for (int i = 1; i < argc; i++) + { + ACE_OS_String::strcat (arg_str, argv[i]); + ACE_OS_String::strcat (arg_str, " "); + } + else + ACE_OS_String::strcat (arg_str, ACE_TEXT ("-sfoo -o")); - ACE_OS_String::ACE_OS_String::strcat (arg_str, " \""); + ACE_OS_String::ACE_OS_String::strcat (arg_str, "\""); if (ACE_Service_Config::process_directive (arg_str) == -1) ACE_ERROR_RETURN ((LM_ERROR, - "Error opening _make_Detail_Log_Strategy object.\n"), + "Error opening _make_ACE_Log_Strategy object.\n"), 1); - //launch a new Thread + // launch a new Thread if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (run_reactor)) < 0) ACE_ERROR_RETURN ((LM_ERROR, "Spawning Reactor.\n"), diff --git a/tests/Mem_Map_Test.cpp b/tests/Mem_Map_Test.cpp index c7ac0532c6c..fd493aba916 100644 --- a/tests/Mem_Map_Test.cpp +++ b/tests/Mem_Map_Test.cpp @@ -72,7 +72,9 @@ create_test_file (ACE_TCHAR *filename, int line_length, int num_lines) if (file_handle == ACE_INVALID_HANDLE) { delete [] mybuf; - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Open failed\n")), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Open failed\n")), + -1); } for (int j = 0; j < num_lines; j++) @@ -90,14 +92,19 @@ create_test_file (ACE_TCHAR *filename, int line_length, int num_lines) if (ACE_OS::write (file_handle, mybuf, line_length) != line_length) { delete [] mybuf; - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("write to file failed: %p (%d)\n"), - errno, errno), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("write to file failed: %p (%d)\n"), + errno, + errno), + -1); } if (ACE_OS::write (file_handle, ACE_TEXT ("\n"), 1) != 1) { delete [] mybuf; - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("write to file failed\n")), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("write to file failed\n")), + -1); } } @@ -121,27 +128,35 @@ main (int, ACE_TCHAR *[]) // Get the temporary directory // - 18 is for the filenames, ace_mem_map_temp_1 is the longest if (ACE::get_temp_dir (test_file, MAXPATHLEN - 18) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Temporary path too long\n")), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Temporary path too long\n")), + -1); // Copy the temp directory to the other variables ACE_OS::strcpy (temp_file1, test_file); ACE_OS::strcpy (temp_file2, test_file); // Add the filenames to the end - ACE_OS_String::strcat (test_file, ACE_TEXT ("ace_mem_map_test")); - ACE_OS_String::strcat (temp_file1, ACE_TEXT ("ace_mem_map_temp_1")); - ACE_OS_String::strcat (temp_file2, ACE_TEXT ("ace_mem_map_temp_2")); - + ACE_OS_String::strcat (test_file, + ACE_TEXT ("ace_mem_map_test")); + ACE_OS_String::strcat (temp_file1, + ACE_TEXT ("ace_mem_map_temp_1")); + ACE_OS_String::strcat (temp_file2, + ACE_TEXT ("ace_mem_map_temp_2")); // First create a test file to work on if (create_test_file (test_file, LINE_LENGTH, NUM_LINES) != 0) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Create test file failed\n")), -1); - + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Create test file failed\n")), + -1); ACE_Mem_Map mmap; // First memory map the test file if (mmap.map (test_file) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p\n%a"), ACE_TEXT ("mmap")), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%n: %p\n%a"), + ACE_TEXT ("mmap")), + -1); // Now create a temporary file for intermediate processing ACE_HANDLE temp_file_handle = ACE_OS::open (temp_file1, @@ -149,7 +164,9 @@ main (int, ACE_TCHAR *[]) ACE_DEFAULT_FILE_PERMS); if (temp_file_handle == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Open failed\n")), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Open failed\n")), + -1); // Reverse the original file and write the output to the temporary // file. @@ -163,7 +180,10 @@ main (int, ACE_TCHAR *[]) // Now memory map the temporary file if (temp_mmap.map (temp_file1) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p\n%a"), ACE_TEXT ("mmap")), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%n: %p\n%a"), + ACE_TEXT ("mmap")), + -1); if ((temp_file_handle = ACE_OS::open (temp_file2, O_RDWR | O_TRUNC | O_CREAT, @@ -183,7 +203,10 @@ main (int, ACE_TCHAR *[]) ACE_Mem_Map temp_mmap2; if (temp_mmap2.map (temp_file2) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p\n%a"), ACE_TEXT ("mmap")), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%n: %p\n%a"), + ACE_TEXT ("mmap")), + -1); // Now do a memcmp -- the orig file and the second temporary file // should be identical. diff --git a/tests/Time_Service_Test.cpp b/tests/Time_Service_Test.cpp index a479a5ee16e..7bcb324a014 100644 --- a/tests/Time_Service_Test.cpp +++ b/tests/Time_Service_Test.cpp @@ -66,7 +66,7 @@ main (int, ACE_TCHAR *[]) // Add the filename to the end ACE_OS_String::strcat (backing_store, - ACE_TEXT ("ace-malloc-XXXXXX")); + ACE_TEXT ("ace-malloc-XXXXXX")); #endif /* ACE_DEFAULT_BACKING_STORE */ |