update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -26,8 +26,6 @@
#include <boost/test/utils/basic_cstring/io.hpp>
#include <boost/test/utils/lazy_ostream.hpp>
#include <boost/test/utils/setcolor.hpp>
// Boost
#include <boost/version.hpp>
@@ -184,25 +182,25 @@ compiler_log_formatter::log_entry_start( std::ostream& output, log_entry_data co
switch( let ) {
case BOOST_UTL_ET_INFO:
print_prefix( output, entry_data.m_file_name, entry_data.m_line_num );
output << setcolor( m_color_output, term_attr::BRIGHT, term_color::GREEN );
output << setcolor( m_color_output, term_attr::BRIGHT, term_color::GREEN, term_color::ORIGINAL, &m_color_state);
output << "info: ";
break;
case BOOST_UTL_ET_MESSAGE:
output << setcolor( m_color_output, term_attr::BRIGHT, term_color::CYAN );
output << setcolor( m_color_output, term_attr::BRIGHT, term_color::CYAN, term_color::ORIGINAL, &m_color_state);
break;
case BOOST_UTL_ET_WARNING:
print_prefix( output, entry_data.m_file_name, entry_data.m_line_num );
output << setcolor( m_color_output, term_attr::BRIGHT, term_color::YELLOW );
output << setcolor( m_color_output, term_attr::BRIGHT, term_color::YELLOW, term_color::ORIGINAL, &m_color_state);
output << "warning: in \"" << test_phase_identifier() << "\": ";
break;
case BOOST_UTL_ET_ERROR:
print_prefix( output, entry_data.m_file_name, entry_data.m_line_num );
output << setcolor( m_color_output, term_attr::BRIGHT, term_color::RED );
output << setcolor( m_color_output, term_attr::BRIGHT, term_color::RED, term_color::ORIGINAL, &m_color_state);
output << "error: in \"" << test_phase_identifier() << "\": ";
break;
case BOOST_UTL_ET_FATAL_ERROR:
print_prefix( output, entry_data.m_file_name, entry_data.m_line_num );
output << setcolor( m_color_output, term_attr::UNDERLINE, term_color::RED );
output << setcolor( m_color_output, term_attr::UNDERLINE, term_color::RED, term_color::ORIGINAL, &m_color_state);
output << "fatal error: in \"" << test_phase_identifier() << "\": ";
break;
}
@@ -230,7 +228,7 @@ void
compiler_log_formatter::log_entry_finish( std::ostream& output )
{
if( m_color_output )
output << utils::setcolor(m_color_output);
output << utils::setcolor(m_color_output, &m_color_state);
output << std::endl;
}

View File

@@ -84,7 +84,7 @@ namespace std { using ::memset; using ::sprintf; }
# include <procfs.h>
# elif defined(linux) || defined(__linux)
# elif defined(linux) || defined(__linux__)
# define BOOST_LINUX_BASED_DEBUG
@@ -95,7 +95,7 @@ namespace std { using ::memset; using ::sprintf; }
# endif
# ifndef BOOST_TEST_DBG_LIST
# define BOOST_TEST_DBG_LIST gdb
# define BOOST_TEST_DBG_LIST gdb;lldb
# endif
# define BOOST_TEST_CNL_DBG gdb
@@ -103,6 +103,15 @@ namespace std { using ::memset; using ::sprintf; }
# endif
#elif defined(__APPLE__) // ********************* APPLE
# define BOOST_APPLE_BASED_DEBUG
# include <assert.h>
# include <sys/types.h>
# include <unistd.h>
# include <sys/sysctl.h>
#endif
#include <boost/test/detail/suppress_warnings.hpp>
@@ -288,6 +297,8 @@ process_info::process_info( int pid )
m_binary_path_buff[num_read] = 0;
m_binary_path.assign( m_binary_path_buff, num_read );
#else
(void) pid; // silence 'unused variable' warning
#endif
}
@@ -422,7 +433,9 @@ prepare_gdb_cmnd_file( dbg_startup_info const& dsi )
static char cmd_file_name[] = "/tmp/btl_gdb_cmd_XXXXXX"; // !! ??
// prepare commands
const mode_t cur_umask = ::umask( S_IRWXO | S_IRWXG );
fd_holder cmd_fd( ::mkstemp( cmd_file_name ) );
::umask( cur_umask );
if( cmd_fd == -1 )
return 0;
@@ -657,6 +670,34 @@ under_debugger()
return false;
#elif defined(BOOST_APPLE_BASED_DEBUG) // ********************** APPLE
// See https://developer.apple.com/library/mac/qa/qa1361/_index.html
int junk;
int mib[4];
struct kinfo_proc info;
size_t size;
// Initialize the flags so that, if sysctl fails for some bizarre
// reason, we get a predictable result.
info.kp_proc.p_flag = 0;
// Initialize mib, which tells sysctl the info we want, in this case
// we're looking for information about a specific process ID.
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PID;
mib[3] = getpid();
// Call sysctl.
size = sizeof(info);
junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);
assert(junk == 0);
(void)junk; // Silence unused variable warning
// We're being debugged if the P_TRACED flag is set.
return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
#else // ****************************************************** default
return false;
@@ -679,7 +720,7 @@ debugger_break()
#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32
#if defined(__GNUC__) && !defined(__MINGW32__) || \
defined(__INTEL_COMPILER)
defined(__INTEL_COMPILER) || defined(BOOST_EMBTC)
# define BOOST_DEBUG_BREAK __debugbreak
#else
# define BOOST_DEBUG_BREAK DebugBreak
@@ -890,7 +931,9 @@ attach_debugger( bool break_or_continue )
#elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX
char init_done_lock_fn[] = "/tmp/btl_dbg_init_done_XXXXXX";
const mode_t cur_umask = ::umask( S_IRWXO | S_IRWXG );
fd_holder init_done_lock_fd( ::mkstemp( init_done_lock_fn ) );
::umask( cur_umask );
if( init_done_lock_fd == -1 )
return false;

View File

@@ -111,7 +111,7 @@ stack_decorator::operator*() const
}
void
stack_decorator::apply( test_unit& tu )
stack_decorator::apply( test_unit& /*tu*/ )
{
// does nothing by definition
}

View File

@@ -79,11 +79,11 @@ using std::va_list;
# include <eh.h>
# endif
# if defined(__BORLANDC__) && __BORLANDC__ >= 0x560 || defined(__MWERKS__)
# if defined(BOOST_BORLANDC) && BOOST_BORLANDC >= 0x560 || defined(__MWERKS__)
# include <stdint.h>
# endif
# if defined(__BORLANDC__) && __BORLANDC__ < 0x560
# if defined(BOOST_BORLANDC) && BOOST_BORLANDC < 0x560
typedef unsigned uintptr_t;
# endif
@@ -123,7 +123,7 @@ _set_invalid_parameter_handler( _invalid_parameter_handler arg )
# endif
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0564)) || defined(UNDER_CE)
# if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x0564)) || defined(UNDER_CE)
namespace { void _set_se_translator( void* ) {} }
@@ -163,7 +163,7 @@ namespace { void _set_se_translator( void* ) {} }
// documentation of BOOST_TEST_DISABLE_ALT_STACK in execution_monitor.hpp
# if !defined(__CYGWIN__) && !defined(__QNXNTO__) && !defined(__bgq__) && \
(!defined(__ANDROID__) || __ANDROID_API__ >= 8) && \
(!defined(__ANDROID__) || __ANDROID_API__ >= 8) && !defined(__wasm__) && \
!defined(BOOST_TEST_DISABLE_ALT_STACK)
# define BOOST_TEST_USE_ALT_STACK
# endif
@@ -194,6 +194,13 @@ namespace { void _set_se_translator( void* ) {} }
# include <boost/core/demangle.hpp>
#endif
#if !defined(BOOST_MSSTL_VERSION) || (BOOST_MSSTL_VERSION >= 120)
# include <inttypes.h>
# define BOOST_TEST_PRIxPTR PRIxPTR
#else
# define BOOST_TEST_PRIxPTR "08lx"
#endif
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
@@ -214,7 +221,7 @@ void throw_exception( std::exception const & e ) { abort(); }
namespace detail {
#ifdef __BORLANDC__
#ifdef BOOST_BORLANDC
# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) std::vsnprintf( (a1), (a2), (a3), (a4) )
#elif BOOST_WORKAROUND(_MSC_VER, <= 1310) || \
BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3000)) || \
@@ -225,6 +232,14 @@ namespace detail {
# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) vsnprintf( (a1), (a2), (a3), (a4) )
#endif
/* checks the printf formatting by adding a decorator to the function */
#if __GNUC__ >= 3 || defined(BOOST_EMBTC)
#define BOOST_TEST_PRINTF_ATTRIBUTE_CHECK(x, y) __attribute__((__format__ (__printf__, x, y)))
#else
#define BOOST_TEST_PRINTF_ATTRIBUTE_CHECK(x, y)
#endif
#ifndef BOOST_NO_EXCEPTIONS
template <typename ErrorInfo>
@@ -242,6 +257,7 @@ extract( boost::exception const* ex )
//____________________________________________________________________________//
static void
BOOST_TEST_PRINTF_ATTRIBUTE_CHECK(3, 0)
report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, va_list* args )
{
static const int REPORT_ERROR_BUFFER_SIZE = 4096;
@@ -260,6 +276,7 @@ report_error( execution_exception::error_code ec, boost::exception const* be, ch
//____________________________________________________________________________//
static void
BOOST_TEST_PRINTF_ATTRIBUTE_CHECK(3, 4)
report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, ... )
{
va_list args;
@@ -273,6 +290,7 @@ report_error( execution_exception::error_code ec, boost::exception const* be, ch
//____________________________________________________________________________//
static void
BOOST_TEST_PRINTF_ATTRIBUTE_CHECK(2, 3)
report_error( execution_exception::error_code ec, char const* format, ... )
{
va_list args;
@@ -391,14 +409,19 @@ system_signal_exception::report() const
report_error( execution_exception::system_error,
"signal: the expiration of a timer set by timer_settimer()" );
break;
// OpenBSD was missing SI_ASYNCIO and SI_MESGQ
#ifdef SI_ASYNCIO
case SI_ASYNCIO:
report_error( execution_exception::system_error,
"signal: generated by the completion of an asynchronous I/O request" );
break;
#endif
#ifdef SI_MESGQ
case SI_MESGQ:
report_error( execution_exception::system_error,
"signal: generated by the the arrival of a message on an empty message queue" );
break;
#endif
default:
break;
}
@@ -409,49 +432,49 @@ system_signal_exception::report() const
#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS
case ILL_ILLOPC:
report_error( execution_exception::system_fatal_error,
"signal: illegal opcode; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: illegal opcode; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
case ILL_ILLTRP:
report_error( execution_exception::system_fatal_error,
"signal: illegal trap; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: illegal trap; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
case ILL_PRVREG:
report_error( execution_exception::system_fatal_error,
"signal: privileged register; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: privileged register; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
case ILL_BADSTK:
report_error( execution_exception::system_fatal_error,
"signal: internal stack error; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: internal stack error; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
#endif
case ILL_ILLOPN:
report_error( execution_exception::system_fatal_error,
"signal: illegal operand; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: illegal operand; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
case ILL_ILLADR:
report_error( execution_exception::system_fatal_error,
"signal: illegal addressing mode; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: illegal addressing mode; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
case ILL_PRVOPC:
report_error( execution_exception::system_fatal_error,
"signal: privileged opcode; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: privileged opcode; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
case ILL_COPROC:
report_error( execution_exception::system_fatal_error,
"signal: co-processor error; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: co-processor error; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
default:
report_error( execution_exception::system_fatal_error,
"signal: SIGILL, si_code: %d (illegal instruction; address of failing instruction: 0x%08lx)",
m_sig_info->si_addr, m_sig_info->si_code );
"signal: SIGILL, si_code: %d (illegal instruction; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR ")",
m_sig_info->si_code, (uintptr_t) m_sig_info->si_addr );
break;
}
break;
@@ -460,48 +483,48 @@ system_signal_exception::report() const
switch( m_sig_info->si_code ) {
case FPE_INTDIV:
report_error( execution_exception::system_error,
"signal: integer divide by zero; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: integer divide by zero; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
case FPE_INTOVF:
report_error( execution_exception::system_error,
"signal: integer overflow; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: integer overflow; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
case FPE_FLTDIV:
report_error( execution_exception::system_error,
"signal: floating point divide by zero; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: floating point divide by zero; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
case FPE_FLTOVF:
report_error( execution_exception::system_error,
"signal: floating point overflow; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: floating point overflow; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
case FPE_FLTUND:
report_error( execution_exception::system_error,
"signal: floating point underflow; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: floating point underflow; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
case FPE_FLTRES:
report_error( execution_exception::system_error,
"signal: floating point inexact result; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: floating point inexact result; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
case FPE_FLTINV:
report_error( execution_exception::system_error,
"signal: invalid floating point operation; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: invalid floating point operation; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
case FPE_FLTSUB:
report_error( execution_exception::system_error,
"signal: subscript out of range; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
"signal: subscript out of range; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR,
(uintptr_t) m_sig_info->si_addr );
break;
default:
report_error( execution_exception::system_error,
"signal: SIGFPE, si_code: %d (errnoneous arithmetic operations; address of failing instruction: 0x%08lx)",
m_sig_info->si_addr, m_sig_info->si_code );
"signal: SIGFPE, si_code: %d (errnoneous arithmetic operations; address of failing instruction: 0x%" BOOST_TEST_PRIxPTR ")",
m_sig_info->si_code, (uintptr_t) m_sig_info->si_addr );
break;
}
break;
@@ -511,19 +534,19 @@ system_signal_exception::report() const
#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS
case SEGV_MAPERR:
report_error( execution_exception::system_fatal_error,
"memory access violation at address: 0x%08lx: no mapping at fault address",
m_sig_info->si_addr );
"memory access violation at address: 0x%" BOOST_TEST_PRIxPTR ": no mapping at fault address",
(uintptr_t) m_sig_info->si_addr );
break;
case SEGV_ACCERR:
report_error( execution_exception::system_fatal_error,
"memory access violation at address: 0x%08lx: invalid permissions",
m_sig_info->si_addr );
"memory access violation at address: 0x%" BOOST_TEST_PRIxPTR ": invalid permissions",
(uintptr_t) m_sig_info->si_addr );
break;
#endif
default:
report_error( execution_exception::system_fatal_error,
"signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)",
m_sig_info->si_addr, m_sig_info->si_code );
"signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%" BOOST_TEST_PRIxPTR ")",
m_sig_info->si_code, (uintptr_t) m_sig_info->si_addr );
break;
}
break;
@@ -533,24 +556,24 @@ system_signal_exception::report() const
#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS
case BUS_ADRALN:
report_error( execution_exception::system_fatal_error,
"memory access violation at address: 0x%08lx: invalid address alignment",
m_sig_info->si_addr );
"memory access violation at address: 0x%" BOOST_TEST_PRIxPTR ": invalid address alignment",
(uintptr_t) m_sig_info->si_addr );
break;
case BUS_ADRERR:
report_error( execution_exception::system_fatal_error,
"memory access violation at address: 0x%08lx: non-existent physical address",
m_sig_info->si_addr );
"memory access violation at address: 0x%" BOOST_TEST_PRIxPTR ": non-existent physical address",
(uintptr_t) m_sig_info->si_addr );
break;
case BUS_OBJERR:
report_error( execution_exception::system_fatal_error,
"memory access violation at address: 0x%08lx: object specific hardware error",
m_sig_info->si_addr );
"memory access violation at address: 0x%" BOOST_TEST_PRIxPTR ": object specific hardware error",
(uintptr_t) m_sig_info->si_addr );
break;
#endif
default:
report_error( execution_exception::system_fatal_error,
"signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)",
m_sig_info->si_addr, m_sig_info->si_code );
"signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%" BOOST_TEST_PRIxPTR ")",
m_sig_info->si_code, (uintptr_t) m_sig_info->si_addr );
break;
}
break;
@@ -596,7 +619,7 @@ system_signal_exception::report() const
default:
report_error( execution_exception::system_error,
"signal: SIGPOLL, si_code: %d (asynchronous I/O event occurred; band event %d)",
(int)m_sig_info->si_band, m_sig_info->si_code );
m_sig_info->si_code, (int)m_sig_info->si_band );
break;
}
break;
@@ -701,7 +724,11 @@ signal_action::~signal_action()
class signal_handler {
public:
// Constructor
explicit signal_handler( bool catch_system_errors, bool detect_fpe, unsigned timeout_microseconds, bool attach_dbg, char* alt_stack );
explicit signal_handler( bool catch_system_errors,
bool detect_fpe,
unsigned long int timeout_microseconds,
bool attach_dbg,
char* alt_stack );
// Destructor
~signal_handler();
@@ -724,7 +751,7 @@ public:
private:
// Data members
signal_handler* m_prev_handler;
unsigned m_timeout_microseconds;
unsigned long int m_timeout_microseconds;
// Note: We intentionality do not catch SIGCHLD. Users have to deal with it themselves
signal_action m_ILL_action;
@@ -748,7 +775,11 @@ signal_handler* signal_handler::s_active_handler = signal_handler_ptr();
//____________________________________________________________________________//
signal_handler::signal_handler( bool catch_system_errors, bool detect_fpe, unsigned timeout_microseconds, bool attach_dbg, char* alt_stack )
signal_handler::signal_handler( bool catch_system_errors,
bool detect_fpe,
unsigned long int timeout_microseconds,
bool attach_dbg,
char* alt_stack )
: m_prev_handler( s_active_handler )
, m_timeout_microseconds( timeout_microseconds )
, m_ILL_action ( SIGILL , catch_system_errors, attach_dbg, alt_stack )
@@ -889,7 +920,7 @@ execution_monitor::catch_signals( boost::function<int ()> const& F )
// ************** Microsoft structured exception handling ************** //
// ************************************************************************** //
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0564))
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x0564))
namespace { void _set_se_translator( void* ) {} }
#endif
@@ -1004,7 +1035,7 @@ system_signal_exception::report() const
else
detail::report_error(
execution_exception::system_fatal_error,
"memory access violation occurred at address 0x%08lx, while attempting to %s",
"memory access violation occurred at address 0x%" BOOST_TEST_PRIxPTR ", while attempting to %s",
m_fault_address,
m_dir ? " read inaccessible data"
: " write to an inaccessible (or protected) address"
@@ -1099,7 +1130,7 @@ system_signal_exception::report() const
detail::report_error(execution_exception::timeout_error, "timeout while executing function");
}
else {
detail::report_error( execution_exception::system_error, "unrecognized exception. Id: 0x%08lx", m_se_id );
detail::report_error( execution_exception::system_error, "unrecognized exception. Id: 0x%" BOOST_TEST_PRIxPTR, m_se_id );
}
break;
}
@@ -1167,11 +1198,11 @@ execution_monitor::catch_signals( boost::function<int ()> const& F )
htimer = ::CreateWaitableTimer(
NULL,
TRUE,
TEXT("Boost.Test timer"));
NULL); // naming the timer might create collisions
if( htimer != INVALID_HANDLE_VALUE ) {
LARGE_INTEGER liDueTime;
liDueTime.QuadPart = - static_cast<signed long int>(p_timeout) * 10; // resolution of 100 ns
liDueTime.QuadPart = - static_cast<LONGLONG>(p_timeout) * 10ll; // resolution of 100 ns
bTimerSuccess = ::SetWaitableTimer(
htimer,
@@ -1295,11 +1326,7 @@ execution_monitor::execute( boost::function<int ()> const& F )
catch( boost::exception const& ex )
{ detail::report_error( execution_exception::cpp_exception_error,
&ex,
#if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI)
"unknown boost::exception" ); }
#else
boost::diagnostic_information(ex).c_str() ); }
#endif
"%s", boost::diagnostic_information(ex).c_str() ); }
// std:: exceptions
#if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI)
@@ -1355,7 +1382,7 @@ execution_monitor::execute( boost::function<int ()> const& F )
#endif // !BOOST_NO_EXCEPTIONS
return 0; // never reached; supplied to quiet compiler warnings
BOOST_TEST_UNREACHABLE_RETURN(0); // never reached; supplied to quiet compiler warnings
} // execute
//____________________________________________________________________________//

