diff options
Diffstat (limited to 'ACE/tests/test_config.h')
-rw-r--r-- | ACE/tests/test_config.h | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/ACE/tests/test_config.h b/ACE/tests/test_config.h index 1d1feaa3547..e606f048a21 100644 --- a/ACE/tests/test_config.h +++ b/ACE/tests/test_config.h @@ -88,36 +88,43 @@ size_t const ACE_MAX_THREADS = 4; #endif /* ACE_END_TEST */ #endif /* ACE_HAS_CONSOLE_TEST_OUTPUT */ -#ifndef ACE_START_TEST -#define ACE_START_TEST(NAME) \ +#ifdef ACE_TEST_LOG_TO_STDERR +# define ACE_TEST_LOG_MSG_FLAGS ACE_Log_Msg::STDERR | ACE_Log_Msg::VERBOSE_LITE +# define ACE_TEST_SET_OUTPUT(APPEND) +# define ACE_CLOSE_TEST_LOG +#else +# define ACE_TEST_LOG_MSG_FLAGS ACE_Log_Msg::OSTREAM | ACE_Log_Msg::VERBOSE_LITE +# define ACE_TEST_SET_OUTPUT(APPEND) \ + if (ace_file_stream::instance ()->set_output (program, APPEND) != 0) \ + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("set_output failed")), -1); +# define ACE_CLOSE_TEST_LOG ace_file_stream::instance ()->close () +#endif + +#define ACE_START_TEST_TEMPLATE(NAME, APPEND) \ const ACE_TCHAR *program = NAME; \ - if (ACE_LOG_MSG->open (program, ACE_Log_Msg::OSTREAM | ACE_Log_Msg::VERBOSE_LITE) != 0) \ + if (ACE_LOG_MSG->open (program, ACE_TEST_LOG_MSG_FLAGS) != 0) \ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open log_msg failed")), -1); \ - if (ace_file_stream::instance()->set_output (program) != 0) \ - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("set_output failed")), -1); \ + ACE_TEST_SET_OUTPUT (APPEND); \ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Starting %s test at %D\n"), program)) + +#ifndef ACE_START_TEST +# define ACE_START_TEST(NAME) ACE_START_TEST_TEMPLATE (NAME, 0) #endif /* ACE_START_TEST */ #ifndef ACE_END_TEST #define ACE_END_TEST \ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Ending %s test at %D\n"), program)); \ - ace_file_stream::instance()->close () + ACE_CLOSE_TEST_LOG; #endif /* ACE_END_TEST */ -#define ACE_CLOSE_TEST_LOG ace_file_stream::instance()->close () - -#define ACE_APPEND_LOG(NAME) \ - const ACE_TCHAR *program = NAME; \ - if (ACE_LOG_MSG->open (program, ACE_Log_Msg::OSTREAM | ACE_Log_Msg::VERBOSE_LITE) != 0) \ - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open log_msg failed")), -1); \ - if (ace_file_stream::instance()->set_output (program, 1) != 0) \ - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("set_output failed")), -1); \ - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Starting %s test at %D\n"), program)); +#ifndef ACE_APPEND_LOG +# define ACE_APPEND_LOG(NAME) ACE_START_TEST_TEMPLATE (NAME, 1) +#endif /* ACE_APPEND_LOG */ #define ACE_END_LOG \ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Ending %s test at %D\n\n"), program)); \ ACE_LOG_MSG->set_flags(ACE_Log_Msg::SILENT); \ - ace_file_stream::instance()->close (); + ACE_CLOSE_TEST_LOG; #if defined (ACE_VXWORKS) // This is the only way I could figure out to avoid an error |