Boost logo

Boost-Commit :

From: gennadiy.rozental_at_[hidden]
Date: 2007-10-18 03:14:58


Author: rogeeff
Date: 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
New Revision: 40148
URL: http://svn.boost.org/trac/boost/changeset/40148

Log:
fixed issue with num of exp failure calculation
mwerks port in execution_monitor.ipp
bug in init function invocation fixed
Text files modified:
   trunk/boost/test/detail/log_level.hpp | 2
   trunk/boost/test/detail/unit_test_parameters.hpp | 20
   trunk/boost/test/exception_safety.hpp | 2
   trunk/boost/test/execution_monitor.hpp | 52 +
   trunk/boost/test/framework.hpp | 24
   trunk/boost/test/impl/compiler_log_formatter.ipp | 2
   trunk/boost/test/impl/cpp_main.ipp | 11
   trunk/boost/test/impl/exception_safety.ipp | 4
   trunk/boost/test/impl/execution_monitor.ipp | 1192 ++++++++++++++++++++++++++-------------
   trunk/boost/test/impl/framework.ipp | 107 +--
   trunk/boost/test/impl/logged_expectations.ipp | 2
   trunk/boost/test/impl/results_reporter.ipp | 12
   trunk/boost/test/impl/test_tools.ipp | 60 -
   trunk/boost/test/impl/unit_test_log.ipp | 17
   trunk/boost/test/impl/unit_test_main.ipp | 43
   trunk/boost/test/impl/unit_test_monitor.ipp | 9
   trunk/boost/test/impl/unit_test_parameters.ipp | 56 +
   trunk/boost/test/impl/unit_test_suite.ipp | 136 +++-
   trunk/boost/test/included/unit_test.hpp | 5
   trunk/boost/test/interaction_based.hpp | 4
   trunk/boost/test/logged_expectations.hpp | 2
   trunk/boost/test/results_reporter.hpp | 2
   trunk/boost/test/test_tools.hpp | 81 --
   trunk/boost/test/unit_test.hpp | 10
   trunk/boost/test/unit_test_suite.hpp | 21
   trunk/boost/test/unit_test_suite_impl.hpp | 75 +-
   trunk/boost/test/utils/fixed_mapping.hpp | 2
   27 files changed, 1148 insertions(+), 805 deletions(-)

Modified: trunk/boost/test/detail/log_level.hpp
==============================================================================
--- trunk/boost/test/detail/log_level.hpp (original)
+++ trunk/boost/test/detail/log_level.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -26,7 +26,7 @@
 enum log_level {
     invalid_log_level = -1,
     log_successful_tests = 0,
- log_test_suites = 1,
+ log_test_units = 1,
     log_messages = 2,
     log_warnings = 3,
     log_all_errors = 4, // reported by unit test macros

Modified: trunk/boost/test/detail/unit_test_parameters.hpp
==============================================================================
--- trunk/boost/test/detail/unit_test_parameters.hpp (original)
+++ trunk/boost/test/detail/unit_test_parameters.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -43,6 +43,8 @@
 bool BOOST_TEST_DECL show_build_info();
 bool BOOST_TEST_DECL show_progress();
 bool BOOST_TEST_DECL catch_sys_errors();
+bool BOOST_TEST_DECL auto_start_dbg();
+bool BOOST_TEST_DECL use_alt_stack();
 output_format BOOST_TEST_DECL report_format();
 output_format BOOST_TEST_DECL log_format();
 long BOOST_TEST_DECL detect_memory_leaks();
@@ -62,24 +64,6 @@
 // Revision History :
 //
 // $Log$
-// Revision 1.24 2006/11/13 20:03:48 jhunold
-// Added missing export declarations.
-//
-// Revision 1.23 2006/01/30 07:29:49 rogeeff
-// split memory leaks detection API in two to get more functions with better defined roles
-//
-// Revision 1.22 2005/12/14 04:58:30 rogeeff
-// new parameter --break_exec_path introduced
-//
-// Revision 1.21 2005/04/05 06:11:37 rogeeff
-// memory leak allocation point detection\nextra help with _WIN32_WINNT
-//
-// Revision 1.20 2005/02/21 10:18:30 rogeeff
-// random cla support
-//
-// Revision 1.19 2005/02/20 08:27:06 rogeeff
-// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
-//
 // ***************************************************************************
 
 #endif // BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER

Modified: trunk/boost/test/exception_safety.hpp
==============================================================================
--- trunk/boost/test/exception_safety.hpp (original)
+++ trunk/boost/test/exception_safety.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -49,7 +49,7 @@
     boost::unit_test::make_test_case( \
         &BOOST_AUTO_TC_INVOKER( test_name ), #test_name ), \
     boost::unit_test::ut_detail::auto_tc_exp_fail< \
- BOOST_AUTO_TC_UNIQUE_ID( test_name )>::value ); \
+ BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value() ); \
                                                                         \
 void test_name::test_method() \
 /**/

Modified: trunk/boost/test/execution_monitor.hpp
==============================================================================
--- trunk/boost/test/execution_monitor.hpp (original)
+++ trunk/boost/test/execution_monitor.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -36,9 +36,11 @@
 #include <boost/test/detail/global_typedef.hpp>
 #include <boost/test/detail/fwd_decl.hpp>
 #include <boost/test/utils/callback.hpp>
+#include <boost/test/utils/class_properties.hpp>
 
 // Boost
 #include <boost/scoped_ptr.hpp>
+#include <boost/scoped_array.hpp>
 #include <boost/type.hpp>
 #include <boost/cstdlib.hpp>
 
@@ -131,14 +133,32 @@
 
 class BOOST_TEST_DECL execution_monitor {
 public:
- int execute( unit_test::callback0<int> const& F, bool catch_system_errors = true, int timeout = 0 );
- // The catch_system_errors parameter specifies whether the monitor should
+ // Constructor
+ execution_monitor()
+ : p_catch_system_errors( true )
+ , p_auto_start_dbg( false )
+ , p_timeout( 0 )
+ {}
+
+ // Public properties
+
+ // The p_catch_system_errors parameter specifies whether the monitor should
     // try to catch system errors/exceptions that would cause program to crash
     // in regular case
- // The timeout argument specifies the seconds that elapse before
+ unit_test::readwrite_property<bool> p_catch_system_errors;
+ // The p_auto_start_dbg parameter specifies whether the monitor should
+ // try to attach debugger in case of caught system error
+ unit_test::readwrite_property<bool> p_auto_start_dbg;
+ // The p_timeout parameter specifies the seconds that elapse before
     // a timer_error occurs. May be ignored on some platforms.
- //
- // Returns: Value returned by function().
+ unit_test::readwrite_property<int> p_timeout;
+ // The p_use_alt_stack parameter specifies whether the monitor should
+ // use alternative stack for the signal catching
+ unit_test::readwrite_property<int> p_use_alt_stack;
+
+
+ int execute( unit_test::callback0<int> const& F );
+ // Returns: Value returned by function call F().
     //
     // Effects: Calls executes supplied function F inside a try/catch block which also may
     // include other unspecified platform dependent error detection code.
@@ -154,10 +174,11 @@
 
 private:
     // implementation helpers
- int catch_signals( unit_test::callback0<int> const& F, bool catch_system_errors, int timeout );
+ int catch_signals( unit_test::callback0<int> const& F );
 
     // Data members
     boost::scoped_ptr<detail::translate_exception_base> m_custom_translators;
+ boost::scoped_array<char> m_alt_stack;
 }; // execution_monitor
 
 namespace detail {
@@ -200,19 +221,24 @@
 }
 
 // ************************************************************************** //
-// ************** detect_memory_leaks ************** //
+// ************** execution_aborted ************** //
 // ************************************************************************** //
 
-// turn on system memory leak detection
-void BOOST_TEST_DECL detect_memory_leaks( bool on_off );
-// break program execution on mem_alloc_order_num's allocation
-void BOOST_TEST_DECL break_memory_alloc( long mem_alloc_order_num );
+struct execution_aborted {};
 
 // ************************************************************************** //
-// ************** execution_aborted ************** //
+// ************** system_error ************** //
 // ************************************************************************** //
 
-struct BOOST_TEST_DECL execution_aborted {};
+class system_error {
+public:
+ // Constructor
+ system_error();
+
+ unit_test::readonly_property<long> p_errno;
+};
+
+#define BOOST_TEST_SYS_ASSERT( exp ) if( (exp) ) ; else throw ::boost::system_error()
 
 } // namespace boost
 

Modified: trunk/boost/test/framework.hpp
==============================================================================
--- trunk/boost/test/framework.hpp (original)
+++ trunk/boost/test/framework.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -32,13 +32,23 @@
 namespace unit_test {
 
 // ************************************************************************** //
+// ************** init_unit_test_func ************** //
+// ************************************************************************** //
+
+#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
+typedef bool (*init_unit_test_func)();
+#else
+typedef test_suite* (*init_unit_test_func)( int, char* [] );
+#endif
+
+// ************************************************************************** //
 // ************** framework ************** //
 // ************************************************************************** //
 
 namespace framework {
 
 // initialization
-BOOST_TEST_DECL void init( int argc, char* argv[] );
+BOOST_TEST_DECL void init( init_unit_test_func init_func, int argc, char* argv[] );
 
 // mutation access methods
 BOOST_TEST_DECL void register_test_unit( test_case* tc );
@@ -54,17 +64,17 @@
 BOOST_TEST_DECL test_case const& current_test_case();
 #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x530) )
 template<typename UnitType>
-UnitType const& get( test_unit_id id )
+UnitType& get( test_unit_id id )
 {
- return static_cast<UnitType const&>( get( id, (test_unit_type)UnitType::type ) );
+ return static_cast<UnitType&>( get( id, (test_unit_type)UnitType::type ) );
 }
-test_unit const& get( test_unit_id, test_unit_type );
+test_unit& get( test_unit_id, test_unit_type );
 #else
-test_unit const& get( test_unit_id, test_unit_type );
+test_unit& get( test_unit_id, test_unit_type );
 template<typename UnitType>
-UnitType const& get( test_unit_id id )
+UnitType& get( test_unit_id id )
 {
- return static_cast<UnitType const&>( get( id, (test_unit_type)UnitType::type ) );
+ return static_cast<UnitType&>( get( id, (test_unit_type)UnitType::type ) );
 }
 #endif
 

Modified: trunk/boost/test/impl/compiler_log_formatter.ipp
==============================================================================
--- trunk/boost/test/impl/compiler_log_formatter.ipp (original)
+++ trunk/boost/test/impl/compiler_log_formatter.ipp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -182,7 +182,7 @@
 
 //____________________________________________________________________________//
 
-} // namespace ouptut
+} // namespace output
 
 } // namespace unit_test
 

