|
Boost-Commit : |
From: gennadiy.rozental_at_[hidden]
Date: 2007-10-18 17:43:36
Author: rogeeff
Date: 2007-10-18 17:43:35 EDT (Thu, 18 Oct 2007)
New Revision: 40165
URL: http://svn.boost.org/trac/boost/changeset/40165
Log:
FP exceptions made optional and disabled by default
new CLA --detect_fp_exceptions=[yes|no] introduced
Text files modified:
trunk/boost/test/detail/unit_test_parameters.hpp | 1
trunk/boost/test/execution_monitor.hpp | 8 +++++-
trunk/boost/test/impl/execution_monitor.ipp | 7 +++--
trunk/boost/test/impl/unit_test_monitor.ipp | 9 ++++---
trunk/boost/test/impl/unit_test_parameters.ipp | 42 +++++++++++++++++++++++++--------------
trunk/boost/test/utils/fixed_mapping.hpp | 2
6 files changed, 44 insertions(+), 25 deletions(-)
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 17:43:35 EDT (Thu, 18 Oct 2007)
@@ -45,6 +45,7 @@
bool BOOST_TEST_DECL catch_sys_errors();
bool BOOST_TEST_DECL auto_start_dbg();
bool BOOST_TEST_DECL use_alt_stack();
+bool BOOST_TEST_DECL detect_fp_exceptions();
output_format BOOST_TEST_DECL report_format();
output_format BOOST_TEST_DECL log_format();
long BOOST_TEST_DECL detect_memory_leaks();
Modified: trunk/boost/test/execution_monitor.hpp
==============================================================================
--- trunk/boost/test/execution_monitor.hpp (original)
+++ trunk/boost/test/execution_monitor.hpp 2007-10-18 17:43:35 EDT (Thu, 18 Oct 2007)
@@ -138,6 +138,8 @@
: p_catch_system_errors( true )
, p_auto_start_dbg( false )
, p_timeout( 0 )
+ , p_use_alt_stack( true )
+ , p_detect_fp_exceptions( false )
{}
// Public properties
@@ -154,8 +156,10 @@
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;
-
+ unit_test::readwrite_property<bool> p_use_alt_stack;
+ // The p_detect_fp_exceptions parameter specifies whether the monitor should
+ // try to detect hardware floating point exceptions
+ unit_test::readwrite_property<bool> p_detect_fp_exceptions;
int execute( unit_test::callback0<int> const& F );
// Returns: Value returned by function call F().
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 17:43:35 EDT (Thu, 18 Oct 2007)
@@ -926,7 +926,8 @@
if( !p_catch_system_errors )
_set_se_translator( &detail::system_signal_exception::seh_catch_preventer );
else {
- detail::switch_fp_exceptions( true );
+ if( !!p_detect_fp_exceptions )
+ detail::switch_fp_exceptions( true );
#ifdef BOOST_TEST_USE_DEBUG_MS_CRT
_CrtSetReportHook( &detail::assert_reporting_function );
@@ -948,10 +949,10 @@
}
__finally {
if( !!p_catch_system_errors ) {
- detail::switch_fp_exceptions( false );
+ if( !!p_detect_fp_exceptions )
+ detail::switch_fp_exceptions( false );
_set_invalid_parameter_handler( old_iph );
-
}
}
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 17:43:35 EDT (Thu, 18 Oct 2007)
@@ -60,10 +60,11 @@
unit_test_monitor_t::execute_and_translate( test_case const& tc )
{
try {
- 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();
+ 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();
+ p_detect_fp_exceptions.value = runtime_config::detect_fp_exceptions();
execute( callback0<int>( zero_return_wrapper( tc.test_func() ) ) );
}
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 17:43:35 EDT (Thu, 18 Oct 2007)
@@ -60,6 +60,7 @@
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 DETECT_FP_EXCEPT = "BOOST_TEST_DETECT_FP_EXCEPTIONS";
literal_string REPORT_FORMAT = "BOOST_TEST_REPORT_FORMAT";
literal_string LOG_FORMAT = "BOOST_TEST_LOG_FORMAT";
literal_string OUTPUT_FORMAT = "BOOST_TEST_OUTPUT_FORMAT";
@@ -67,21 +68,22 @@
literal_string RANDOM_SEED = "BOOST_TEST_RANDOM";
literal_string BREAK_EXEC_PATH = "BOOST_TEST_BREAK_EXEC_PATH";
-unit_test::log_level s_log_level;
-bool s_no_result_code;
-unit_test::report_level s_report_level;
-const_string s_tests_to_run;
-const_string s_exec_path_to_break;
-bool s_save_pattern;
-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;
-unsigned int s_random_seed;
+unit_test::log_level s_log_level;
+bool s_no_result_code;
+unit_test::report_level s_report_level;
+const_string s_tests_to_run;
+const_string s_exec_path_to_break;
+bool s_save_pattern;
+bool s_show_build_info;
+bool s_show_progress;
+bool s_catch_sys_errors;
+bool s_auto_start_dbg;
+bool s_use_alt_stack;
+bool s_detect_fp_except;
+output_format s_report_format;
+output_format s_log_format;
+long s_detect_mem_leaks;
+unsigned int s_random_seed;
// ************************************************************************** //
// ************** runtime_config ************** //
@@ -101,6 +103,7 @@
CATCH_SYS_ERRORS , "--catch_system_errors",
AUTO_START_DBG , "--auto_start_dbg",
USE_ALT_STACK , "--use_alt_stack",
+ DETECT_FP_EXCEPT , "--detect_fp_exceptions",
REPORT_FORMAT , "--report_format",
LOG_FORMAT , "--log_format",
OUTPUT_FORMAT , "--output_format",
@@ -206,6 +209,7 @@
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_detect_fp_except = retrieve_framework_parameter( DETECT_FP_EXCEPT, argc, argv ) == "yes";
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 );
@@ -326,6 +330,14 @@
//____________________________________________________________________________//
+bool
+detect_fp_exceptions()
+{
+ return s_detect_fp_except;
+}
+
+//____________________________________________________________________________//
+
output_format
report_format()
{
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 17:43:35 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 16
+#define MAX_MAP_SIZE 20
#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