View File

@@ -49,7 +49,7 @@
// Boost
#include <boost/test/utils/timer.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
// STL
#include <limits>
@@ -59,9 +59,7 @@
#include <ctime>
#include <numeric>
#include <cmath>
#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE
#include <iterator>
#endif
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std { using ::time; using ::srand; }
@@ -276,13 +274,13 @@ private:
}
// test_tree_visitor interface
virtual void visit( test_case const& tc )
void visit( test_case const& tc ) BOOST_OVERRIDE
{
// make sure we only accept test cases if we match last component of the filter
if( m_depth == m_components.size() && filter_unit( tc ) )
m_targ_list.push_back( tc.p_id ); // found a test case
}
virtual bool test_suite_start( test_suite const& ts )
bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE
{
if( !filter_unit( ts ) )
return false;
@@ -296,7 +294,7 @@ private:
return false;
}
virtual void test_suite_finish( test_suite const& /*ts*/ )
void test_suite_finish( test_suite const& /*ts*/ ) BOOST_OVERRIDE
{
--m_depth;
}
@@ -322,7 +320,7 @@ public:
private:
// test_tree_visitor interface
virtual bool visit( test_unit const& tu )
bool visit( test_unit const& tu ) BOOST_OVERRIDE
{
if( tu.has_label( m_label ) ) {
// found a test unit; add it to list of tu to enable with children and stop recursion in case of suites
@@ -350,7 +348,7 @@ public:
{}
// test_tree_visitor interface
virtual bool visit( test_unit const& tu )
bool visit( test_unit const& tu ) BOOST_OVERRIDE
{
const_cast<test_unit&>(tu).p_run_status.value = m_new_status == test_unit::RS_INVALID ? tu.p_default_status : m_new_status;
if( m_dep_collector ) {
@@ -441,9 +439,7 @@ parse_filters( test_unit_id master_tu_id, test_unit_id_list& tu_to_enable, test_
//____________________________________________________________________________//
#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE
// a poor man's implementation of random_shuffle
// a poor man's implementation of random_shuffle, deprecated in C++11
template< class RandomIt, class RandomFunc >
void random_shuffle( RandomIt first, RandomIt last, RandomFunc &r )
{
@@ -458,21 +454,18 @@ void random_shuffle( RandomIt first, RandomIt last, RandomFunc &r )
}
}
#endif
// A simple handle for registering the global fixtures to the master test suite
// without deleting an existing static object (the global fixture itself) when the program
// terminates (shared_ptr).
class global_fixture_handle : public test_unit_fixture {
public:
global_fixture_handle(test_unit_fixture* fixture) : m_global_fixture(fixture) {}
~global_fixture_handle() {}
~global_fixture_handle() BOOST_OVERRIDE {}
virtual void setup() {
void setup() BOOST_OVERRIDE {
m_global_fixture->setup();
}
virtual void teardown() {
void teardown() BOOST_OVERRIDE {
m_global_fixture->teardown();
}
@@ -528,7 +521,7 @@ public:
{
test_unit& tu = framework::get( tu_id, TUT_ANY );
// collect all sibling dependancy from tu own list
// collect all sibling dependencies from tu own list
BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() )
collect_dependant_siblings( tu_id, dep_id, master_tu_id, tuoi );
@@ -625,7 +618,7 @@ public:
while( parent_id != INV_TEST_UNIT_ID
&& parent_id != master_tu_id )
{
// we do not use the traverse_test_tree as otherwise it would enable the sibblings and subtree
// we do not use the traverse_test_tree as otherwise it would enable the siblings and subtree
// of the test case we want to enable (we need to enable the parent suites and their dependencies only)
// the parent_id needs to be enabled in order to be properly parsed by finalize_run_status, the visit
// does the job
@@ -673,8 +666,11 @@ public:
execution_result result = unit_test_monitor_t::test_ok;
if( !tu.is_enabled() )
if( !tu.is_enabled() ) {
BOOST_TEST_FOREACH( test_observer*, to, m_observers )
to->test_unit_skipped( tu, "disabled" );
return result;
}
// 10. Check preconditions, including zero time left for execution and
// successful execution of all dependencies
@@ -778,11 +774,7 @@ public:
it++;
}
#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE
impl::random_shuffle( children_with_the_same_rank.begin(), children_with_the_same_rank.end(), rand_gen );
#else
std::random_shuffle( children_with_the_same_rank.begin(), children_with_the_same_rank.end(), rand_gen );
#endif
BOOST_TEST_FOREACH( test_unit_id, chld, children_with_the_same_rank ) {
unsigned long int chld_timeout = child_timeout(
@@ -870,7 +862,8 @@ public:
struct priority_order {
bool operator()( test_observer* lhs, test_observer* rhs ) const
{
return (lhs->priority() < rhs->priority()) || ((lhs->priority() == rhs->priority()) && (lhs < rhs));
return (lhs->priority() < rhs->priority()) ||
((lhs->priority() == rhs->priority()) && std::less<test_observer*>()(lhs, rhs));
}
};
@@ -999,6 +992,7 @@ setup_loggers()
log_cleaner );
}
unit_test_log.set_stream( stream_logger.ref() );
unit_test_log.configure();
}
else
{
@@ -1193,7 +1187,6 @@ init( init_unit_test_func init_func, int argc, char* argv[] )
// 40. Register default test observers
register_observer( results_collector );
register_observer( unit_test_log );
register_observer( framework_init_observer );
if( runtime_config::get<bool>( runtime_config::btrt_show_progress ) ) {
progress_monitor.set_stream( std::cout ); // defaults to stdout
@@ -1234,14 +1227,14 @@ finalize_setup_phase( test_unit_id master_tu_id )
private:
// test_tree_visitor interface
virtual bool test_suite_start( test_suite const& ts)
bool test_suite_start( test_suite const& ts) BOOST_OVERRIDE
{
const_cast<test_suite&>(ts).generate();
const_cast<test_suite&>(ts).check_for_duplicate_test_cases();
return test_tree_visitor::test_suite_start(ts);
}
virtual bool visit( test_unit const& tu )
bool visit( test_unit const& tu ) BOOST_OVERRIDE
{
BOOST_TEST_FOREACH( decorator::base_ptr, d, tu.p_decorators.get() )
d->apply( const_cast<test_unit&>(tu) );
@@ -1525,6 +1518,14 @@ master_test_suite()
return *impl::s_frk_state().m_master_test_suite;
}
namespace impl {
master_test_suite_name_setter::master_test_suite_name_setter(const_string name) {
assign_op( master_test_suite().p_name.value, name.trim( "\"" ), 0 );
}
}
//____________________________________________________________________________//
// ************************************************************************** //
@@ -1605,6 +1606,33 @@ struct swap_on_delete {
Cont& m_c2;
};
struct register_observer_helper {
register_observer_helper(test_observer& observer)
: m_observer(observer)
{
register_obs();
}
~register_observer_helper() {
if(m_registered)
deregister_observer( m_observer );
}
void deregister_obs() {
m_registered = false;
deregister_observer( m_observer );
}
void register_obs() {
m_registered = true;
register_observer( m_observer );
}
test_observer& m_observer;
bool m_registered;
};
void
run( test_unit_id id, bool continue_test )
{
@@ -1626,6 +1654,9 @@ run( test_unit_id id, bool continue_test )
bool init_ok = true;
const_string setup_error;
framework_init_observer_t local_init_observer;
register_observer_helper init_observer_helper( local_init_observer );
if( call_start_finish ) {
// indicates the framework that no test is in progress now if observers need to be notified
impl::s_frk_state().m_test_in_progress = false;
@@ -1633,13 +1664,13 @@ run( test_unit_id id, bool continue_test )
BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) {
BOOST_TEST_I_TRY {
ut_detail::test_unit_id_restore restore_current_test_unit(impl::s_frk_state().m_curr_test_unit, id);
unit_test_monitor_t::error_level result = unit_test_monitor.execute_and_translate( boost::bind( &test_observer::test_start, to, tcc.p_count ) );
unit_test_monitor_t::error_level result = unit_test_monitor.execute_and_translate( boost::bind( &test_observer::test_start, to, tcc.p_count, id ) );
if( init_ok ) {
if( result != unit_test_monitor_t::test_ok ) {
init_ok = false;
}
else {
if( unit_test::framework_init_observer.has_failed() ) {
if( local_init_observer.has_failed() ) {
init_ok = false;
}
}
@@ -1656,6 +1687,9 @@ run( test_unit_id id, bool continue_test )
}
}
// removing this observer as it should not be of any use for the tests
init_observer_helper.deregister_obs();
if( init_ok ) {
// attaching the global fixtures to the main entry point
@@ -1694,7 +1728,10 @@ run( test_unit_id id, bool continue_test )
results_reporter::make_report( INV_REPORT_LEVEL, id );
unit_test::framework_init_observer.clear();
// reinstalling this observer
init_observer_helper.register_obs();
local_init_observer.clear();
if( call_start_finish ) {
// indicates the framework that no test is in progress anymore if observers need to be notified
// and this is a teardown, so assertions should not raise any exception otherwise an exception
@@ -1709,7 +1746,7 @@ run( test_unit_id id, bool continue_test )
impl::s_frk_state().m_test_in_progress = was_in_progress;
// propagates the init/teardown error if any
BOOST_TEST_SETUP_ASSERT( init_ok && !unit_test::framework_init_observer.has_failed(), setup_error );
BOOST_TEST_SETUP_ASSERT( init_ok && !local_init_observer.has_failed(), setup_error );
}
//____________________________________________________________________________//

View File

@@ -23,7 +23,6 @@
#include <boost/test/framework.hpp>
#include <boost/test/tree/visitor.hpp>
#include <boost/test/tree/test_case_counter.hpp>
#include <boost/test/tree/traverse.hpp>
#include <boost/test/results_collector.hpp>
@@ -398,7 +397,7 @@ public:
m_stream << "</testcase>" << std::endl;
}
void visit( test_case const& tc )
void visit( test_case const& tc ) BOOST_OVERRIDE
{
test_results const& tr = results_collector.results( tc.p_id );
@@ -413,7 +412,7 @@ public:
}
}
bool test_suite_start( test_suite const& ts )
bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE
{
test_results const& tr = results_collector.results( ts.p_id );
@@ -422,7 +421,7 @@ public:
m_stream << "<testsuite";
// think about: maybe we should add the number of fixtures of a test_suite as
// independant tests (field p_fixtures).
// independent tests (field p_fixtures).
// same goes for the timed-execution: we can think of that as a separate test-unit
// in the suite.
// see https://llg.cubic.org/docs/junit/ and
@@ -472,7 +471,7 @@ public:
return true; // indicates that the children should also be parsed
}
virtual void test_suite_finish( test_suite const& ts )
void test_suite_finish( test_suite const& ts ) BOOST_OVERRIDE
{
if( m_ts.p_id == ts.p_id ) {
write_testcase_system_out(runner_log, 0, false);

View File

@@ -126,7 +126,7 @@ BOOST_TEST_SINGLETON_CONS_IMPL(progress_monitor_t)
//____________________________________________________________________________//
void
progress_monitor_t::test_start( counter_t test_cases_amount )
progress_monitor_t::test_start( counter_t test_cases_amount, test_unit_id )
{
s_pm_impl().m_color_output = runtime_config::get<bool>( runtime_config::btrt_color_output );

View File

@@ -145,6 +145,27 @@ struct results_collector_impl {
results_collector_impl& s_rc_impl() { static results_collector_impl the_inst; return the_inst; }
// deletes the entries of results_collector_impl
class clear_subtree_result : public test_tree_visitor {
public:
clear_subtree_result(results_collector_impl& store)
: m_store( store )
{}
private:
bool visit( test_unit const& tu) BOOST_OVERRIDE
{
typedef std::map<test_unit_id,test_results>::iterator iterator;
iterator found = m_store.m_results_store.find(tu.p_id);
if(found != m_store.m_results_store.end()) {
m_store.m_results_store.erase( found );
}
return true;
}
results_collector_impl& m_store;
};
} // local namespace
//____________________________________________________________________________//
@@ -154,9 +175,11 @@ BOOST_TEST_SINGLETON_CONS_IMPL( results_collector_t )
//____________________________________________________________________________//
void
results_collector_t::test_start( counter_t )
results_collector_t::test_start( counter_t, test_unit_id id )
{
s_rc_impl().m_results_store.clear();
// deletes the results under id only
clear_subtree_result tree_clear(s_rc_impl());
traverse_test_tree( id, tree_clear );
}
//____________________________________________________________________________//
@@ -178,7 +201,7 @@ class results_collect_helper : public test_tree_visitor {
public:
explicit results_collect_helper( test_results& tr, test_unit const& ts ) : m_tr( tr ), m_ts( ts ) {}
void visit( test_case const& tc )
void visit( test_case const& tc ) BOOST_OVERRIDE
{
test_results const& tr = results_collector.results( tc.p_id );
m_tr += tr;
@@ -189,10 +212,12 @@ public:
else
m_tr.p_test_cases_passed.value++;
}
else if( tr.p_timed_out )
else if( tr.p_timed_out ) {
m_tr.p_test_cases_timed_out.value++;
else if( tr.p_skipped )
}
else if( tr.p_skipped || !tc.is_enabled() ) {
m_tr.p_test_cases_skipped.value++;
}
else {
if( tr.p_aborted )
m_tr.p_test_cases_aborted.value++;
@@ -200,7 +225,7 @@ public:
m_tr.p_test_cases_failed.value++;
}
}
bool test_suite_start( test_suite const& ts )
bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE
{
if( m_ts.p_id == ts.p_id )
return true;
@@ -224,17 +249,12 @@ private:
void
results_collector_t::test_unit_finish( test_unit const& tu, unsigned long elapsed_in_microseconds )
{
test_results & tr = s_rc_impl().m_results_store[tu.p_id];
if( tu.p_type == TUT_SUITE ) {
results_collect_helper ch( s_rc_impl().m_results_store[tu.p_id], tu );
traverse_test_tree( tu, ch );
s_rc_impl().m_results_store[tu.p_id].p_duration_microseconds.value = elapsed_in_microseconds;
results_collect_helper ch( tr, tu );
traverse_test_tree( tu, ch, true ); // true to ignore the status: we need to count the skipped/disabled tests
}
else {
test_results & tr = s_rc_impl().m_results_store[tu.p_id];
tr.p_duration_microseconds.value = elapsed_in_microseconds;
bool num_failures_match = tr.p_aborted || tr.p_assertions_failed >= tr.p_expected_failures;
if( !num_failures_match )
BOOST_TEST_FRAMEWORK_MESSAGE( "Test case " << tu.full_name() << " has fewer failures than expected" );
@@ -243,6 +263,7 @@ results_collector_t::test_unit_finish( test_unit const& tu, unsigned long elapse
if( !check_any_assertions )
BOOST_TEST_FRAMEWORK_MESSAGE( "Test case " << tu.full_name() << " did not check any assertions" );
}
tr.p_duration_microseconds.value = elapsed_in_microseconds;
}
//____________________________________________________________________________//
@@ -256,8 +277,8 @@ results_collector_t::test_unit_skipped( test_unit const& tu, const_string /*reas
tr.p_skipped.value = true;
if( tu.p_type == TUT_SUITE ) {
test_case_counter tcc;
traverse_test_tree( tu, tcc );
test_case_counter tcc(true);
traverse_test_tree( tu, tcc, true ); // true because need to count the disabled tests/units
tr.p_test_cases_skipped.value = tcc.p_count;
}

View File

@@ -9,7 +9,7 @@
//
// Version : $Revision$
//
// Description : result reporting facilties
// Description : result reporting facilities
// ***************************************************************************
#ifndef BOOST_TEST_RESULTS_REPORTER_IPP_020105GER
@@ -59,12 +59,12 @@ struct results_reporter_impl : test_tree_visitor {
{}
// test tree visitor interface implementation
void visit( test_case const& tc )
void visit( test_case const& tc ) BOOST_OVERRIDE
{
m_formatter->test_unit_report_start( tc, *m_stream );
m_formatter->test_unit_report_finish( tc, *m_stream );
}
bool test_suite_start( test_suite const& ts )
bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE
{
m_formatter->test_unit_report_start( ts, *m_stream );
@@ -74,7 +74,7 @@ struct results_reporter_impl : test_tree_visitor {
m_formatter->test_unit_report_finish( ts, *m_stream );
return false;
}
void test_suite_finish( test_suite const& ts )
void test_suite_finish( test_suite const& ts ) BOOST_OVERRIDE
{
m_formatter->test_unit_report_finish( ts, *m_stream );
}

View File

@@ -29,41 +29,16 @@ namespace unit_test {
// ************** framework_init_observer_t ************** //
// ************************************************************************** //
namespace {
struct test_init_observer_check {
bool has_failure;
void clear()
{
has_failure = false;
}
};
test_init_observer_check& s_tioc_impl() { static test_init_observer_check the_inst; return the_inst; }
} // local namespace
//____________________________________________________________________________//
// singleton pattern
BOOST_TEST_SINGLETON_CONS_IMPL(framework_init_observer_t)
//____________________________________________________________________________//
void
framework_init_observer_t::clear()
{
if(!framework::test_in_progress())
s_tioc_impl().clear();
m_has_failure = false;
}
//____________________________________________________________________________//
void
framework_init_observer_t::test_start( counter_t )
framework_init_observer_t::test_start( counter_t, test_unit_id )
{
clear();
}
@@ -73,11 +48,8 @@ framework_init_observer_t::test_start( counter_t )
void
framework_init_observer_t::assertion_result( unit_test::assertion_result ar )
{
test_init_observer_check& tr = s_tioc_impl();
switch( ar ) {
case AR_TRIGGERED: break;
case AR_PASSED: break;
case AR_FAILED: tr.has_failure = true; break;
case AR_FAILED: m_has_failure = true; break;
default:
break;
}
@@ -88,14 +60,13 @@ framework_init_observer_t::assertion_result( unit_test::assertion_result ar )
void
framework_init_observer_t::exception_caught( execution_exception const& )
{
test_init_observer_check& tr = s_tioc_impl();
tr.has_failure = true;
m_has_failure = true;
}
void
framework_init_observer_t::test_aborted()
{
s_tioc_impl().has_failure = true;
m_has_failure = true;
}
@@ -104,7 +75,7 @@ framework_init_observer_t::test_aborted()
bool
framework_init_observer_t::has_failed() const
{
return s_tioc_impl().has_failure;
return m_has_failure;
}
//____________________________________________________________________________//

View File

@@ -113,6 +113,22 @@ print_log_value<unsigned char>::operator()( std::ostream& ostr, unsigned char t
//____________________________________________________________________________//
void
print_log_value<wchar_t>::operator()( std::ostream& ostr, wchar_t r )
{
std::mbstate_t state;
std::string mb(MB_CUR_MAX, '\0');
std::size_t ret = std::wcrtomb(&mb[0], r, &state);
if( ret > 0) {
ostr << mb;
}
else {
ostr << "(wchar_t unable to convert)";
}
}
//____________________________________________________________________________//
void
print_log_value<char const*>::operator()( std::ostream& ostr, char const* t )
{
@@ -124,7 +140,12 @@ print_log_value<char const*>::operator()( std::ostream& ostr, char const* t )
void
print_log_value<wchar_t const*>::operator()( std::ostream& ostr, wchar_t const* t )
{
ostr << ( t ? t : L"null string" );
if(t) {
ostr << static_cast<const void*>(t);
}
else {
ostr << "null w-string";
}
}
//____________________________________________________________________________//
@@ -384,7 +405,7 @@ report_assertion( assertion_result const& ar,
BOOST_TEST_I_THROW( execution_aborted() );
// the previous line either throws or aborts and the return below is not reached
// return false;
BOOST_UNREACHABLE_RETURN(false);
BOOST_TEST_UNREACHABLE_RETURN(false);
}
return true;
@@ -404,7 +425,7 @@ format_assertion_result( const_string expr_val, const_string details )
if( !details.is_empty() ) {
if( first_char(details) != '[' )
res.message().stream() << ". ";
res.message().stream() << ": ";
else
res.message().stream() << " ";
@@ -733,7 +754,7 @@ output_test_stream::match_pattern( bool flush_stream )
for( std::size_t k = 1; k < (std::max)(best_pattern_start_index, best_stream_start_index); k++ ) { // 1 is for the current char c
std::string s1(pretty_print_log(std::string(1, last_elements_ordered[(std::min)(k, best_pattern_start_index)])));
std::string s2(pretty_print_log(std::string(1, sub_str_suffix[(std::min)(k, best_stream_start_index)])));
for( int h = (std::max)(s1.size(), s2.size()); h > 0; h--)
for( int h = static_cast<int>((std::max)(s1.size(), s2.size())); h > 0; h--)
result.message() << "~";
}

View File

@@ -435,7 +435,7 @@ namespace ut_detail {
std::string
normalize_test_case_name( const_string name )
{
std::string norm_name( name.begin(), name.size() );
std::string norm_name( name.begin(), name.end() );
if( name[0] == '&' )
norm_name = norm_name.substr( 1 );
@@ -452,7 +452,7 @@ normalize_test_case_name( const_string name )
}
// sanitize all chars that might be used in runtime filters
static const char to_replace[] = { ':', '*', '@', '+', '!', '/' };
static const char to_replace[] = { ':', '*', '@', '+', '!', '/', ',' };
for(std::size_t index = 0;
index < sizeof(to_replace)/sizeof(to_replace[0]);
index++) {

View File

@@ -131,11 +131,18 @@ struct unit_test_log_impl {
typedef std::vector<unit_test_log_data_helper_impl> v_formatter_data_t;
v_formatter_data_t m_log_formatter_data;
typedef std::vector<unit_test_log_data_helper_impl*> vp_formatter_data_t;
vp_formatter_data_t m_active_log_formatter_data;
// entry data
log_entry_data m_entry_data;
bool has_entry_in_progress() const {
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl const&, current_logger_data, m_log_formatter_data ) {
for( vp_formatter_data_t::const_iterator it(m_active_log_formatter_data.begin()), ite(m_active_log_formatter_data.end());
it < ite;
++it)
{
unit_test_log_data_helper_impl& current_logger_data = **it;
if( current_logger_data.m_entry_in_progress )
return true;
}
@@ -155,30 +162,80 @@ struct unit_test_log_impl {
unit_test_log_impl& s_log_impl() { static unit_test_log_impl the_inst; return the_inst; }
//____________________________________________________________________________//
void
log_entry_context( log_level l, unit_test_log_data_helper_impl& current_logger_data)
{
framework::context_generator const& context = framework::get_context();
if( context.is_empty() )
return;
const_string frame;
current_logger_data.m_log_formatter->entry_context_start( current_logger_data.stream(), l );
while( !(frame=context.next()).is_empty() )
{
current_logger_data.m_log_formatter->log_entry_context( current_logger_data.stream(), l, frame );
}
current_logger_data.m_log_formatter->entry_context_finish( current_logger_data.stream(), l );
}
//____________________________________________________________________________//
void
clear_entry_context()
{
framework::clear_context();
}
// convenience
typedef unit_test_log_impl::vp_formatter_data_t vp_logger_t;
typedef unit_test_log_impl::v_formatter_data_t v_logger_t;
} // local namespace
//____________________________________________________________________________//
BOOST_TEST_SINGLETON_CONS_IMPL( unit_test_log_t )
void
unit_test_log_t::configure( )
{
// configure is not test_start:
// test_start pushes the necessary log information when the test module is starting, and implies configure.
// configure: should be called each time the set of loggers, stream or configuration is changed.
s_log_impl().m_active_log_formatter_data.clear();
for( unit_test_log_impl::v_formatter_data_t::iterator it(s_log_impl().m_log_formatter_data.begin()),
ite(s_log_impl().m_log_formatter_data.end());
it < ite;
++it)
{
if( !it->m_enabled || it->get_log_level() == log_nothing )
continue;
s_log_impl().m_active_log_formatter_data.push_back(&*it);
it->m_entry_in_progress = false;
}
}
//____________________________________________________________________________//
void
unit_test_log_t::test_start( counter_t test_cases_amount )
unit_test_log_t::test_start( counter_t test_cases_amount, test_unit_id )
{
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( !current_logger_data.m_enabled || current_logger_data.get_log_level() == log_nothing )
continue;
configure();
vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data;
for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = **it;
current_logger_data.m_log_formatter->log_start( current_logger_data.stream(), test_cases_amount );
current_logger_data.m_log_formatter->log_build_info(
current_logger_data.stream(),
runtime_config::get<bool>( runtime_config::btrt_build_info ));
//current_logger_data.stream().flush();
current_logger_data.m_entry_in_progress = false;
}
}
@@ -187,12 +244,11 @@ unit_test_log_t::test_start( counter_t test_cases_amount )
void
unit_test_log_t::test_finish()
{
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( !current_logger_data.m_enabled || current_logger_data.get_log_level() == log_nothing )
continue;
vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data;
for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = **it;
current_logger_data.m_log_formatter->log_finish( current_logger_data.stream() );
current_logger_data.stream().flush();
}
}
@@ -212,8 +268,12 @@ unit_test_log_t::test_unit_start( test_unit const& tu )
{
if( s_log_impl().has_entry_in_progress() )
*this << log::end();
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units )
vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data;
for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = **it;
if( current_logger_data.get_log_level() > log_test_units )
continue;
current_logger_data.m_log_formatter->test_unit_start( current_logger_data.stream(), tu );
}
@@ -229,9 +289,11 @@ unit_test_log_t::test_unit_finish( test_unit const& tu, unsigned long elapsed )
if( s_log_impl().has_entry_in_progress() )
*this << log::end();
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units )
vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data;
for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = **it;
if( current_logger_data.get_log_level() > log_test_units )
continue;
current_logger_data.m_log_formatter->test_unit_finish( current_logger_data.stream(), tu, elapsed );
@@ -246,8 +308,11 @@ unit_test_log_t::test_unit_skipped( test_unit const& tu, const_string reason )
if( s_log_impl().has_entry_in_progress() )
*this << log::end();
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units )
vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data;
for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = **it;
if( current_logger_data.get_log_level() > log_test_units )
continue;
current_logger_data.m_log_formatter->test_unit_skipped( current_logger_data.stream(), tu, reason );
@@ -260,8 +325,11 @@ unit_test_log_t::test_unit_aborted( test_unit const& tu )
if( s_log_impl().has_entry_in_progress() )
*this << log::end();
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units )
vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data;
for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = **it;
if( current_logger_data.get_log_level() > log_test_units )
continue;
current_logger_data.m_log_formatter->test_unit_aborted(current_logger_data.stream(), tu );
@@ -274,8 +342,11 @@ unit_test_log_t::test_unit_timed_out( test_unit const& tu )
if( s_log_impl().has_entry_in_progress() )
*this << log::end();
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units )
vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data;
for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = **it;
if( current_logger_data.get_log_level() > log_test_units )
continue;
current_logger_data.m_log_formatter->test_unit_timed_out(current_logger_data.stream(), tu );
@@ -295,13 +366,16 @@ unit_test_log_t::exception_caught( execution_exception const& ex )
if( s_log_impl().has_entry_in_progress() )
*this << log::end();
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data;
for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = **it;
if( current_logger_data.m_enabled && l >= current_logger_data.get_log_level() ) {
if( l >= current_logger_data.get_log_level() ) {
current_logger_data.m_log_formatter->log_exception_start( current_logger_data.stream(), s_log_impl().m_checkpoint_data, ex );
log_entry_context( l );
log_entry_context( l, current_logger_data );
current_logger_data.m_log_formatter->log_exception_finish( current_logger_data.stream() );
}
@@ -331,10 +405,11 @@ unit_test_log_t::operator<<( log::begin const& b )
if( s_log_impl().has_entry_in_progress() )
*this << log::end();
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( current_logger_data.m_enabled ) {
current_logger_data.m_stream_state_saver->restore();
}
vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data;
for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = **it;
current_logger_data.m_stream_state_saver->restore();
}
s_log_impl().m_entry_data.clear();
@@ -357,10 +432,15 @@ unit_test_log_t&
unit_test_log_t::operator<<( log::end const& )
{
if( s_log_impl().has_entry_in_progress() ) {
log_entry_context( s_log_impl().m_entry_data.m_level );
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( current_logger_data.m_enabled && current_logger_data.m_entry_in_progress ) {
vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data;
log_level l = s_log_impl().m_entry_data.m_level;
for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = **it;
if( current_logger_data.m_entry_in_progress ) {
if( l >= current_logger_data.get_log_level() ) {
log_entry_context( l, current_logger_data );
}
current_logger_data.m_log_formatter->log_entry_finish( current_logger_data.stream() );
}
current_logger_data.m_entry_in_progress = false;
@@ -395,53 +475,42 @@ unit_test_log_t::operator()( log_level l )
//____________________________________________________________________________//
bool
unit_test_log_t::log_entry_start(output_format log_format)
log_entry_start(unit_test_log_data_helper_impl &current_logger_data)
{
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( current_logger_data.m_format != log_format )
continue;
if( current_logger_data.m_entry_in_progress )
return true;
if( !current_logger_data.m_enabled )
return false;
switch( s_log_impl().m_entry_data.m_level ) {
case log_successful_tests:
current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data,
unit_test_log_formatter::BOOST_UTL_ET_INFO );
break;
case log_messages:
current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data,
unit_test_log_formatter::BOOST_UTL_ET_MESSAGE );
break;
case log_warnings:
current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data,
unit_test_log_formatter::BOOST_UTL_ET_WARNING );
break;
case log_all_errors:
case log_cpp_exception_errors:
case log_system_errors:
current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data,
unit_test_log_formatter::BOOST_UTL_ET_ERROR );
break;
case log_fatal_errors:
current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data,
unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR );
break;
case log_nothing:
case log_test_units:
case invalid_log_level:
return false;
}
current_logger_data.m_entry_in_progress = true;
if( current_logger_data.m_entry_in_progress )
return true;
switch( s_log_impl().m_entry_data.m_level ) {
case log_successful_tests:
current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data,
unit_test_log_formatter::BOOST_UTL_ET_INFO );
break;
case log_messages:
current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data,
unit_test_log_formatter::BOOST_UTL_ET_MESSAGE );
break;
case log_warnings:
current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data,
unit_test_log_formatter::BOOST_UTL_ET_WARNING );
break;
case log_all_errors:
case log_cpp_exception_errors:
case log_system_errors:
current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data,
unit_test_log_formatter::BOOST_UTL_ET_ERROR );
break;
case log_fatal_errors:
current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data,
unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR );
break;
case log_nothing:
case log_test_units:
case invalid_log_level:
return false;
}
return false;
current_logger_data.m_entry_in_progress = true;
return true;
}
//____________________________________________________________________________//
@@ -449,10 +518,18 @@ unit_test_log_t::log_entry_start(output_format log_format)
unit_test_log_t&
unit_test_log_t::operator<<( const_string value )
{
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( current_logger_data.m_enabled && s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() && !value.empty() && log_entry_start(current_logger_data.m_format) )
current_logger_data.m_log_formatter->log_entry_value( current_logger_data.stream(), value );
if(value.empty()) {
return *this;
}
vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data;
for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = **it;
if( s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() )
if( log_entry_start(current_logger_data) ) {
current_logger_data.m_log_formatter->log_entry_value( current_logger_data.stream(), value );
}
}
return *this;
}
@@ -462,9 +539,16 @@ unit_test_log_t::operator<<( const_string value )
unit_test_log_t&
unit_test_log_t::operator<<( lazy_ostream const& value )
{
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( current_logger_data.m_enabled && s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() && !value.empty() ) {
if( log_entry_start(current_logger_data.m_format) ) {
if(value.empty()) {
return *this;
}
vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data;
for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = **it;
if( s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() ) {
if( log_entry_start(current_logger_data) ) {
current_logger_data.m_log_formatter->log_entry_value( current_logger_data.stream(), value );
}
}
@@ -474,54 +558,17 @@ unit_test_log_t::operator<<( lazy_ostream const& value )
//____________________________________________________________________________//
void
unit_test_log_t::log_entry_context( log_level l )
{
framework::context_generator const& context = framework::get_context();
if( context.is_empty() )
return;
const_string frame;
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( current_logger_data.m_enabled ) {
current_logger_data.m_log_formatter->entry_context_start( current_logger_data.stream(), l );
}
}
while( !(frame=context.next()).is_empty() )
{
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( current_logger_data.m_enabled ) {
current_logger_data.m_log_formatter->log_entry_context( current_logger_data.stream(), l, frame );
}
}
}
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
if( current_logger_data.m_enabled ) {
current_logger_data.m_log_formatter->entry_context_finish( current_logger_data.stream(), l );
}
}
}
//____________________________________________________________________________//
void
unit_test_log_t::clear_entry_context()
{
framework::clear_context();
}
//____________________________________________________________________________//
void
unit_test_log_t::set_stream( std::ostream& str )
{
if( s_log_impl().has_entry_in_progress() )
return;
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
v_logger_t& vloggers = s_log_impl().m_log_formatter_data;
for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = *it;
current_logger_data.m_stream = &str;
current_logger_data.m_stream_state_saver.reset( new io_saver_type( str ) );
}
@@ -535,7 +582,10 @@ unit_test_log_t::set_stream( output_format log_format, std::ostream& str )
if( s_log_impl().has_entry_in_progress() )
return;
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
v_logger_t& vloggers = s_log_impl().m_log_formatter_data;
for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = *it;
if( current_logger_data.m_format == log_format) {
current_logger_data.m_stream = &str;
current_logger_data.m_stream_state_saver.reset( new io_saver_type( str ) );
@@ -547,7 +597,10 @@ unit_test_log_t::set_stream( output_format log_format, std::ostream& str )
std::ostream*
unit_test_log_t::get_stream( output_format log_format ) const
{
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
v_logger_t& vloggers = s_log_impl().m_log_formatter_data;
for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = *it;
if( current_logger_data.m_format == log_format) {
return current_logger_data.m_stream;
}
@@ -557,31 +610,43 @@ unit_test_log_t::get_stream( output_format log_format ) const
//____________________________________________________________________________//
void
log_level
unit_test_log_t::set_threshold_level( log_level lev )
{
if( s_log_impl().has_entry_in_progress() || lev == invalid_log_level )
return;
return invalid_log_level;
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
log_level ret = log_nothing;
v_logger_t& vloggers = s_log_impl().m_log_formatter_data;
for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = *it;
ret = (std::min)(ret, current_logger_data.m_log_formatter->get_log_level());
current_logger_data.m_log_formatter->set_log_level( lev );
}
return ret;
}
//____________________________________________________________________________//
void
log_level
unit_test_log_t::set_threshold_level( output_format log_format, log_level lev )
{
if( s_log_impl().has_entry_in_progress() || lev == invalid_log_level )
return;
return invalid_log_level;
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
log_level ret = log_nothing;
v_logger_t& vloggers = s_log_impl().m_log_formatter_data;
for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = *it;
if( current_logger_data.m_format == log_format) {
ret = current_logger_data.m_log_formatter->get_log_level();
current_logger_data.m_log_formatter->set_log_level( lev );
break;
}
}
return ret;
}
//____________________________________________________________________________//
@@ -592,7 +657,10 @@ unit_test_log_t::set_format( output_format log_format )
if( s_log_impl().has_entry_in_progress() )
return;
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
v_logger_t& vloggers = s_log_impl().m_log_formatter_data;
for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = *it;
current_logger_data.m_enabled = current_logger_data.m_format == log_format;
}
}
@@ -605,7 +673,10 @@ unit_test_log_t::add_format( output_format log_format )
if( s_log_impl().has_entry_in_progress() )
return;
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
v_logger_t& vloggers = s_log_impl().m_log_formatter_data;
for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = *it;
if( current_logger_data.m_format == log_format) {
current_logger_data.m_enabled = true;
break;
@@ -617,7 +688,11 @@ unit_test_log_t::add_format( output_format log_format )
unit_test_log_formatter*
unit_test_log_t::get_formatter( output_format log_format ) {
BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) {
v_logger_t& vloggers = s_log_impl().m_log_formatter_data;
for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
unit_test_log_data_helper_impl& current_logger_data = *it;
if( current_logger_data.m_format == log_format) {
return current_logger_data.m_log_formatter.get();
}
@@ -630,10 +705,8 @@ void
unit_test_log_t::add_formatter( unit_test_log_formatter* the_formatter )
{
// remove only user defined logger
for(unit_test_log_impl::v_formatter_data_t::iterator it(s_log_impl().m_log_formatter_data.begin()),
ite(s_log_impl().m_log_formatter_data.end());
it != ite;
++it)
v_logger_t& vloggers = s_log_impl().m_log_formatter_data;
for(v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
if( it->m_format == OF_CUSTOM_LOGGER) {
s_log_impl().m_log_formatter_data.erase(it);
@@ -642,21 +715,23 @@ unit_test_log_t::add_formatter( unit_test_log_formatter* the_formatter )
}
if( the_formatter ) {
s_log_impl().m_log_formatter_data.push_back( unit_test_log_data_helper_impl(the_formatter, OF_CUSTOM_LOGGER, true) );
s_log_impl().m_active_log_formatter_data.clear(); // otherwise dandling references
vloggers.push_back( unit_test_log_data_helper_impl(the_formatter, OF_CUSTOM_LOGGER, true) );
}
}
void
unit_test_log_t::set_formatter( unit_test_log_formatter* the_formatter )
{
if( s_log_impl().has_entry_in_progress() )
return;
// remove only user defined logger
log_level current_level = invalid_log_level;
std::ostream *current_stream = 0;
output_format previous_format = OF_INVALID;
for(unit_test_log_impl::v_formatter_data_t::iterator it(s_log_impl().m_log_formatter_data.begin()),
ite(s_log_impl().m_log_formatter_data.end());
it != ite;
++it)
v_logger_t& vloggers = s_log_impl().m_log_formatter_data;
for(v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it)
{
if( it->m_enabled ) {
if( current_level == invalid_log_level || it->m_format < previous_format || it->m_format == OF_CUSTOM_LOGGER) {
@@ -673,6 +748,8 @@ unit_test_log_t::set_formatter( unit_test_log_formatter* the_formatter )
set_threshold_level(OF_CUSTOM_LOGGER, current_level);
set_stream(OF_CUSTOM_LOGGER, *current_stream);
}
configure();
}
//____________________________________________________________________________//

View File

@@ -30,6 +30,7 @@
#include <boost/test/utils/basic_cstring/io.hpp>
// Boost
#include <boost/core/ignore_unused.hpp>
#include <boost/cstdlib.hpp>
// STL
@@ -67,15 +68,15 @@ private:
m_os << "\n";
}
virtual void visit( test_case const& tc ) { report_test_unit( tc ); }
virtual bool test_suite_start( test_suite const& ts )
void visit( test_case const& tc ) BOOST_OVERRIDE { report_test_unit( tc ); }
bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE
{
if( m_indent >= 0 )
report_test_unit( ts );
m_indent += 4;
return true;
}
virtual void test_suite_finish( test_suite const& )
void test_suite_finish( test_suite const& ) BOOST_OVERRIDE
{
m_indent -= 4;
}
@@ -132,11 +133,11 @@ private:
}
}
virtual void visit( test_case const& tc )
void visit( test_case const& tc ) BOOST_OVERRIDE
{
report_test_unit( tc );
}
virtual bool test_suite_start( test_suite const& ts )
bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE
{
if( ts.p_parent_id == INV_TEST_UNIT_ID )
m_os << "digraph G {rankdir=LR;\n";
@@ -147,7 +148,7 @@ private:
return true;
}
virtual void test_suite_finish( test_suite const& ts )
void test_suite_finish( test_suite const& ts ) BOOST_OVERRIDE
{
m_os << "}\n";
if( ts.p_parent_id == INV_TEST_UNIT_ID )
@@ -165,7 +166,7 @@ struct labels_collector : test_tree_visitor {
std::set<std::string> const& labels() const { return m_labels; }
private:
virtual bool visit( test_unit const& tu )
bool visit( test_unit const& tu ) BOOST_OVERRIDE
{
m_labels.insert( tu.p_labels->begin(), tu.p_labels->end() );
return true;
@@ -200,6 +201,7 @@ unit_test_main( init_unit_test_func init_func, int argc, char* argv[] )
int result_code = 0;
ut_detail::framework_shutdown_helper shutdown_helper;
boost::ignore_unused(shutdown_helper);
BOOST_TEST_I_TRY {

View File

@@ -108,7 +108,7 @@ void
xml_log_formatter::test_unit_skipped( std::ostream& ostr, test_unit const& tu, const_string reason )
{
ostr << "<" << tu_type_name( tu )
<< " name" << utils::attr_value() << tu.p_name
<< " name" << utils::attr_value() << tu.p_name.get()
<< " skipped" << utils::attr_value() << "yes"
<< " reason" << utils::attr_value() << reason
<< "/>";