Modified: trunk/boost/test/impl/cpp_main.ipp
==============================================================================
--- trunk/boost/test/impl/cpp_main.ipp (original)
+++ trunk/boost/test/impl/cpp_main.ipp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -67,15 +67,16 @@
 int BOOST_TEST_DECL
 prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char* argv[] )
 {
- int result;
+ int result = 0;
 
- boost::unit_test::const_string p( std::getenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS" ) );
- bool catch_system_errors = p != "no";
-
     try {
+ boost::unit_test::const_string p( std::getenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS" ) );
         ::boost::execution_monitor ex_mon;
+
+ ex_mon.p_catch_system_errors.value = p != "no";
+
         result = ex_mon.execute(
- ::boost::unit_test::callback0<int>( cpp_main_caller( cpp_main, argc, argv ) ), catch_system_errors );
+ ::boost::unit_test::callback0<int>( cpp_main_caller( cpp_main, argc, argv ) ) );
         
         if( result == 0 )
             result = ::boost::exit_success;

Modified: trunk/boost/test/impl/exception_safety.ipp
==============================================================================
--- trunk/boost/test/impl/exception_safety.ipp (original)
+++ trunk/boost/test/impl/exception_safety.ipp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -126,7 +126,7 @@
 
     // test observer interface
     virtual void assertion_result( bool passed );
- virtual int priority() { return std::numeric_limits<int>::max(); } // we want this observer to run the last
+ virtual int priority() { return (std::numeric_limits<int>::max)(); } // we want this observer to run the last
 
 private:
     void failure_point();
@@ -493,7 +493,7 @@
         if( m_invairant_failed )
             formatter << " and ";
 
- formatter << m_memory_in_use.size() << " memory leak";
+ formatter << (unsigned int)m_memory_in_use.size() << " memory leak";
         if( m_memory_in_use.size() > 1 )
             formatter << 's';
     }

Modified: trunk/boost/test/impl/execution_monitor.ipp
==============================================================================
--- trunk/boost/test/impl/execution_monitor.ipp (original)
+++ trunk/boost/test/impl/execution_monitor.ipp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -30,54 +30,64 @@
 #include <boost/test/execution_monitor.hpp>
 
 // Boost
-#include <boost/cstdlib.hpp> // for exit codes
-#include <boost/config.hpp> // for workarounds
+#include <boost/cstdlib.hpp> // for exit codes
+#include <boost/config.hpp> // for workarounds
 
 // STL
-#include <string> // for std::string
-#include <new> // for std::bad_alloc
-#include <typeinfo> // for std::bad_cast, std::bad_typeid
-#include <exception> // for std::exception, std::bad_exception
-#include <stdexcept> // for std exception hierarchy
-#include <cstring> // for C string API
-#include <cassert> // for assert
-#include <cstddef> // for NULL
+#include <string> // for std::string
+#include <new> // for std::bad_alloc
+#include <typeinfo> // for std::bad_cast, std::bad_typeid
+#include <exception> // for std::exception, std::bad_exception
+#include <stdexcept> // for std exception hierarchy
+#include <cstring> // for C string API
+#include <cassert> // for assert
+#include <cstddef> // for NULL
+#include <cstdio> // for vsnprintf
+#include <cstdarg> // for varargs
 
 #ifdef BOOST_NO_STDC_NAMESPACE
 namespace std { using ::strlen; using ::strncat; }
 #endif
 
-// Microsoft + other compatible compilers such as Intel
-#if !defined(BOOST_DISABLE_WIN32) && \
- !defined(__BORLANDC__) && \
- (defined(_MSC_VER) && !defined(__COMO__)) || \
- (BOOST_WORKAROUND(__MWERKS__, >= 0x3000) && defined(__INTEL__))
-
-# define BOOST_MS_STRUCTURED_EXCEPTION_HANDLING
-
-# ifndef _WIN32_WINNT
-# ifdef _WINBASE_
-# pragma message("Debugger check disabled. Either define _WIN32_WINNT or include Boost.Test header in front of winbase.h")
-# else
-# define BOOST_TEST_DEBUGGER_CHECK
-# define _WIN32_WINNT 0x0400
-# endif
+#if defined(_WIN32) && !defined(BOOST_DISABLE_WIN32) && \
+ (!defined(__COMO__) && !defined(__MWERKS__) && !defined(__GNUC__) || \
+ BOOST_WORKAROUND(__MWERKS__, >= 0x3000))
+
+# define BOOST_SEH_BASED_SIGNAL_HANDLING
+
+# include <windows.h>
+# if defined(__MWERKS__)
+# include <eh.h>
+# include <cstdint>
+
+using std::uintptr_t;
 # endif
 
-# include <wtypes.h>
-# include <winbase.h>
-# include <excpt.h>
-# include <eh.h>
+// for the FP control routines
+#include <float.h>
 
-# if !defined(NDEBUG) && !defined(__MWERKS__) // __MWERKS__ does not seem to supply implementation of C runtime debug hooks, causing linking errors
-# define BOOST_MS_CRT_DEBUG_HOOKS
+# if !defined(NDEBUG) && defined(_MSC_VER)
+# define BOOST_TEST_USE_DEBUG_MS_CRT
 # include <crtdbg.h>
 # endif
 
-#elif (defined(__BORLANDC__) && defined(_Windows) && !defined(BOOST_DISABLE_WIN32))
+# if !BOOST_WORKAROUND(BOOST_MSVC, >= 1400 )
+
+typedef void* _invalid_parameter_handler;
+
+inline _invalid_parameter_handler
+_set_invalid_parameter_handler( _invalid_parameter_handler arg )
+{
+ return arg;
+}
+
+# endif
+
+# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0564))
+
+namespace { void _set_se_translator( void* ) {} }
 
-# define BOOST_MS_STRUCTURED_EXCEPTION_HANDLING
-# include <windows.h> // Borland 5.5.1 has its own way of doing things.
+# endif
 
 #elif defined(BOOST_HAS_SIGACTION)
 
@@ -87,228 +97,431 @@
 # include <signal.h>
 # include <setjmp.h>
 
+# if !defined(__CYGWIN__)
+# define BOOST_TEST_USE_ALT_STACK
+# endif
+
+# ifdef BOOST_TEST_USE_ALT_STACK
+# define BOOST_TEST_ALT_STACK_SIZE SIGSTKSZ
+# endif
+
 #else
 
 # define BOOST_NO_SIGNAL_HANDLING
 
 #endif
 
+#include <errno.h>
+
 #include <boost/test/detail/suppress_warnings.hpp>
 
 //____________________________________________________________________________//
 
 namespace boost {
 
-namespace detail {
+// ************************************************************************** //
+// ************** report_error ************** //
+// ************************************************************************** //
 
-using unit_test::const_string;
+namespace detail {
 
-// boost::execution_monitor::execute() calls boost::detail::report_error(...) to
-// report any caught exception and throw execution_exception
+#ifdef __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))
+# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) _vsnprintf( (a1), (a2), (a3), (a4) )
+#else
+# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) vsnprintf( (a1), (a2), (a3), (a4) )
+#endif
 
-const std::size_t REPORT_ERROR_BUFFER_SIZE = 512;
+static void
+report_error( execution_exception::error_code ec, char const* format, ... )
+{
+ static const int REPORT_ERROR_BUFFER_SIZE = 512;
+ static char buf[REPORT_ERROR_BUFFER_SIZE];
 
-static void report_error(
- execution_exception::error_code ec,
- const_string msg1, // first part of the message
- const_string msg2 = "" ); // second part of the message; sum length msg1 + msg2 should not
- // exceed REPORT_ERROR_BUFFER_SIZE; never concatenate messages
- // manually, cause it should work even in case of memory lack
+ va_list args;
+ va_start( args, format );
 
-//____________________________________________________________________________//
+ BOOST_TEST_VSNPRINTF( buf, sizeof(buf), format, args );
+ va_end( args );
 
-// Declaration for Microsoft structured exception handling (unix alternative - signal)
-#ifdef BOOST_MS_STRUCTURED_EXCEPTION_HANDLING
+ throw execution_exception( ec, buf );
+}
 
-// this class defined per the Microsoft structured exception documentation
-class ms_se_exception {
-public:
- // Constructor
- explicit ms_se_exception( unsigned int n )
- : m_se_id( n ) {}
+//____________________________________________________________________________//
 
- // Destructor
- ~ms_se_exception() {}
+template<typename Tr,typename Functor>
+inline int
+do_invoke( Tr const& tr, Functor const& F )
+{
+ return tr ? (*tr)( F ) : F();
+}
 
- // access methods
- unsigned int id() const { return m_se_id; }
+//____________________________________________________________________________//
 
-private:
- // Data members
- unsigned int m_se_id;
-};
+} // namespace detail
 
-//____________________________________________________________________________//
+#if defined(BOOST_SIGACTION_BASED_SIGNAL_HANDLING)
 
-void BOOST_TEST_CALL_DECL ms_se_trans_func( unsigned int id, _EXCEPTION_POINTERS* exps );
-void BOOST_TEST_CALL_DECL ms_se_forward_func( unsigned int id, _EXCEPTION_POINTERS* exps );
-static void report_ms_se_error( unsigned int id );
+// ************************************************************************** //
+// ************** Sigaction based signal handling ************** //
+// ************************************************************************** //
 
-//____________________________________________________________________________//
+namespace detail {
 
-// Declarations for unix-style signal handling
-#elif defined(BOOST_SIGACTION_BASED_SIGNAL_HANDLING)
+// ************************************************************************** //
+// ************** boost::detail::system_signal_exception ************** //
+// ************************************************************************** //
 
-class unix_signal_exception {
- typedef execution_exception::error_code error_code_type;
+class system_signal_exception {
 public:
     // Constructor
- unix_signal_exception( execution_exception::error_code ec, const_string em )
- : m_error_code( ec ), m_error_message( em ) {}
+ system_signal_exception()
+ : m_sig_info( 0 )
+ , m_context( 0 )
+ {}
 
- // Destructor
- ~unix_signal_exception() {}
+ // Access methods
+ void operator()( siginfo_t* i, void* c )
+ {
+ m_sig_info = i;
+ m_context = c;
+ }
+ void report() const;
 
- // access methods
- error_code_type error_code() const { return m_error_code; }
- const_string error_message() const { return m_error_message; }
 private:
     // Data members
- error_code_type m_error_code;
- const_string m_error_message;
+ siginfo_t* m_sig_info; // system signal detailed info
+ void* m_context; // signal context
 };
 
-#endif
-
 //____________________________________________________________________________//
 
-#if defined(BOOST_MS_CRT_DEBUG_HOOKS)
-
-int BOOST_TEST_CALL_DECL
-assert_reporting_function( int reportType, char* userMessage, int* retVal )
+void
+system_signal_exception::report() const
 {
- switch( reportType ) {
- case _CRT_ASSERT:
- detail::report_error( execution_exception::user_error, userMessage );
+ if( !m_sig_info )
+ return; // no error actually occur?
 
- return 1; // return value and retVal are not important since we never reach this line
- case _CRT_ERROR:
- detail::report_error( execution_exception::system_error, userMessage );
-
- return 1; // return value and retVal are not important since we never reach this line
- default:
- return 0; // use usual reporting method
+ if( m_sig_info->si_code <= 0 ) {
+ switch( m_sig_info->si_code ) {
+ case SI_USER:
+ report_error( execution_exception::system_error,
+ "signal: generated by kill() (or family); uid=%d; pid=%d",
+ (int)m_sig_info->si_uid, (int)m_sig_info->si_pid );
+ break;
+ case SI_QUEUE:
+ report_error( execution_exception::system_error,
+ "signal: sent by sigqueue()" );
+ break;
+ case SI_TIMER:
+ report_error( execution_exception::system_error,
+ "signal: the expiration of a timer set by timer_settimer()" );
+ break;
+ case SI_ASYNCIO:
+ report_error( execution_exception::system_error,
+ "signal: generated by the completion of an asynchronous I/O request" );
+ break;
+ case SI_MESGQ:
+ report_error( execution_exception::system_error,
+ "signal: generated by the the arrival of a message on an empty message queue" );
+ break;
+ }
     }
-}
+ else {
+ switch( m_sig_info->si_signo ) {
+ case SIGILL:
+ switch( m_sig_info->si_code ) {
+ case ILL_ILLOPC:
+ report_error( execution_exception::system_fatal_error,
+ "signal: illegal opcode; address of failing instruction: 0x%08lx",
+ m_sig_info->si_addr );
+ break;
+ case ILL_ILLOPN:
+ report_error( execution_exception::system_fatal_error,
+ "signal: illegal operand; address of failing instruction: 0x%08lx",
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ break;
+ }
+ break;
 
-#endif
+ case SIGFPE:
+ 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 );
+ break;
+ case FPE_INTOVF:
+ report_error( execution_exception::system_error,
+ "signal: integer overflow; address of failing instruction: 0x%08lx",
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ 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 );
+ break;
+ }
+ break;
 
-} // namespace detail
+ case SIGSEGV:
+ switch( m_sig_info->si_code ) {
+ 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 );
+ 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 );
+ break;
+ }
+ break;
 
-// ************************************************************************** //
-// ************** execution_monitor ************** //
-// ************************************************************************** //
+ case SIGBUS:
+ switch( m_sig_info->si_code ) {
+ 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 );
+ 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 );
+ 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 );
+ break;
+ }
+ break;
 
-int
-execution_monitor::execute( unit_test::callback0<int> const& F, bool catch_system_errors, int timeout )
-{
- using unit_test::const_string;
+ case SIGCHLD:
+ switch( m_sig_info->si_code ) {
+ case CLD_EXITED:
+ report_error( execution_exception::system_error,
+ "child has exited; pid: %d; uid: %d; exit value: %d",
+ (int)m_sig_info->si_uid, (int)m_sig_info->si_pid, (int)m_sig_info->si_status );
+ break;
+ case CLD_KILLED:
+ report_error( execution_exception::system_error,
+ "child was killed; pid: %d; uid: %d; exit value: %d",
+ (int)m_sig_info->si_uid, (int)m_sig_info->si_pid, (int)m_sig_info->si_status );
+ break;
+ case CLD_DUMPED:
+ report_error( execution_exception::system_error,
+ "child terminated abnormally; pid: %d; uid: %d; exit value: %d",
+ (int)m_sig_info->si_uid, (int)m_sig_info->si_pid, (int)m_sig_info->si_status );
+ break;
+ case CLD_TRAPPED:
+ report_error( execution_exception::system_error,
+ "traced child has trapped; pid: %d; uid: %d; exit value: %d",
+ (int)m_sig_info->si_uid, (int)m_sig_info->si_pid, (int)m_sig_info->si_status );
+ break;
+ case CLD_STOPPED:
+ report_error( execution_exception::system_error,
+ "child has stopped; pid: %d; uid: %d; exit value: %d",
+ (int)m_sig_info->si_uid, (int)m_sig_info->si_pid, (int)m_sig_info->si_status );
+ break;
+ case CLD_CONTINUED:
+ report_error( execution_exception::system_error,
+ "stopped child had continued; pid: %d; uid: %d; exit value: %d",
+ (int)m_sig_info->si_uid, (int)m_sig_info->si_pid, (int)m_sig_info->si_status );
+ break;
+ }
+ break;
 
-# ifdef BOOST_TEST_DEBUGGER_CHECK
- if( IsDebuggerPresent() )
- catch_system_errors = false;
-#endif
+#if !defined(__CYGWIN__)
 
-#if defined(BOOST_MS_STRUCTURED_EXCEPTION_HANDLING) && !defined(__BORLANDC__)
- if( catch_system_errors )
- _set_se_translator( detail::ms_se_trans_func );
- else
- _set_se_translator( detail::ms_se_forward_func );
-#endif
+ case SIGPOLL:
+ switch( m_sig_info->si_code ) {
+ case POLL_IN:
+ report_error( execution_exception::system_error,
+ "data input available; band event %d",
+ (int)m_sig_info->si_band );
+ break;
+ case POLL_OUT:
+ report_error( execution_exception::system_error,
+ "output buffers available; band event %d",
+ (int)m_sig_info->si_band );
+ break;
+ case POLL_MSG:
+ report_error( execution_exception::system_error,
+ "input message available; band event %d",
+ (int)m_sig_info->si_band );
+ break;
+ case POLL_ERR:
+ report_error( execution_exception::system_error,
+ "i/o error; band event %d",
+ (int)m_sig_info->si_band );
+ break;
+ case POLL_PRI:
+ report_error( execution_exception::system_error,
+ "high priority input available; band event %d",
+ (int)m_sig_info->si_band );
+ break;
+ case POLL_HUP:
+ report_error( execution_exception::system_error,
+ "device disconnected; band event %d",
+ (int)m_sig_info->si_band );
+ break;
+ }
+ break;
 
-#ifdef BOOST_MS_CRT_DEBUG_HOOKS
- if( catch_system_errors )
- _CrtSetReportHook( &detail::assert_reporting_function );
 #endif
 
- try {
- return catch_signals( F, catch_system_errors, timeout );
+ case SIGABRT:
+ report_error( execution_exception::system_error,
+ "signal: SIGABRT (application abort requested)" );
+ break;
+
+ case SIGALRM:
+ report_error( execution_exception::timeout_error,
+ "signal: SIGALRM (timeout while executing function)" );
+ break;
+
+ default:
+ report_error( execution_exception::system_error, "unrecognized signal" );
+ }
     }
+}
 
- // Catch-clause reference arguments are a bit different from function
- // arguments (ISO 15.3 paragraphs 18 & 19). Apparently const isn't
- // required. Programmers ask for const anyhow, so we supply it. That's
- // easier than answering questions about non-const usage.
+//____________________________________________________________________________//
 
- catch( char const* ex )
- { detail::report_error( execution_exception::cpp_exception_error, "C string: ", ex ); }
- catch( std::string const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::string: ", ex.c_str() ); }
+// ************************************************************************** //
+// ************** boost::detail::signal_action ************** //
+// ************************************************************************** //
 
- // std:: exceptions
+// Forward declaration
+extern "C" {
+static void execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context );
+static void execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context );
+}
 
- catch( std::bad_alloc const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::bad_alloc: ", ex.what() ); }
+class signal_action {
+ typedef struct sigaction* sigaction_ptr;
+public:
+ //Constructor
+ explicit signal_action( int sig, bool install, bool attach_dbg, char* alt_stack );
+ ~signal_action();
 
-#if BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
- catch( std::bad_cast const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::bad_cast" ); }
- catch( std::bad_typeid const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::bad_typeid" ); }
-#else
- catch( std::bad_cast const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::bad_cast: ", ex.what() ); }
- catch( std::bad_typeid const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::bad_typeid: ", ex.what() ); }
-#endif
+private:
+ // Data members
+ int m_sig;
+ bool m_installed;
+ struct sigaction m_new_action;
+ struct sigaction m_old_action;
+};
 
- catch( std::bad_exception const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::bad_exception: ", ex.what() ); }
- catch( std::domain_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::domain_error: ", ex.what() ); }
- catch( std::invalid_argument const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::invalid_argument: ", ex.what() ); }
- catch( std::length_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::length_error: ", ex.what() ); }
- catch( std::out_of_range const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::out_of_range: ", ex.what() ); }
- catch( std::range_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::range_error: ", ex.what() ); }
- catch( std::overflow_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::overflow_error: ", ex.what() ); }
- catch( std::underflow_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::underflow_error: ", ex.what() ); }
- catch( std::logic_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::logic_error: ", ex.what() ); }
- catch( std::runtime_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::runtime_error: ", ex.what() ); }
- catch( std::exception const& ex )
- { detail::report_error( execution_exception::cpp_exception_error, "std::exception: ", ex.what() ); }
+//____________________________________________________________________________//
 
-#if defined(BOOST_MS_STRUCTURED_EXCEPTION_HANDLING)
- catch( detail::ms_se_exception const& ex )
- { detail::report_ms_se_error( ex.id() ); }
-#elif defined(BOOST_SIGACTION_BASED_SIGNAL_HANDLING)
- catch( detail::unix_signal_exception const& ex )
- { detail::report_error( ex.error_code(), ex.error_message() ); }
-#endif // BOOST_SIGACTION_BASED_SIGNAL_HANDLING
+signal_action::signal_action( int sig, bool install, bool attach_dbg, char* alt_stack )
+: m_sig( sig )
+, m_installed( install )
+{
+ if( !install )
+ return;
 
- catch( execution_aborted const& )
- { return 0; }
+ std::memset( &m_new_action, 0, sizeof(struct sigaction) );
 
- catch( execution_exception const& )
- { throw; }
+ BOOST_TEST_SYS_ASSERT( ::sigaction( m_sig , sigaction_ptr(), &m_new_action ) != -1 );
 
- catch( ... )
- { detail::report_error( execution_exception::cpp_exception_error, "unknown type" ); }
+ if( m_new_action.sa_sigaction || m_new_action.sa_handler ) {
+ m_installed = false;
+ return;
+ }
 
- return 0; // never reached; supplied to quiet compiler warnings
-} // execute
+ m_new_action.sa_flags |= SA_SIGINFO;
+ m_new_action.sa_sigaction = attach_dbg ? &execution_monitor_attaching_signal_handler
+ : &execution_monitor_jumping_signal_handler;
+ BOOST_TEST_SYS_ASSERT( ::sigemptyset( &m_new_action.sa_mask ) != -1 );
+
+#ifdef BOOST_TEST_USE_ALT_STACK
+ if( alt_stack )
+ m_new_action.sa_flags |= SA_ONSTACK;
+#endif
+
+ BOOST_TEST_SYS_ASSERT( ::sigaction( m_sig, &m_new_action, &m_old_action ) != -1 );
+}
 
 //____________________________________________________________________________//
 
-#if defined(BOOST_SIGACTION_BASED_SIGNAL_HANDLING)
+signal_action::~signal_action()
+{
+ if( m_installed )
+ ::sigaction( m_sig, &m_old_action , sigaction_ptr() );
+}
+
+//____________________________________________________________________________//
 
 // ************************************************************************** //
-// ************** boost::detail::signal_handler ************** //
+// ************** boost::detail::signal_handler ************** //
 // ************************************************************************** //
 
-namespace detail {
-
 class signal_handler {
 public:
     // Constructor
- explicit signal_handler( bool catch_system_errors, int timeout );
+ explicit signal_handler( bool catch_system_errors, int timeout, bool attach_dbg, char* alt_stack );
 
     // Destructor
     ~signal_handler();
@@ -321,234 +534,257 @@
         return s_active_handler->m_sigjmp_buf;
     }
 
+ static system_signal_exception& sys_sig()
+ {
+ assert( !!s_active_handler );
+
+ return s_active_handler->m_sys_sig;
+ }
+
 private:
     // Data members
- struct sigaction m_same_action_for_all_signals;
- struct sigaction m_old_SIGFPE_action;
- struct sigaction m_old_SIGTRAP_action;
- struct sigaction m_old_SIGSEGV_action;
- struct sigaction m_old_SIGBUS_action;
- struct sigaction m_old_SIGABRT_action;
- struct sigaction m_old_SIGALRM_action;
+ signal_handler* m_prev_handler;
+ int m_timeout;
+
+ signal_action m_ILL_action;
+ signal_action m_FPE_action;
+ signal_action m_SEGV_action;
+ signal_action m_BUS_action;
+ signal_action m_CHLD_action;
+ signal_action m_POLL_action;
+ signal_action m_ABRT_action;
+ signal_action m_ALRM_action;
 
     sigjmp_buf m_sigjmp_buf;
+ system_signal_exception m_sys_sig;
 
- signal_handler* m_prev_handler;
     static signal_handler* s_active_handler;
-
- bool m_catch_system_errors;
- bool m_set_timeout;
 };
 
-signal_handler* signal_handler::s_active_handler = NULL; // !! need to be placed in thread specific storage
+// !! need to be placed in thread specific storage
+typedef signal_handler* signal_handler_ptr;
+signal_handler* signal_handler::s_active_handler = signal_handler_ptr();
 
 //____________________________________________________________________________//
 
-extern "C" {
-
-static void execution_monitor_signal_handler( int sig )
-{
- siglongjmp( signal_handler::jump_buffer(), sig );
-}
-
-}
-
-//____________________________________________________________________________//
-
-signal_handler::signal_handler( bool catch_system_errors, int timeout )
+signal_handler::signal_handler( bool catch_system_errors, int timeout, bool attach_dbg, char* alt_stack )
 : m_prev_handler( s_active_handler )
-, m_catch_system_errors( catch_system_errors )
-, m_set_timeout( timeout > 0 )
+, m_timeout( timeout )
+, m_ILL_action ( SIGILL , catch_system_errors, attach_dbg, alt_stack )
+, m_FPE_action ( SIGFPE , catch_system_errors, attach_dbg, alt_stack )
+, m_SEGV_action( SIGSEGV, catch_system_errors, attach_dbg, alt_stack )
+, m_BUS_action ( SIGBUS , catch_system_errors, attach_dbg, alt_stack )
+, m_CHLD_action( SIGCHLD, catch_system_errors, attach_dbg, alt_stack )
+, m_POLL_action( SIGPOLL, catch_system_errors, attach_dbg, alt_stack )
+, m_ABRT_action( SIGABRT, catch_system_errors, attach_dbg, alt_stack )
+, m_ALRM_action( SIGALRM, timeout > 0 , attach_dbg, alt_stack )
 {
     s_active_handler = this;
 
- if( m_catch_system_errors || m_set_timeout ) {
- m_same_action_for_all_signals.sa_flags = 0;
- m_same_action_for_all_signals.sa_handler = &execution_monitor_signal_handler;
- sigemptyset( &m_same_action_for_all_signals.sa_mask );
- }
-
- if( m_catch_system_errors ) {
- sigaction( SIGFPE , &m_same_action_for_all_signals, &m_old_SIGFPE_action );
- sigaction( SIGTRAP, &m_same_action_for_all_signals, &m_old_SIGTRAP_action );
- sigaction( SIGSEGV, &m_same_action_for_all_signals, &m_old_SIGSEGV_action );
- sigaction( SIGBUS , &m_same_action_for_all_signals, &m_old_SIGBUS_action );
- sigaction( SIGABRT, &m_same_action_for_all_signals, &m_old_SIGABRT_action );
- }
-
- if( m_set_timeout ) {
- sigaction( SIGALRM , &m_same_action_for_all_signals, &m_old_SIGALRM_action );
- alarm( timeout );
+ if( m_timeout > 0 ) {
+ ::alarm( 0 );
+ ::alarm( timeout );
     }
+
+#ifdef BOOST_TEST_USE_ALT_STACK
+ if( alt_stack ) {
+ stack_t sigstk;
+
+ BOOST_TEST_SYS_ASSERT( ::sigaltstack( 0, &sigstk ) != -1 );
+
+ if( sigstk.ss_flags & SS_DISABLE ) {
+ sigstk.ss_sp = alt_stack;
+ sigstk.ss_size = BOOST_TEST_ALT_STACK_SIZE;
+ sigstk.ss_flags = 0;
+ BOOST_TEST_SYS_ASSERT( ::sigaltstack( &sigstk, 0 ) != -1 );
+ }
+ }
+#endif
 }
 
 //____________________________________________________________________________//
 
 signal_handler::~signal_handler()
 {
- typedef struct sigaction* sigaction_ptr;
-
     assert( s_active_handler == this );
 
- if( m_set_timeout ) {
- alarm( 0 );
- sigaction( SIGALRM, &m_old_SIGALRM_action, sigaction_ptr() );
- }
+ if( m_timeout > 0 )
+ ::alarm( 0 );
 
- if( m_catch_system_errors ) {
- sigaction( SIGFPE , &m_old_SIGFPE_action , sigaction_ptr() );
- sigaction( SIGTRAP, &m_old_SIGTRAP_action, sigaction_ptr() );
- sigaction( SIGSEGV, &m_old_SIGSEGV_action, sigaction_ptr() );
- sigaction( SIGBUS , &m_old_SIGBUS_action , sigaction_ptr() );
- sigaction( SIGABRT, &m_old_SIGABRT_action, sigaction_ptr() );
- }
+#ifdef BOOST_TEST_USE_ALT_STACK
+ stack_t sigstk;
+
+ sigstk.ss_flags = SS_DISABLE;
+ BOOST_TEST_SYS_ASSERT( ::sigaltstack( &sigstk, 0 ) != -1 );
+#endif
 
     s_active_handler = m_prev_handler;
 }
 
 //____________________________________________________________________________//
 
-} // namespace detail
-
 // ************************************************************************** //
-// ************** execution_monitor::catch_signals ************** //
+// ************** execution_monitor_signal_handler ************** //
 // ************************************************************************** //
 
-int
-execution_monitor::catch_signals( unit_test::callback0<int> const& F, bool catch_system_errors, int timeout )
-{
- using namespace detail;
+extern "C" {
 
- signal_handler local_signal_handler( catch_system_errors, timeout );
+static void execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context )
+{
+ signal_handler::sys_sig()( info, context );
 
- volatile int sigtype = sigsetjmp( signal_handler::jump_buffer(), 1 );
+ siglongjmp( signal_handler::jump_buffer(), sig );
+}
 
- typedef execution_exception::error_code ec_type;
- int result = 0;
- ec_type ec = execution_exception::no_error;
- const_string em;
+//____________________________________________________________________________//
 
- if( sigtype == 0 ) {
- result = m_custom_translators ? (*m_custom_translators)( F ) : F();
- }
- else {
- switch(sigtype) {
- case SIGALRM:
- ec = execution_exception::timeout_error;
- em = BOOST_TEST_L( "signal: SIGALRM (timeout while executing function)" );
- break;
- case SIGTRAP:
- ec = execution_exception::system_error;
- em = BOOST_TEST_L( "signal: SIGTRAP (perhaps integer divide by zero)" );
- break;
- case SIGFPE:
- ec = execution_exception::system_error;
- em = BOOST_TEST_L( "signal: SIGFPE (arithmetic exception)" );
- break;
- case SIGABRT:
- ec = execution_exception::system_error;
- em = BOOST_TEST_L( "signal: SIGABRT (application abort requested)" );
- break;
- case SIGSEGV:
- case SIGBUS:
- ec = execution_exception::system_fatal_error;
- em = BOOST_TEST_L( "memory access violation" );
- break;
- default:
- ec = execution_exception::system_error;
- em = BOOST_TEST_L( "unrecognized signal" );
- }
- }
+static void execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context )
+{
+ execution_monitor_jumping_signal_handler( sig, info, context );
+}
 
- if( ec != execution_exception::no_error )
- throw unix_signal_exception( ec, em );
+//____________________________________________________________________________//
 
- return result;
-} // unix catch_signals
+}
 
-//____________________________________________________________________________//
+} // namespace detail
 
-#elif (defined(__BORLANDC__) && defined(_Windows) && !defined(BOOST_DISABLE_WIN32))
+// ************************************************************************** //
+// ************** execution_monitor::catch_signals ************** //
+// ************************************************************************** //
 
-// this works for Borland but not other Win32 compilers (which trap too many cases)
 int
-execution_monitor::catch_signals( unit_test::callback0<int> const& F, bool catch_system_errors, int )
+execution_monitor::catch_signals( unit_test::callback0<int> const& F )
 {
- int result;
-
- if( catch_system_errors ) {
- __try { result = m_custom_translators ? (*m_custom_translators)( F ) : F(); }
+ using namespace detail;
 
- __except (1) {
- throw detail::ms_se_exception( GetExceptionCode() );
- }
- }
- else
- result = m_custom_translators ? (*m_custom_translators)( F ) : F();
+#if defined(__CYGWIN__)
+ p_catch_system_errors.value = false;
+#endif
 
- return result;
-}
+#ifdef BOOST_TEST_USE_ALT_STACK
+ if( !!p_use_alt_stack && !m_alt_stack )
+ m_alt_stack.reset( new char[BOOST_TEST_ALT_STACK_SIZE] );
+#else
+ p_use_alt_stack.value = false;
+#endif
 
-#else // default signal handler
+ signal_handler local_signal_handler( p_catch_system_errors, p_timeout, p_auto_start_dbg,
+ !p_use_alt_stack ? 0 : m_alt_stack.get() );
 
-int
-execution_monitor::catch_signals( unit_test::callback0<int> const& F, bool, int )
-{
- return m_custom_translators ? (*m_custom_translators)( F ) : F();
+ if( !sigsetjmp( signal_handler::jump_buffer(), 1 ) )
+ return detail::do_invoke( m_custom_translators , F );
+ else
+ throw local_signal_handler.sys_sig();
 }
 
-#endif // choose signal handler
+//____________________________________________________________________________//
+
+#elif defined(BOOST_SEH_BASED_SIGNAL_HANDLING)
 
 // ************************************************************************** //
 // ************** Microsoft structured exception handling ************** //
 // ************************************************************************** //
 
-#if defined(BOOST_MS_STRUCTURED_EXCEPTION_HANDLING)
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0564))
+namespace { void _set_se_translator( void* ) {} }
+#endif
 
 namespace detail {
 
-void BOOST_TEST_CALL_DECL
-ms_se_trans_func( unsigned int id, _EXCEPTION_POINTERS* /* exps */ )
-{
- throw ms_se_exception( id );
-}
+// ************************************************************************** //
+// ************** boost::detail::system_signal_exception ************** //
+// ************************************************************************** //
+
+class system_signal_exception {
+public:
+ // Constructor
+ explicit system_signal_exception( execution_monitor* em )
+ : m_em( em )
+ , m_se_id( 0 )
+ , m_fault_address( 0 )
+ , m_dir( false )
+ {}
+
+ // access methods
+ static void seh_catch_preventer( unsigned int /* id */, _EXCEPTION_POINTERS* /* exps */ )
+ {
+ throw;
+ }
+
+ void report() const;
+ int operator()( unsigned int id, _EXCEPTION_POINTERS* exps );
+
+private:
+ // Data members
+ execution_monitor* m_em;
+
+ unsigned int m_se_id;
+ void* m_fault_address;
+ bool m_dir;
+};
 
 //____________________________________________________________________________//
 
-void BOOST_TEST_CALL_DECL
-ms_se_forward_func( unsigned int /* id */, _EXCEPTION_POINTERS* /* exps */ )
+int
+system_signal_exception::operator()( unsigned int id, _EXCEPTION_POINTERS* exps )
 {
- throw;
+ const unsigned int MSFT_CPP_EXCEPT = 0xE06d7363; // EMSC
+
+ if( !m_em->p_catch_system_errors || (id == MSFT_CPP_EXCEPT) )
+ return EXCEPTION_CONTINUE_SEARCH;
+
+ m_se_id = id;
+ if( m_se_id == EXCEPTION_ACCESS_VIOLATION && exps->ExceptionRecord->NumberParameters == 2 ) {
+ m_fault_address = (void*)exps->ExceptionRecord->ExceptionInformation[1];
+ m_dir = exps->ExceptionRecord->ExceptionInformation[0] == 0;
+ }
+
+ return EXCEPTION_EXECUTE_HANDLER;
 }
 
 //____________________________________________________________________________//
 
 void
-report_ms_se_error( unsigned int id )
+system_signal_exception::report() const
 {
- switch( id ) {
- // cases classified as fatal_system_error
- case EXCEPTION_ACCESS_VIOLATION:
- detail::report_error( execution_exception::system_fatal_error, "memory access violation" );
+ switch( m_se_id ) {
+ // cases classified as system_fatal_error
+ case EXCEPTION_ACCESS_VIOLATION: {
+ if( !m_fault_address )
+ detail::report_error( execution_exception::system_fatal_error, "memory access violation" );
+ else
+ detail::report_error(
+ execution_exception::system_fatal_error,
+ "memory access violation occurred at address 0x%08lx, while attempting to %s",
+ m_fault_address,
+ m_dir ? " read inaccessible data"
+ : " write to an inaccessible (or protected) address"
+ );
         break;
+ }
 
     case EXCEPTION_ILLEGAL_INSTRUCTION:
         detail::report_error( execution_exception::system_fatal_error, "illegal instruction" );
         break;
 
     case EXCEPTION_PRIV_INSTRUCTION:
- detail::report_error( execution_exception::system_fatal_error, "privileged instruction" );
+ detail::report_error( execution_exception::system_fatal_error, "tried to execute an instruction whose operation is not allowed in the current machine mode" );
         break;
 
     case EXCEPTION_IN_PAGE_ERROR:
- detail::report_error( execution_exception::system_fatal_error, "memory page error" );
+ detail::report_error( execution_exception::system_fatal_error, "access to a memory page that is not present" );
         break;
 
     case EXCEPTION_STACK_OVERFLOW:
         detail::report_error( execution_exception::system_fatal_error, "stack overflow" );
         break;
 
- // cases classified as (non-fatal) system_trap
+ case EXCEPTION_NONCONTINUABLE_EXCEPTION:
+ detail::report_error( execution_exception::system_fatal_error, "tried to continue execution after a non continuable exception occurred" );
+ break;
+
+ // cases classified as (non-fatal) system_trap
     case EXCEPTION_DATATYPE_MISALIGNMENT:
         detail::report_error( execution_exception::system_error, "data misalignment" );
         break;
@@ -570,45 +806,108 @@
         break;
 
     case EXCEPTION_FLT_STACK_CHECK:
- detail::report_error( execution_exception::system_error, "floating point stack check" );
+ detail::report_error( execution_exception::system_error,
+ "stack overflowed or underflowed as the result of a floating-point operation" );
         break;
 
     case EXCEPTION_FLT_DENORMAL_OPERAND:
+ detail::report_error( execution_exception::system_error,
+ "operand of floating point operation is denormal" );
+ break;
+
+# if 0 // !! ??
     case EXCEPTION_FLT_INEXACT_RESULT:
- case EXCEPTION_FLT_INVALID_OPERATION:
+ detail::report_error( execution_exception::system_error,
+ "result of a floating-point operation cannot be represented exactly" );
+ break;
+#endif
+
     case EXCEPTION_FLT_OVERFLOW:
+ detail::report_error( execution_exception::system_error,
+ "exponent of a floating-point operation is greater than the magnitude allowed by the corresponding type" );
+ break;
+
     case EXCEPTION_FLT_UNDERFLOW:
+ detail::report_error( execution_exception::system_error,
+ "exponent of a floating-point operation is less than the magnitude allowed by the corresponding type" );
+ break;
+
+ case EXCEPTION_FLT_INVALID_OPERATION:
         detail::report_error( execution_exception::system_error, "floating point error" );
         break;
 
+ case EXCEPTION_BREAKPOINT:
+ detail::report_error( execution_exception::system_error, "breakpoint encountered" );
+ break;
+
     default:
- detail::report_error( execution_exception::system_error, "unrecognized exception or signal" );
+ detail::report_error( execution_exception::system_error, "unrecognized exception. Id: 0x%08lx", m_se_id );
         break;
- } // switch
-} // report_ms_se_error
+ }
+}
 
 //____________________________________________________________________________//
 
-} // namespace detail
-
-#endif // Microsoft structured exception handling
+#if defined(BOOST_TEST_USE_DEBUG_MS_CRT)
 
 // ************************************************************************** //
-// ************** report_error ************** //
+// ************** assert_reporting_function ************** //
 // ************************************************************************** //
 
-namespace detail {
+int BOOST_TEST_CALL_DECL
+assert_reporting_function( int reportType, char* userMessage, int* retVal )
+{
+ switch( reportType ) {
+ case _CRT_ASSERT:
+ detail::report_error( execution_exception::user_error, userMessage );
+
+ return 1; // return value and retVal are not important since we never reach this line
+ case _CRT_ERROR:
+ detail::report_error( execution_exception::system_error, userMessage );
+
+ return 1; // return value and retVal are not important since we never reach this line
+ default:
+ return 0; // use usual reporting method
+ }
+} // assert_reporting_function
+
+#endif
+
+//____________________________________________________________________________//
 
-static void report_error( execution_exception::error_code ec, const_string msg1, const_string msg2 )
+void BOOST_TEST_CALL_DECL
+invalid_param_handler( wchar_t const* /* expr */,
+ wchar_t const* /* func */,
+ wchar_t const* /* file */,
+ unsigned int /* line */,
+ uintptr_t /* reserved */)
 {
- static char buf[REPORT_ERROR_BUFFER_SIZE];
+ detail::report_error( execution_exception::user_error,
+ "Invalid parameter detected by C runtime library" );
+}
 
- buf[0] = '\0';
+//____________________________________________________________________________//
 
- std::strncat( buf, msg1.begin(), sizeof(buf)-1 );
- std::strncat( buf, msg2.begin(), sizeof(buf) - msg1.size() - 1 );
+void BOOST_TEST_CALL_DECL
+switch_fp_exceptions( bool on_off )
+{
+ if( !on_off )
+ _clearfp();
 
- throw execution_exception( ec, buf );
+ int cw = ::_controlfp( 0, 0 );
+
+ int exceptions_mask = _EM_INVALID|_EM_DENORMAL|_EM_ZERODIVIDE|_EM_OVERFLOW|_EM_UNDERFLOW;
+
+ if( on_off )
+ cw &= ~exceptions_mask; // Set the exception masks on, turn exceptions off
+ else
+ cw |= exceptions_mask; // Set the exception masks off, turn exceptions on
+
+ if( on_off )
+ _clearfp();
+
+ // Set the control word
+ ::_controlfp( cw, _MCW_EM );
 }
 
 //____________________________________________________________________________//
@@ -616,41 +915,159 @@
 } // namespace detail
 
 // ************************************************************************** //
-// ************** detect_memory_leaks ************** //
+// ************** execution_monitor::catch_signals ************** //
 // ************************************************************************** //
 
-void
-detect_memory_leaks( bool on_off )
+int
+execution_monitor::catch_signals( unit_test::callback0<int> const& F )
 {
- unit_test::ut_detail::ignore_unused_variable_warning( on_off );
+ _invalid_parameter_handler old_iph;
 
-#ifdef BOOST_MS_CRT_DEBUG_HOOKS
- int flags = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
+ if( !p_catch_system_errors )
+ _set_se_translator( &detail::system_signal_exception::seh_catch_preventer );
+ else {
+ detail::switch_fp_exceptions( true );
 
- if( !on_off )
- flags &= ~_CRTDBG_LEAK_CHECK_DF;
- else {
- flags |= _CRTDBG_LEAK_CHECK_DF;
- _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
- _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
+#ifdef BOOST_TEST_USE_DEBUG_MS_CRT
+ _CrtSetReportHook( &detail::assert_reporting_function );
+#endif
+
+ old_iph = _set_invalid_parameter_handler(
+ reinterpret_cast<_invalid_parameter_handler>( &detail::invalid_param_handler ) );
     }
 
- _CrtSetDbgFlag ( flags );
-#endif // BOOST_MS_CRT_DEBUG_HOOKS
+ detail::system_signal_exception SSE( this );
+
+ __try {
+ __try {
+ return detail::do_invoke( m_custom_translators , F );
+ }
+ __except( SSE( GetExceptionCode(), GetExceptionInformation() ) ) {
+ throw SSE;
+ }
+ }
+ __finally {
+ if( !!p_catch_system_errors ) {
+ detail::switch_fp_exceptions( false );
+
+ _set_invalid_parameter_handler( old_iph );
+
+ }
+ }
+
+ return 0;
 }
 
 //____________________________________________________________________________//
 
-void
-break_memory_alloc( long mem_alloc_order_num )
-{
- unit_test::ut_detail::ignore_unused_variable_warning( mem_alloc_order_num );
+#else // default signal handler
+
+namespace detail {
 
-#ifdef BOOST_MS_CRT_DEBUG_HOOKS
- _CrtSetBreakAlloc( mem_alloc_order_num );
-#endif // BOOST_MS_CRT_DEBUG_HOOKS
+class system_signal_exception {
+public:
+ void report() const {}
+};
+
+} // namespace detail
+
+int
+execution_monitor::catch_signals( unit_test::callback0<int> const& F )
+{
+ return detail::do_invoke( m_custom_translators , F );
 }
 
+//____________________________________________________________________________//
+
+#endif // choose signal handler
+
+// ************************************************************************** //
+// ************** execution_monitor::execute ************** //
+// ************************************************************************** //
+
+int
+execution_monitor::execute( unit_test::callback0<int> const& F )
+{
+ try {
+ return catch_signals( F );
+ }
+
+ // Catch-clause reference arguments are a bit different from function
+ // arguments (ISO 15.3 paragraphs 18 & 19). Apparently const isn't
+ // required. Programmers ask for const anyhow, so we supply it. That's
+ // easier than answering questions about non-const usage.
+
+ catch( char const* ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "C string: %s", ex ); }
+ catch( std::string const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::string: %s", ex.c_str() ); }
+
+ // std:: exceptions
+
+ catch( std::bad_alloc const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::bad_alloc: %s", ex.what() ); }
+
+#if BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
+ catch( std::bad_cast const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::bad_cast" ); }
+ catch( std::bad_typeid const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::bad_typeid" ); }
+#else
+ catch( std::bad_cast const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::bad_cast: %s", ex.what() ); }
+ catch( std::bad_typeid const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::bad_typeid: %s", ex.what() ); }
+#endif
+
+ catch( std::bad_exception const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::bad_exception: %s", ex.what() ); }
+ catch( std::domain_error const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::domain_error: %s", ex.what() ); }
+ catch( std::invalid_argument const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::invalid_argument: %s", ex.what() ); }
+ catch( std::length_error const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::length_error: %s", ex.what() ); }
+ catch( std::out_of_range const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::out_of_range: %s", ex.what() ); }
+ catch( std::range_error const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::range_error: %s", ex.what() ); }
+ catch( std::overflow_error const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::overflow_error: %s", ex.what() ); }
+ catch( std::underflow_error const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::underflow_error: %s", ex.what() ); }
+ catch( std::logic_error const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::logic_error: %s", ex.what() ); }
+ catch( std::runtime_error const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::runtime_error: %s", ex.what() ); }
+ catch( std::exception const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "std::exception: %s", ex.what() ); }
+ catch( system_error const& ex )
+ { detail::report_error( execution_exception::cpp_exception_error, "system_error: %s", std::strerror( ex.p_errno ) ); }
+ catch( detail::system_signal_exception const& ex )
+ { ex.report(); }
+ catch( execution_aborted const& )
+ { return 0; }
+ catch( execution_exception const& )
+ { throw; }
+
+ catch( ... )
+ { detail::report_error( execution_exception::cpp_exception_error, "unknown type" ); }
+
+ return 0; // never reached; supplied to quiet compiler warnings
+} // execute
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** system_error ************** //
+// ************************************************************************** //
+
+system_error::system_error()
+: p_errno( errno )
+{}
+
+//____________________________________________________________________________//
+
 } // namespace boost
 
 //____________________________________________________________________________//
@@ -661,51 +1078,6 @@
 // Revision History :
 //
 // $Log$
-// Revision 1.13 2006/02/22 16:14:45 rogeeff
-// reagance to eliminate warning
-//
-// Revision 1.12 2006/01/30 07:29:49 rogeeff
-// split memory leaks detection API in two to get more functions with better defined roles
-//
-// Revision 1.11 2006/01/15 09:47:43 rogeeff
-// make common message
-//
-// Revision 1.10 2005/12/14 05:52:49 rogeeff
-// *** empty log message ***
-//
-// Revision 1.9 2005/04/30 17:07:22 rogeeff
-// ignore_warning included
-//
-// Revision 1.8 2005/04/30 16:46:50 rogeeff
-// warning suppressed
-//
-// Revision 1.7 2005/04/13 05:32:03 rogeeff
-// typo fix
-//
-// Revision 1.6 2005/04/05 06:11:37 rogeeff
-// memory leak allocation point detection\nextra help with _WIN32_WINNT
-//
-// Revision 1.5 2005/02/20 08:27:07 rogeeff
-// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
-//
-// Revision 1.4 2005/02/01 06:40:07 rogeeff
-// copyright update
-// old log entries removed
-// minor stilistic changes
-// depricated tools removed
-//
-// Revision 1.3 2005/01/31 07:50:06 rogeeff
-// cdecl portability fix
-//
-// Revision 1.2 2005/01/31 05:58:03 rogeeff
-// detect_memory_leak feature added
-//
-// Revision 1.1 2005/01/22 19:22:12 rogeeff
-// implementation moved into headers section to eliminate dependency of included/minimal component on src directory
-//
-// Revision 1.36 2005/01/21 07:21:38 rogeeff
-// detect presence of debugger under VC and automatically prevent catching system errors
-//
 // ***************************************************************************
 
 #endif // BOOST_TEST_EXECUTION_MONITOR_IPP_012205GER

Modified: trunk/boost/test/impl/framework.ipp
==============================================================================
--- trunk/boost/test/impl/framework.ipp (original)
+++ trunk/boost/test/impl/framework.ipp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -49,17 +49,6 @@
 
 //____________________________________________________________________________//
 
-#ifndef BOOST_TEST_DYN_LINK
-
-// prototype for user's unit test init function
-#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
-extern bool init_unit_test();
-#else
-extern boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] );
-#endif
-
-#endif
-
 namespace boost {
 
 namespace unit_test {
@@ -88,6 +77,30 @@
     counter_t m_tc_amount;
 };
 
+//____________________________________________________________________________//
+
+struct test_init_caller {
+ explicit test_init_caller( init_unit_test_func init_func )
+ : m_init_func( init_func )
+ {}
+ int operator()()
+ {
+#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
+ if( !(*m_init_func)() )
+ throw std::runtime_error( "test module initialization failed" );
+#else
+ test_suite* manual_test_units = (*m_init_func)( framework::master_test_suite().argc, framework::master_test_suite().argv );
+
+ if( manual_test_units )
+ framework::master_test_suite().add( manual_test_units );
+#endif
+ return 0;
+ }
+
+ // Data members
+ init_unit_test_func m_init_func;
+};
+
 }
 
 // ************************************************************************** //
@@ -179,7 +192,7 @@
         }
     };
 
- typedef std::map<test_unit_id,test_unit const*> test_unit_store;
+ typedef std::map<test_unit_id,test_unit*> test_unit_store;
     typedef std::set<test_observer*,priority_order> observer_store;
 
     master_test_suite_t* m_master_test_suite;
@@ -207,15 +220,15 @@
 namespace framework {
 
 void
-init( int argc, char* argv[] )
+init( init_unit_test_func init_func, int argc, char* argv[] )
 {
     runtime_config::init( &argc, argv );
 
- // set the log level nad format
+ // set the log level and format
     unit_test_log.set_threshold_level( runtime_config::log_level() );
     unit_test_log.set_format( runtime_config::log_format() );
 
- // set the report level nad format
+ // set the report level and format
     results_reporter::set_level( runtime_config::report_level() );
     results_reporter::set_format( runtime_config::report_format() );
 
@@ -226,27 +239,24 @@
         register_observer( progress_monitor );
 
     if( runtime_config::detect_memory_leaks() > 0 ) {
- detect_memory_leaks( true );
- break_memory_alloc( runtime_config::detect_memory_leaks() );
+// detect_memory_leaks( true );
+// break_memory_alloc( runtime_config::detect_memory_leaks() );
     }
 
     // init master unit test suite
     master_test_suite().argc = argc;
     master_test_suite().argv = argv;
 
-#ifndef BOOST_TEST_DYN_LINK
-
-#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
- if( !init_unit_test() )
- throw setup_error( BOOST_TEST_L("test tree initialization error" ) );
-#else
- test_suite* s = init_unit_test_suite( argc, argv );
- if( s )
- master_test_suite().add( s );
-#endif
+ try {
+ boost::execution_monitor em;
 
-#endif
+ ut_detail::test_init_caller tic( init_func );
 
+ em.execute( tic );
+ }
+ catch( execution_exception const& ex ) {
+ throw setup_error( ex.what() );
+ }
 }
 
 //____________________________________________________________________________//
@@ -335,10 +345,10 @@
 
 //____________________________________________________________________________//
 
-test_unit const&
+test_unit&
 get( test_unit_id id, test_unit_type t )
 {
- test_unit const* res = s_frk_impl().m_test_units[id];
+ test_unit* res = s_frk_impl().m_test_units[id];
 
     if( (res->p_type & t) == 0 )
         throw internal_error( "Invalid test unit type" );
@@ -454,41 +464,4 @@
 
 #include <boost/test/detail/enable_warnings.hpp>
 
-// ***************************************************************************
-// Revision History :
-//
-// $Log$
-// Revision 1.10 2006/03/19 07:27:52 rogeeff
-// streamline test setup error message
-//
-// Revision 1.9 2006/01/30 07:29:49 rogeeff
-// split memory leaks detection API in two to get more functions with better defined roles
-//
-// Revision 1.8 2005/12/17 02:34:11 rogeeff
-// *** empty log message ***
-//
-// Revision 1.7 2005/12/14 05:35:57 rogeeff
-// DLL support implemented
-// Alternative init API introduced
-//
-// Revision 1.6 2005/05/08 08:55:09 rogeeff
-// typos and missing descriptions fixed
-//
-// Revision 1.5 2005/04/05 07:23:20 rogeeff
-// restore default
-//
-// Revision 1.4 2005/04/05 06:11:37 rogeeff
-// memory leak allocation point detection\nextra help with _WIN32_WINNT
-//
-// Revision 1.3 2005/03/23 21:02:19 rogeeff
-// Sunpro CC 5.3 fixes
-//
-// Revision 1.2 2005/02/21 10:12:18 rogeeff
-// Support for random order of test cases implemented
-//
-// Revision 1.1 2005/02/20 08:27:07 rogeeff
-// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
-//
-// ***************************************************************************
-
 #endif // BOOST_TEST_FRAMEWORK_IPP_021005GER

Modified: trunk/boost/test/impl/logged_expectations.ipp
==============================================================================
--- trunk/boost/test/impl/logged_expectations.ipp (original)
+++ trunk/boost/test/impl/logged_expectations.ipp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -7,7 +7,7 @@
 //
 // File : $RCSfile$
 //
-// ELOG_VER : $Revision$
+// Version : $Revision$
 //
 // Description : Facilities to perform interaction based testng of logged expectations
 // ***************************************************************************

Modified: trunk/boost/test/impl/results_reporter.ipp
==============================================================================
--- trunk/boost/test/impl/results_reporter.ipp (original)
+++ trunk/boost/test/impl/results_reporter.ipp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -23,10 +23,10 @@
 #include <boost/test/output/plain_report_formatter.hpp>
 #include <boost/test/output/xml_report_formatter.hpp>
 
-#include <boost/test/detail/wrap_io_saver.hpp>
-
 // Boost
 #include <boost/scoped_ptr.hpp>
+#include <boost/io/ios_state.hpp>
+typedef ::boost::io::ios_base_all_saver io_saver_type;
 
 // STL
 #include <iostream>
@@ -112,6 +112,14 @@
 
 //____________________________________________________________________________//
 
+std::ostream&
+get_stream()
+{
+ return *s_rr_impl().m_output;
+}
+
+//____________________________________________________________________________//
+
 void
 set_format( output_format rf )
 {

Modified: trunk/boost/test/impl/test_tools.ipp
==============================================================================
--- trunk/boost/test/impl/test_tools.ipp (original)
+++ trunk/boost/test/impl/test_tools.ipp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -439,7 +439,7 @@
 
         BOOST_WARN_MESSAGE( m_pimpl->m_pattern.is_open(),
                              "Couldn't open pattern file " << pattern_file_name
- << " for " << (m_pimpl->m_match_or_save ? "reading" : "writing") );
+ << " for " << (match_or_save ? "reading" : "writing") );
     }
 
     m_pimpl->m_match_or_save = match_or_save;
@@ -616,62 +616,4 @@
 
 #include <boost/test/detail/enable_warnings.hpp>
 
-// ***************************************************************************
-// Revision History :
-//
-// $Log$
-// Revision 1.12 2006/02/01 07:58:25 rogeeff
-// critical message made more consistent with rest
-//
-// Revision 1.11 2006/01/28 07:01:25 rogeeff
-// message error fixed
-//
-// Revision 1.10 2005/12/14 05:33:47 rogeeff
-// use simplified log API
-// assertion_result call moved pass log statement
-// Binary output test stream support implemented
-//
-// Revision 1.9 2005/06/22 22:03:05 dgregor
-// More explicit scoping needed for GCC 2.95.3
-//
-// Revision 1.8 2005/04/30 17:56:31 rogeeff
-// switch to stdarg.h to workarround como issues
-//
-// Revision 1.7 2005/03/23 21:02:23 rogeeff
-// Sunpro CC 5.3 fixes
-//
-// Revision 1.6 2005/02/21 10:14:04 rogeeff
-// CHECK_SMALL tool implemented
-//
-// Revision 1.5 2005/02/20 08:27:07 rogeeff
-// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
-//
-// Revision 1.4 2005/02/02 12:08:14 rogeeff
-// namespace log added for log manipulators
-//
-// Revision 1.3 2005/02/01 06:40:07 rogeeff
-// copyright update
-// old log entries removed
-// minor stilistic changes
-// depricated tools removed
-//
-// Revision 1.2 2005/01/30 03:18:27 rogeeff
-// test tools implementation completely reworked. All tools inplemented through single vararg function
-//
-// Revision 1.1 2005/01/22 19:22:12 rogeeff
-// implementation moved into headers section to eliminate dependency of included/minimal component on src directory
-//
-// Revision 1.43 2005/01/19 06:40:05 vawjr
-// deleted redundant \r in many \r\r\n sequences of the source. VC8.0 doesn't like them
-//
-// Revision 1.42 2005/01/18 08:30:08 rogeeff
-// unit_test_log rework:
-// eliminated need for ::instance()
-// eliminated need for << end and ...END macro
-// straitend interface between log and formatters
-// change compiler like formatter name
-// minimized unit_test_log interface and reworked to use explicit calls
-//
-// ***************************************************************************
-
 #endif // BOOST_TEST_TEST_TOOLS_IPP_012205GER

Modified: trunk/boost/test/impl/unit_test_log.ipp
==============================================================================
--- trunk/boost/test/impl/unit_test_log.ipp (original)
+++ trunk/boost/test/impl/unit_test_log.ipp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -22,7 +22,6 @@
 #include <boost/test/execution_monitor.hpp>
 
 #include <boost/test/detail/unit_test_parameters.hpp>
-#include <boost/test/detail/wrap_io_saver.hpp>
 
 #include <boost/test/utils/basic_cstring/compare.hpp>
 
@@ -31,6 +30,8 @@
 
 // Boost
 #include <boost/scoped_ptr.hpp>
+#include <boost/io/ios_state.hpp>
+typedef ::boost::io::ios_base_all_saver io_saver_type;
 
 // STL
 #include <iostream>
@@ -124,6 +125,9 @@
 void
 unit_test_log_t::test_start( counter_t test_cases_amount )
 {
+ if( s_log_impl().m_threshold_level == log_nothing )
+ return;
+
     s_log_impl().m_log_formatter->log_start( s_log_impl().stream(), test_cases_amount );
 
     if( runtime_config::show_build_info() )
@@ -137,6 +141,9 @@
 void
 unit_test_log_t::test_finish()
 {
+ if( s_log_impl().m_threshold_level == log_nothing )
+ return;
+
     s_log_impl().m_log_formatter->log_finish( s_log_impl().stream() );
 
     s_log_impl().stream().flush();
@@ -155,7 +162,7 @@
 void
 unit_test_log_t::test_unit_start( test_unit const& tu )
 {
- if( s_log_impl().m_threshold_level > log_test_suites )
+ if( s_log_impl().m_threshold_level > log_test_units )
         return;
 
     if( s_log_impl().m_entry_in_progress )
@@ -169,7 +176,7 @@
 void
 unit_test_log_t::test_unit_finish( test_unit const& tu, unsigned long elapsed )
 {
- if( s_log_impl().m_threshold_level > log_test_suites )
+ if( s_log_impl().m_threshold_level > log_test_units )
         return;
 
     s_log_impl().m_checkpoint_data.clear();
@@ -185,7 +192,7 @@
 void
 unit_test_log_t::test_unit_skipped( test_unit const& tu )
 {
- if( s_log_impl().m_threshold_level > log_test_suites )
+ if( s_log_impl().m_threshold_level > log_test_units )
         return;
 
     if( s_log_impl().m_entry_in_progress )
@@ -333,7 +340,7 @@
                                                                unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR );
                 break;
             case log_nothing:
- case log_test_suites:
+ case log_test_units:
             case invalid_log_level:
                 return *this;
             }

Modified: trunk/boost/test/impl/unit_test_main.ipp
==============================================================================
--- trunk/boost/test/impl/unit_test_main.ipp (original)
+++ trunk/boost/test/impl/unit_test_main.ipp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -34,29 +34,23 @@
 
 //____________________________________________________________________________//
 
-// ************************************************************************** //
-// ************** unit_test_main ************** //
-// ************************************************************************** //
-
 namespace boost {
 
 namespace unit_test {
 
-int BOOST_TEST_DECL
+// ************************************************************************** //
+// ************** unit_test_main ************** //
+// ************************************************************************** //
 
-#if defined(BOOST_TEST_DYN_LINK)
-unit_test_main( bool (*init_unit_test_func)(), int argc, char* argv[] )
-#else
-unit_test_main( int argc, char* argv[] )
-#endif
+int BOOST_TEST_DECL
+unit_test_main( init_unit_test_func init_func, int argc, char* argv[] )
 {
     try {
- framework::init( argc, argv );
+ framework::init( init_func, argc, argv );
 
-#ifdef BOOST_TEST_DYN_LINK
- if( !(*init_unit_test_func)() )
- throw framework::setup_error( BOOST_TEST_L( "test tree initialization error" ) );
-#endif
+// !! ?? if( !runtime_config.test_to_run().is_empty() ) {
+//
+// }
 
         framework::run();
 
@@ -67,17 +61,17 @@
                     : results_collector.results( framework::master_test_suite().p_id ).result_code();
     }
     catch( framework::internal_error const& ex ) {
- std::cerr << "Boost.Test framework internal error: " << ex.what() << std::endl;
+ results_reporter::get_stream() << "Boost.Test framework internal error: " << ex.what() << std::endl;
         
         return boost::exit_exception_failure;
     }
     catch( framework::setup_error const& ex ) {
- std::cerr << "Test setup error: " << ex.what() << std::endl;
+ results_reporter::get_stream() << "Test setup error: " << ex.what() << std::endl;
         
         return boost::exit_exception_failure;
     }
     catch( ... ) {
- std::cerr << "Boost.Test framework internal error: unknown reason" << std::endl;
+ results_reporter::get_stream() << "Boost.Test framework internal error: unknown reason" << std::endl;
         
         return boost::exit_exception_failure;
     }
@@ -96,7 +90,18 @@
 int BOOST_TEST_CALL_DECL
 main( int argc, char* argv[] )
 {
- return ::boost::unit_test::unit_test_main( argc, argv );
+ // prototype for user's unit test init function
+#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
+ extern bool init_unit_test();
+
+ boost::unit_test::init_unit_test_func init_func = &init_unit_test;
+#else
+ extern ::boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] );
+
+ boost::unit_test::init_unit_test_func init_func = &init_unit_test_suite;
+#endif
+
+ return ::boost::unit_test::unit_test_main( init_func, argc, argv );
 }
 
 #endif // !BOOST_TEST_DYN_LINK && !BOOST_TEST_NO_MAIN

Modified: trunk/boost/test/impl/unit_test_monitor.ipp
==============================================================================
--- trunk/boost/test/impl/unit_test_monitor.ipp (original)
+++ trunk/boost/test/impl/unit_test_monitor.ipp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -60,9 +60,12 @@
 unit_test_monitor_t::execute_and_translate( test_case const& tc )
 {
     try {
- execute( callback0<int>( zero_return_wrapper( tc.test_func() ) ),
- runtime_config::catch_sys_errors(),
- tc.p_timeout );
+ p_catch_system_errors.value = runtime_config::catch_sys_errors();
+ p_timeout.value = tc.p_timeout.get();
+ p_auto_start_dbg.value = runtime_config::auto_start_dbg();
+ p_use_alt_stack.value = runtime_config::use_alt_stack();
+
+ execute( callback0<int>( zero_return_wrapper( tc.test_func() ) ) );
     }
     catch( execution_exception const& ex ) {
         framework::exception_caught( ex );

Modified: trunk/boost/test/impl/unit_test_parameters.ipp
==============================================================================
--- trunk/boost/test/impl/unit_test_parameters.ipp (original)
+++ trunk/boost/test/impl/unit_test_parameters.ipp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -58,6 +58,8 @@
 literal_string BUILD_INFO = "BOOST_TEST_BUILD_INFO";
 literal_string SHOW_PROGRESS = "BOOST_TEST_SHOW_PROGRESS";
 literal_string CATCH_SYS_ERRORS = "BOOST_TEST_CATCH_SYSTEM_ERRORS";
+literal_string AUTO_START_DBG = "BOOST_TEST_AUTO_START_DBG";
+literal_string USE_ALT_STACK = "BOOST_TEST_USE_ALT_STACK";
 literal_string REPORT_FORMAT = "BOOST_TEST_REPORT_FORMAT";
 literal_string LOG_FORMAT = "BOOST_TEST_LOG_FORMAT";
 literal_string OUTPUT_FORMAT = "BOOST_TEST_OUTPUT_FORMAT";
@@ -74,6 +76,8 @@
 bool s_show_build_info;
 bool s_show_progress;
 bool s_catch_sys_errors;
+bool s_auto_start_dbg;
+bool s_use_alt_stack;
 output_format s_report_format;
 output_format s_log_format;
 long s_detect_mem_leaks;
@@ -95,6 +99,8 @@
         BUILD_INFO , "--build_info",
         SHOW_PROGRESS , "--show_progress",
         CATCH_SYS_ERRORS , "--catch_system_errors",
+ AUTO_START_DBG , "--auto_start_dbg",
+ USE_ALT_STACK , "--use_alt_stack",
         REPORT_FORMAT , "--report_format",
         LOG_FORMAT , "--log_format",
         OUTPUT_FORMAT , "--output_format",
@@ -164,7 +170,8 @@
     fixed_mapping<const_string,unit_test::log_level,case_ins_less<char const> > log_level_name(
         "all" , log_successful_tests,
         "success" , log_successful_tests,
- "test_suite" , log_test_suites,
+ "test_suite" , log_test_units,
+ "unit_scope" , log_test_units,
         "message" , log_messages,
         "warning" , log_warnings,
         "error" , log_all_errors,
@@ -198,6 +205,7 @@
     s_show_build_info = retrieve_framework_parameter( BUILD_INFO, argc, argv ) == "yes";
     s_show_progress = retrieve_framework_parameter( SHOW_PROGRESS, argc, argv ) == "yes";
     s_catch_sys_errors = retrieve_framework_parameter( CATCH_SYS_ERRORS, argc, argv ) != "no";
+ s_use_alt_stack = retrieve_framework_parameter( USE_ALT_STACK, argc, argv ) != "no";
     s_tests_to_run = retrieve_framework_parameter( TESTS_TO_RUN, argc, argv );
     s_exec_path_to_break= retrieve_framework_parameter( BREAK_EXEC_PATH, argc, argv );
 
@@ -218,6 +226,14 @@
 
     const_string ml_str = retrieve_framework_parameter( DETECT_MEM_LEAK, argc, argv );
     s_detect_mem_leaks = ml_str.is_empty() ? 1 : interpret_long( ml_str );
+
+ const_string dbg = retrieve_framework_parameter( AUTO_START_DBG, argc, argv );
+
+ if( dbg.is_empty() || dbg == "no" )
+ s_auto_start_dbg = false;
+ else {
+ s_auto_start_dbg = true;
+ }
 }
 
 //____________________________________________________________________________//
@@ -294,6 +310,22 @@
 
 //____________________________________________________________________________//
 
+bool
+auto_start_dbg()
+{
+ return s_auto_start_dbg;
+}
+
+//____________________________________________________________________________//
+
+bool
+use_alt_stack()
+{
+ return s_use_alt_stack;
+}
+
+//____________________________________________________________________________//
+
 output_format
 report_format()
 {
@@ -340,27 +372,7 @@
 // Revision History :
 //
 // $Log$
-// Revision 1.10 2006/01/30 07:29:49 rogeeff
-// split memory leaks detection API in two to get more functions with better defined roles
-//
-// Revision 1.9 2005/12/14 05:38:47 rogeeff
-// new parameter break_exec_path() is introduced
-//
-// Revision 1.8 2005/05/08 08:55:09 rogeeff
-// typos and missing descriptions fixed
-//
-// Revision 1.7 2005/04/05 07:23:21 rogeeff
-// restore default
-//
-// Revision 1.6 2005/04/05 06:11:37 rogeeff
-// memory leak allocation point detection\nextra help with _WIN32_WINNT
-//
-// Revision 1.5 2005/02/21 10:12:22 rogeeff
-// Support for random order of test cases implemented
-//
-// Revision 1.4 2005/02/20 08:27:07 rogeeff
-// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
-//
+//
 // ***************************************************************************
 
 #endif // BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER

Modified: trunk/boost/test/impl/unit_test_suite.ipp
==============================================================================
--- trunk/boost/test/impl/unit_test_suite.ipp (original)
+++ trunk/boost/test/impl/unit_test_suite.ipp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -54,6 +54,7 @@
 , p_type_name( t == tut_case ? "case" : "suite" )
 , p_id( INV_TEST_UNIT_ID )
 , p_name( std::string( name.begin(), name.size() ) )
+, p_enabled( true )
 {
 }
 
@@ -84,6 +85,17 @@
 
 //____________________________________________________________________________//
 
+void
+test_unit::increase_exp_fail( unsigned num )
+{
+ p_expected_failures.value += num;
+
+ if( p_parent_id != 0 )
+ framework::get<test_suite>( p_parent_id ).increase_exp_fail( num );
+}
+
+//____________________________________________________________________________//
+
 // ************************************************************************** //
 // ************** test_case ************** //
 // ************************************************************************** //
@@ -115,21 +127,20 @@
 
 //____________________________________________________________________________//
 
-// !! need to prevent modifing test unit once it is added to tree
-
 void
 test_suite::add( test_unit* tu, counter_t expected_failures, unsigned timeout )
 {
- if( expected_failures != 0 )
- tu->p_expected_failures.value = expected_failures;
-
- p_expected_failures.value += tu->p_expected_failures;
-
     if( timeout != 0 )
         tu->p_timeout.value = timeout;
 
     m_members.push_back( tu->p_id );
     tu->p_parent_id.value = p_id;
+
+ if( tu->p_expected_failures )
+ increase_exp_fail( tu->p_expected_failures );
+
+ if( expected_failures )
+ tu->increase_exp_fail( expected_failures );
 }
 
 //____________________________________________________________________________//
@@ -144,6 +155,19 @@
 
 //____________________________________________________________________________//
 
+test_unit_id
+test_suite::get( const_string tu_name ) const
+{
+ BOOST_TEST_FOREACH( test_unit_id, id, m_members ) {
+ if( tu_name == framework::get( id, test_id_2_unit_type( id ) ).p_name.get() )
+ return id;
+ }
+
+ return INV_TEST_UNIT_ID;
+}
+
+//____________________________________________________________________________//
+
 // ************************************************************************** //
 // ************** traverse_test_tree ************** //
 // ************************************************************************** //
@@ -151,6 +175,7 @@
 void
 traverse_test_tree( test_case const& tc, test_tree_visitor& V )
 {
+ if( tc.p_enabled )
     V.visit( tc );
 }
 
@@ -159,7 +184,7 @@
 void
 traverse_test_tree( test_suite const& suite, test_tree_visitor& V )
 {
- if( !V.test_suite_start( suite ) )
+ if( !suite.p_enabled || !V.test_suite_start( suite ) )
         return;
 
     try {
@@ -213,8 +238,76 @@
 
 //____________________________________________________________________________//
 
+// ************************************************************************** //
+// ************** auto_test_unit_registrar ************** //
+// ************************************************************************** //
+
+auto_test_unit_registrar::auto_test_unit_registrar( test_case* tc, counter_t exp_fail )
+{
+ curr_ts_store().back()->add( tc, exp_fail );
+}
+
+//____________________________________________________________________________//
+
+auto_test_unit_registrar::auto_test_unit_registrar( const_string ts_name )
+{
+ test_unit_id id = curr_ts_store().back()->get( ts_name );
+
+ test_suite* ts;
+
+ if( id != INV_TEST_UNIT_ID ) {
+ ts = &framework::get<test_suite>( id ); // !! test for invalid tu type
+ BOOST_ASSERT( ts->p_parent_id == curr_ts_store().back()->p_id );
+ }
+ else {
+ ts = new test_suite( ts_name );
+ curr_ts_store().back()->add( ts );
+ }
+
+ curr_ts_store().push_back( ts );
+}
+
+//____________________________________________________________________________//
+
+auto_test_unit_registrar::auto_test_unit_registrar( test_unit_generator const& tc_gen )
+{
+ curr_ts_store().back()->add( tc_gen );
+}
+
+//____________________________________________________________________________//
+
+auto_test_unit_registrar::auto_test_unit_registrar( int )
+{
+ if( curr_ts_store().size() == 0 )
+ return; // report error?
+
+ curr_ts_store().pop_back();
+}
+
+//____________________________________________________________________________//
+
+std::list<test_suite*>&
+auto_test_unit_registrar::curr_ts_store()
+{
+ static std::list<test_suite*> inst( 1, &framework::master_test_suite() );
+ return inst;
+}
+
+//____________________________________________________________________________//
+
 } // namespace ut_detail
 
+// ************************************************************************** //
+// ************** global_fixture ************** //
+// ************************************************************************** //
+
+global_fixture::global_fixture()
+{
+ framework::register_observer( *this );
+}
+
+//____________________________________________________________________________//
+
 } // namespace unit_test
 
 } // namespace boost
@@ -227,33 +320,6 @@
 // Revision History :
 //
 // $Log$
-// Revision 1.13 2006/02/23 15:33:15 rogeeff
-// workaround restored
-//
-// Revision 1.12 2006/01/28 08:53:57 rogeeff
-// VC6.0 workaround removed
-//
-// Revision 1.11 2005/12/14 05:54:41 rogeeff
-// *** empty log message ***
-//
-// Revision 1.10 2005/04/18 04:55:36 rogeeff
-// test unit name made read/write
-//
-// Revision 1.9 2005/03/23 21:02:25 rogeeff
-// Sunpro CC 5.3 fixes
-//
-// Revision 1.8 2005/03/21 15:33:15 rogeeff
-// check reworked
-//
-// Revision 1.7 2005/02/25 21:27:44 turkanis
-// fix for random_shuffle on Borland 5.x w/ STLPort
-//
-// Revision 1.6 2005/02/21 10:12:24 rogeeff
-// Support for random order of test cases implemented
-//
-// Revision 1.5 2005/02/20 08:27:07 rogeeff
-// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
-//
 // ***************************************************************************
 
 #endif // BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER

Modified: trunk/boost/test/included/unit_test.hpp
==============================================================================
--- trunk/boost/test/included/unit_test.hpp (original)
+++ trunk/boost/test/included/unit_test.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -16,8 +16,11 @@
 #define BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER
 
 #include <boost/test/impl/compiler_log_formatter.ipp>
-#include <boost/test/impl/execution_monitor.ipp>
 #include <boost/test/impl/framework.ipp>
+#include <boost/test/impl/exception_safety.ipp>
+#include <boost/test/impl/execution_monitor.ipp>
+#include <boost/test/impl/interaction_based.ipp>
+#include <boost/test/impl/logged_expectations.ipp>
 #include <boost/test/impl/plain_report_formatter.ipp>
 #include <boost/test/impl/progress_monitor.ipp>
 #include <boost/test/impl/results_collector.ipp>

Modified: trunk/boost/test/interaction_based.hpp
==============================================================================
--- trunk/boost/test/interaction_based.hpp (original)
+++ trunk/boost/test/interaction_based.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -115,8 +115,8 @@
                                    std::size_t /*line_num*/,
                                    void* /*p*/, std::size_t /*s*/ ) {}
     virtual void freed( void* /*p*/ ) {}
- virtual void data_flow( const_string d ) {}
- virtual std::string return_value( const_string default_value ) { return ""; }
+ virtual void data_flow( const_string /*d*/ ) {}
+ virtual std::string return_value( const_string /*default_value */ ) { return ""; }
 
     template<typename T>
     void generic_data_flow( T const& t )

Modified: trunk/boost/test/logged_expectations.hpp
==============================================================================
--- trunk/boost/test/logged_expectations.hpp (original)
+++ trunk/boost/test/logged_expectations.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -47,7 +47,7 @@
     boost::unit_test::make_test_case( \
         &BOOST_AUTO_TC_INVOKER( test_name ), #test_name ), \
     boost::unit_test::ut_detail::auto_tc_exp_fail< \
- BOOST_AUTO_TC_UNIQUE_ID( test_name )>::value ); \
+ BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value() ); \
                                                                         \
 void test_name::test_method() \
 /**/

Modified: trunk/boost/test/results_reporter.hpp
==============================================================================
--- trunk/boost/test/results_reporter.hpp (original)
+++ trunk/boost/test/results_reporter.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -60,6 +60,8 @@
 BOOST_TEST_DECL void set_format( output_format );
 BOOST_TEST_DECL void set_format( results_reporter::format* );
 
+BOOST_TEST_DECL std::ostream& get_stream();
+
 // ************************************************************************** //
 // ************** report initiation ************** //
 // ************************************************************************** //

Modified: trunk/boost/test/test_tools.hpp
==============================================================================
--- trunk/boost/test/test_tools.hpp (original)
+++ trunk/boost/test/test_tools.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -161,6 +161,7 @@
     BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::equal_impl_frwd(), "", CHECK, CHECK_EQUAL, (L)(R) )
 #define BOOST_REQUIRE_EQUAL( L, R ) \
     BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::equal_impl_frwd(), "", REQUIRE, CHECK_EQUAL, (L)(R) )
+
 //____________________________________________________________________________//
 
 #define BOOST_WARN_CLOSE( L, R, T ) \
@@ -469,12 +470,12 @@
 //____________________________________________________________________________//
 
 predicate_result BOOST_TEST_DECL equal_impl( char const* left, char const* right );
-inline predicate_result BOOST_TEST_DECL equal_impl( char* left, char const* right ) { return equal_impl( (char const*)left, (char const*)right ); }
-inline predicate_result BOOST_TEST_DECL equal_impl( char const* left, char* right ) { return equal_impl( (char const*)left, (char const*)right ); }
-inline predicate_result BOOST_TEST_DECL equal_impl( char* left, char* right ) { return equal_impl( (char const*)left, (char const*)right ); }
+inline predicate_result equal_impl( char* left, char const* right ) { return equal_impl( (char const*)left, (char const*)right ); }
+inline predicate_result equal_impl( char const* left, char* right ) { return equal_impl( (char const*)left, (char const*)right ); }
+inline predicate_result equal_impl( char* left, char* right ) { return equal_impl( (char const*)left, (char const*)right ); }
 
 #if !defined( BOOST_NO_CWCHAR )
-predicate_result equal_impl( wchar_t const* left, wchar_t const* right );
+predicate_result BOOST_TEST_DECL equal_impl( wchar_t const* left, wchar_t const* right );
 inline predicate_result equal_impl( wchar_t* left, wchar_t const* right ) { return equal_impl( (wchar_t const*)left, (wchar_t const*)right ); }
 inline predicate_result equal_impl( wchar_t const* left, wchar_t* right ) { return equal_impl( (wchar_t const*)left, (wchar_t const*)right ); }
 inline predicate_result equal_impl( wchar_t* left, wchar_t* right ) { return equal_impl( (wchar_t const*)left, (wchar_t const*)right ); }
@@ -600,78 +601,6 @@
 // Revision History :
 //
 // $Log$
-// Revision 1.66 2007/04/05 14:46:47 dgregor
-// Add include of climits
-//
-// Revision 1.65 2007/02/22 18:00:39 speedsnail
-// Removed the msvc-6.5 hack from HEAD again. Gennadiy Rozental didn't like it anyways...
-//
-// Revision 1.64 2006/12/16 14:36:23 speedsnail
-// Workaround for msvc-6.5: *_EQUAL macros give Internal Compiler Errors, when inlining is turned on.
-//
-// Revision 1.63 2006/11/14 21:33:01 jhunold
-// Add missing export macros for print_log_value<>
-//
-// Revision 1.62 2006/11/14 07:34:30 jhunold
-// Removed wrong export declarations.
-//
-// Revision 1.61 2006/11/13 20:03:48 jhunold
-// Added missing export declarations.
-//
-// Revision 1.60 2006/03/19 07:27:11 rogeeff
-// avoid warning
-//
-// Revision 1.59 2006/03/03 17:39:46 rogeeff
-// paaspoint added to check throw
-//
-// Revision 1.58 2006/02/06 10:04:55 rogeeff
-// BOOST_TEST_MODULE - master test suite name
-//
-// Revision 1.57 2006/01/28 07:00:47 rogeeff
-// sunpro port
-//
-// Revision 1.56 2005/12/19 03:08:30 rogeeff
-// added is_abstract to guard numeric_limits instantiation
-//
-// Revision 1.55 2005/12/14 05:20:41 rogeeff
-// dll support introduced
-// BOOST_TEST_PASSPOINT() introduced
-// BOOST_MESSAGE depricated. Use BOOST_TEST_MESSAGE instead
-// BOOST_CHECKPOINT is depricated. Use BOOST_TEST_CHECKPOINT intead
-//
-// Revision 1.54 2005/06/07 04:38:20 rogeeff
-// borland fix
-//
-// Revision 1.53 2005/05/11 04:51:14 rogeeff
-// borlard portability fix
-//
-// Revision 1.52 2005/03/22 07:08:47 rogeeff
-// string comparisons streamlined
-// precision settings made portable
-//
-// Revision 1.51 2005/02/21 10:23:54 rogeeff
-// major issue with TT redesign causing TT to reevaluate it's arguments fixed
-// FP precision extended
-//
-// Revision 1.50 2005/02/20 08:27:06 rogeeff
-// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
-//
-// Revision 1.49 2005/02/01 06:40:06 rogeeff
-// copyright update
-// old log entries removed
-// minor stylistic changes
-// deprecated tools removed
-//
-// Revision 1.48 2005/01/30 03:32:57 rogeeff
-// Test Tools completely reworked:
-// interfaces streamlined to provide 3 version for each tool
-// implementation reworked to use single vararg formatter function
-// CHECK_COLLECTION now expect 4 arguments
-// BITWISE_EQUAL renamed to CHECK_BITWISE_EQUAL but still provided as deprecated
-// CHECK_COLLECTION interface changed to use PP_SEQ and as a result support arbitrary number of predicate arguments
-// most of templates eliminated
-// deprecated tools removed
-// print_helper object generator added
 //
 // ***************************************************************************
 

Modified: trunk/boost/test/unit_test.hpp
==============================================================================
--- trunk/boost/test/unit_test.hpp (original)
+++ trunk/boost/test/unit_test.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -43,15 +43,7 @@
 
 namespace boost { namespace unit_test {
 
-#if defined(BOOST_TEST_DYN_LINK)
-
-int BOOST_TEST_DECL unit_test_main( bool (*init_unit_test_func)(), int argc, char* argv[] );
-
-#else
-
-int BOOST_TEST_DECL unit_test_main( int argc, char* argv[] );
-
-#endif
+int BOOST_TEST_DECL unit_test_main( init_unit_test_func init_func, int argc, char* argv[] );
 
 }}
 

Modified: trunk/boost/test/unit_test_suite.hpp
==============================================================================
--- trunk/boost/test/unit_test_suite.hpp (original)
+++ trunk/boost/test/unit_test_suite.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -17,6 +17,7 @@
 
 // Boost.Test
 #include <boost/test/unit_test_suite_impl.hpp>
+#include <boost/test/framework.hpp>
 
 //____________________________________________________________________________//
 
@@ -42,8 +43,7 @@
 
 #define BOOST_AUTO_TEST_SUITE( suite_name ) \
 namespace suite_name { \
-BOOST_AUTO_TC_REGISTRAR( suite_name )( BOOST_TEST_SUITE( \
- BOOST_STRINGIZE( suite_name ) ) ); \
+BOOST_AUTO_TC_REGISTRAR( suite_name )( BOOST_STRINGIZE( suite_name ) ); \
 /**/
 
 // ************************************************************************** //
@@ -70,14 +70,17 @@
 
 #define BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES( test_name, n ) \
 struct BOOST_AUTO_TC_UNIQUE_ID( test_name ); \
-namespace boost { namespace unit_test { namespace ut_detail { \
                                                                         \
-template<> \
-struct auto_tc_exp_fail<BOOST_AUTO_TC_UNIQUE_ID( test_name ) > { \
- enum { value = n }; \
-}; \
+static struct BOOST_JOIN( test_name, _exp_fail_num_spec ) \
+: boost::unit_test::ut_detail:: \
+ auto_tc_exp_fail<BOOST_AUTO_TC_UNIQUE_ID( test_name ) > \
+{ \
+ BOOST_JOIN( test_name, _exp_fail_num_spec )() \
+ : boost::unit_test::ut_detail:: \
+ auto_tc_exp_fail<BOOST_AUTO_TC_UNIQUE_ID( test_name ) >( n ) \
+ {} \
+} BOOST_JOIN( test_name, _exp_fail_num_spec_inst ); \
                                                                         \
-}}} \
 /**/
 
 // ************************************************************************** //
@@ -99,7 +102,7 @@
     boost::unit_test::make_test_case( \
         &BOOST_AUTO_TC_INVOKER( test_name ), #test_name ), \
     boost::unit_test::ut_detail::auto_tc_exp_fail< \
- BOOST_AUTO_TC_UNIQUE_ID( test_name )>::value ); \
+ BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value() ); \
                                                                         \
 void test_name::test_method() \
 /**/

Modified: trunk/boost/test/unit_test_suite_impl.hpp
==============================================================================
--- trunk/boost/test/unit_test_suite_impl.hpp (original)
+++ trunk/boost/test/unit_test_suite_impl.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -23,7 +23,6 @@
 #include <boost/test/detail/fwd_decl.hpp>
 #include <boost/test/detail/workaround.hpp>
 #include <boost/test/test_observer.hpp>
-#include <boost/test/framework.hpp>
 
 // Boost
 #include <boost/shared_ptr.hpp>
@@ -67,7 +66,10 @@
     // Public r/w properties
     readwrite_property<std::string> p_name; // name for this test unit
     readwrite_property<unsigned> p_timeout; // timeout for the test unit execution
- readwrite_property<counter_t> p_expected_failures; // number of expected failured in this test unit
+ readwrite_property<counter_t> p_expected_failures; // number of expected failures in this test unit
+ mutable readwrite_property<bool> p_enabled; // enabled status for this unit
+
+ void increase_exp_fail( unsigned num );
 
 private:
     // Data members
@@ -120,16 +122,19 @@
     // Constructor
     explicit test_suite( const_string ts_name );
 
- // test case list management
+ // test unit list management
     void add( test_unit* tu, counter_t expected_failures = 0, unsigned timeout = 0 );
     void add( test_unit_generator const& gen, unsigned timeout = 0 );
 
+ // access methods
+ test_unit_id get( const_string tu_name ) const;
+
 protected:
- friend BOOST_TEST_DECL void traverse_test_tree( test_suite const&, test_tree_visitor& );
+ friend BOOST_TEST_DECL
+ void traverse_test_tree( test_suite const&, test_tree_visitor& );
     friend class framework_impl;
     virtual ~test_suite() {}
 
-private:
     // Data members
     std::vector<test_unit_id> m_members;
 };
@@ -172,7 +177,7 @@
 
 BOOST_TEST_DECL void traverse_test_tree( test_case const&, test_tree_visitor& );
 BOOST_TEST_DECL void traverse_test_tree( test_suite const&, test_tree_visitor& );
-BOOST_TEST_DECL void traverse_test_tree( test_unit_id id, test_tree_visitor& );
+BOOST_TEST_DECL void traverse_test_tree( test_unit_id , test_tree_visitor& );
 
 //____________________________________________________________________________//
 
@@ -194,7 +199,7 @@
 struct test_case_counter : test_tree_visitor {
     test_case_counter() : m_count( 0 ) {}
 
- void visit( test_case const& ) { m_count++; }
+ virtual void visit( test_case const& ) { m_count++; }
 
     counter_t m_count;
 };
@@ -258,41 +263,41 @@
 
 struct BOOST_TEST_DECL auto_test_unit_registrar
 {
- // Constructor
- explicit auto_test_unit_registrar( test_case* tc, counter_t exp_fail )
- {
- curr_ts_store().back()->add( tc, exp_fail );
- }
- explicit auto_test_unit_registrar( test_suite* ts )
- {
- curr_ts_store().back()->add( ts );
-
- curr_ts_store().push_back( ts );
- }
- explicit auto_test_unit_registrar( test_unit_generator const& tc_gen )
- {
- curr_ts_store().back()->add( tc_gen );
- }
- explicit auto_test_unit_registrar( int )
- {
- if( curr_ts_store().size() > 1 )
- curr_ts_store().pop_back();
- // else report error
- }
+ // Constructors
+ auto_test_unit_registrar( test_case* tc, counter_t exp_fail );
+ explicit auto_test_unit_registrar( const_string ts_name );
+ explicit auto_test_unit_registrar( test_unit_generator const& tc_gen );
+ explicit auto_test_unit_registrar( int );
 
 private:
- static std::list<test_suite*>& curr_ts_store()
- {
- static std::list<test_suite*> inst( 1, &framework::master_test_suite() );
- return inst;
- }
+ static std::list<test_suite*>& curr_ts_store();
 };
 
 //____________________________________________________________________________//
 
 template<typename T>
 struct auto_tc_exp_fail {
- enum { value = 0 };
+ auto_tc_exp_fail() : m_value( 0 ) {}
+
+ explicit auto_tc_exp_fail( unsigned v )
+ : m_value( v )
+ {
+ instance() = this;
+ }
+
+ static auto_tc_exp_fail*& instance()
+ {
+ static auto_tc_exp_fail inst;
+ static auto_tc_exp_fail* inst_ptr = &inst;
+
+ return inst_ptr;
+ }
+
+ unsigned value() const { return m_value; }
+
+private:
+ // Data members
+ unsigned m_value;
 };
 
 //____________________________________________________________________________//
@@ -306,7 +311,7 @@
 class BOOST_TEST_DECL global_fixture : public test_observer {
 public:
     // Constructor
- global_fixture() { framework::register_observer( *this ); }
+ global_fixture();
 };
 
 //____________________________________________________________________________//

Modified: trunk/boost/test/utils/fixed_mapping.hpp
==============================================================================
--- trunk/boost/test/utils/fixed_mapping.hpp (original)
+++ trunk/boost/test/utils/fixed_mapping.hpp 2007-10-18 03:14:56 EDT (Thu, 18 Oct 2007)
@@ -38,7 +38,7 @@
 // configurable maximum fixed sized mapping size supported by this header.
 // You could redefine it before inclusion of this file.
 #ifndef MAX_MAP_SIZE
-#define MAX_MAP_SIZE 15
+#define MAX_MAP_SIZE 16
 #endif
 
 #define CONSTR_DECL_MID( z, i, dummy1 ) key_param_type key##i, value_param_type v##i,


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk