Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions doc/runtime_configuration/runtime_config_reference.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,15 @@ acceptable values list. All values are case sensitive and are required to exactl
[__param_detect_fp_exceptions__]
[Traps floating point exceptions (on supported platforms).]
]




[/ ###############################################################################################]
[
[__param_deprecated_timer_format__]
[Enables output of the deprecated timer format.]
]


[/ ###############################################################################################]
[
[__param_log_sink__]
Expand All @@ -156,8 +163,7 @@ acceptable values list. All values are case sensitive and are required to exactl
[__param_save_pattern__]
[Provides parameters for testing output streams.]
]



[/ ###############################################################################################]
[
[__param_list_content__]
Expand Down Expand Up @@ -548,7 +554,25 @@ Dnables/disable hardware traps for the floating point exception (if supported).

BOOST_TEST_DETECT_FP_EXCEPTIONS

[endsect] [/detect_fp_exceptions]
[endsect] [/detect_fp_exceptions]

[/ ###############################################################################################]
[#ref_param_deprecated_timer_format][section `deprecated_timer_format`]

Enables the deprecated timer format

Enables/disables the output of the deprecated timer format for times when using the HRF format.

[h4 Acceptable values]

* [*no] (default)
* yes

[h4 Environment variable]

BOOST_TEST_DEPRECATED_TIMER_FORMAT

[endsect] [/deprecated_timer_format]

[/ ###############################################################################################]
[#ref_param_log_sink][section `log_sink`]
Expand Down Expand Up @@ -614,7 +638,7 @@ You can use this parameter to switch between these modes, by passing the paramet

BOOST_TEST_SAVE_PATTERN

[endsect] [/save_patterm]
[endsect] [/save_patterm]

[/ ###############################################################################################]
[section:param_list_content `list_content`]
Expand Down
43 changes: 22 additions & 21 deletions doc/test.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,28 @@


[/ runtime/cla parameters]
[def __param_show_progress__ [link ref_param_show_progress `show_progress`]]
[def __param_log_level__ [link ref_param_log_level `log_level`]]
[def __param_output_format__ [link ref_param_output_format `output_format`]]
[def __param_log_format__ [link ref_param_log_format `log_format`]]
[def __param_run_test__ [link ref_param_run_test `run_test`]]
[def __param_report_level__ [link ref_param_report_level `report_level`]]
[def __param_report_format__ [link ref_param_report_format `report_format`]]
[def __param_catch_system__ [link ref_param_catch_system `catch_system_error`]]
[def __param_result_code__ [link ref_param_result_code `result_code`]]
[def __param_build_info__ [link ref_param_build_info `build_info`]]
[def __param_auto_start_dbg__ [link ref_param_auto_dbg `auto_start_dbg`]]
[def __param_break_exec_path__ [link ref_param_break_exe_path `break_exec_path`]]
[def __param_color_output__ [link ref_param_color_output `color_output`]]
[def __param_random__ [link ref_param_random `random`]]
[def __param_detect_memory_leaks__ [link ref_param_detect_memory_leaks `detect_memory_leaks`]]
[def __param_use_alt_stack__ [link ref_param_use_alt_stack `use_alt_stack`]]
[def __param_detect_fp_exceptions__ [link ref_param_detect_fp_exceptions `detect_fp_exceptions`]]
[def __param_log_sink__ [link ref_param_log_sink `log_sink`]]
[def __param_report_sink__ [link ref_param_report_sink `report_sink`]]
[def __param_save_pattern__ [link ref_param_save_patterm `save_patterm`]]
[def __param_list_content__ [link boost_test.users_guide.runtime_config.rt_param_reference.param_list_content `list_content`]]
[def __param_show_progress__ [link ref_param_show_progress `show_progress`]]
[def __param_log_level__ [link ref_param_log_level `log_level`]]
[def __param_output_format__ [link ref_param_output_format `output_format`]]
[def __param_log_format__ [link ref_param_log_format `log_format`]]
[def __param_run_test__ [link ref_param_run_test `run_test`]]
[def __param_report_level__ [link ref_param_report_level `report_level`]]
[def __param_report_format__ [link ref_param_report_format `report_format`]]
[def __param_catch_system__ [link ref_param_catch_system `catch_system_error`]]
[def __param_result_code__ [link ref_param_result_code `result_code`]]
[def __param_build_info__ [link ref_param_build_info `build_info`]]
[def __param_auto_start_dbg__ [link ref_param_auto_dbg `auto_start_dbg`]]
[def __param_break_exec_path__ [link ref_param_break_exe_path `break_exec_path`]]
[def __param_color_output__ [link ref_param_color_output `color_output`]]
[def __param_random__ [link ref_param_random `random`]]
[def __param_detect_memory_leaks__ [link ref_param_detect_memory_leaks `detect_memory_leaks`]]
[def __param_use_alt_stack__ [link ref_param_use_alt_stack `use_alt_stack`]]
[def __param_detect_fp_exceptions__ [link ref_param_detect_fp_exceptions `detect_fp_exceptions`]]
[def __param_deprecated_timer_format__ [link ref_param_deprecated_timer_format `deprecated_timer_format`]]
[def __param_log_sink__ [link ref_param_log_sink `log_sink`]]
[def __param_report_sink__ [link ref_param_report_sink `report_sink`]]
[def __param_save_pattern__ [link ref_param_save_patterm `save_patterm`]]
[def __param_list_content__ [link boost_test.users_guide.runtime_config.rt_param_reference.param_list_content `list_content`]]

[/ decorators]
[def __decorator_label__ [link ref_decorator_label `label`]]
Expand Down
10 changes: 4 additions & 6 deletions include/boost/test/impl/compiler_log_formatter.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <boost/test/utils/basic_cstring/io.hpp>
#include <boost/test/utils/lazy_ostream.hpp>
#include <boost/test/utils/setcolor.hpp>
#include <boost/test/utils/timer.hpp>
#include <boost/test/output/compiler_log_formatter.hpp>
#include <boost/test/unit_test_parameters.hpp>

Expand Down Expand Up @@ -101,18 +102,15 @@ compiler_log_formatter::test_unit_start( std::ostream& output, test_unit const&
//____________________________________________________________________________//

void
compiler_log_formatter::test_unit_finish( std::ostream& output, test_unit const& tu, unsigned long elapsed )
compiler_log_formatter::test_unit_finish( std::ostream& output, test_unit const& tu, elapsed_t elapsed )
{
BOOST_TEST_SCOPE_SETCOLOR( output, term_attr::BRIGHT, term_color::BLUE );

output << "Leaving test " << tu.p_type_name << " \"" << tu.p_name << "\"";

if( elapsed > 0 ) {
if( has_time( elapsed ) ) {
output << "; testing time: ";
if( elapsed % 1000 == 0 )
output << elapsed/1000 << "ms";
else
output << elapsed << "mks";
output << to_string( elapsed );
}

output << std::endl;
Expand Down
14 changes: 9 additions & 5 deletions include/boost/test/impl/framework.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@
#include <boost/test/utils/foreach.hpp>
#include <boost/test/utils/basic_cstring/io.hpp>

#include <boost/test/utils/timer.hpp>

// Boost
#include <boost/timer.hpp>
#include <boost/bind.hpp>

// STL
Expand Down Expand Up @@ -372,7 +373,7 @@ public:
return true;
}

void test_unit_finish( test_unit const& tu, unit_test_monitor_t::error_level run_result, unsigned long elapsed )
void test_unit_finish( test_unit const& tu, unit_test_monitor_t::error_level run_result, elapsed_t elapsed )
{
// if run error is critical skip teardown, who knows what the state of the program at this point
if( !unit_test_monitor.is_critical_error( run_result ) ) {
Expand Down Expand Up @@ -413,9 +414,12 @@ public:
m_curr_test_case = tc.p_id;

// execute the test case body
boost::timer tc_timer;
timer_t tc_timer;
unit_test_monitor_t::error_level run_result = unit_test_monitor.execute_and_translate( tc.p_test_func, tc.p_timeout );
unsigned long elapsed = static_cast<unsigned long>( tc_timer.elapsed() * 1e6 );

tc_timer.stop();
elapsed_t elapsed = tc_timer.elapsed();


// cleanup leftover context
m_context.clear();
Expand All @@ -434,7 +438,7 @@ public:

void test_suite_finish( test_suite const& ts )
{
test_unit_finish( ts, unit_test_monitor_t::test_ok, 0 );
test_unit_finish( ts, unit_test_monitor_t::test_ok, elapsed_t() );
}

//////////////////////////////////////////////////////////////////
Expand Down
5 changes: 3 additions & 2 deletions include/boost/test/impl/progress_monitor.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@

#include <boost/test/unit_test_parameters.hpp>
#include <boost/test/utils/setcolor.hpp>
#include <boost/test/utils/timer.hpp>
#include <boost/test/utils/progress.hpp>

#include <boost/test/tree/test_unit.hpp>
#include <boost/test/tree/test_case_counter.hpp>
#include <boost/test/tree/traverse.hpp>

// Boost
#include <boost/progress.hpp>
#include <boost/scoped_ptr.hpp>

#include <boost/test/detail/suppress_warnings.hpp>
Expand Down Expand Up @@ -79,7 +80,7 @@ progress_monitor_t::test_aborted()
//____________________________________________________________________________//

void
progress_monitor_t::test_unit_finish( test_unit const& tu, unsigned long )
progress_monitor_t::test_unit_finish( test_unit const& tu, elapsed_t )
{
BOOST_TEST_SCOPE_SETCOLOR( *s_pm_impl().m_stream, term_attr::BRIGHT, term_color::MAGENTA );

Expand Down
3 changes: 2 additions & 1 deletion include/boost/test/impl/results_collector.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <boost/test/unit_test_log.hpp>
#include <boost/test/results_collector.hpp>
#include <boost/test/framework.hpp>
#include <boost/test/utils/timer.hpp>

#include <boost/test/tree/test_unit.hpp>
#include <boost/test/tree/visitor.hpp>
Expand Down Expand Up @@ -184,7 +185,7 @@ private:
//____________________________________________________________________________//

void
results_collector_t::test_unit_finish( test_unit const& tu, unsigned long )
results_collector_t::test_unit_finish( test_unit const& tu, elapsed_t )
{
if( tu.p_type == TUT_SUITE ) {
results_collect_helper ch( s_rc_impl().m_results_store[tu.p_id], tu );
Expand Down
3 changes: 2 additions & 1 deletion include/boost/test/impl/test_tree.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
#include <boost/test/utils/foreach.hpp>

#include <boost/test/unit_test_parameters.hpp>
#include <boost/test/utils/timer.hpp>

// Boost
#include <boost/timer.hpp>
// none

// STL
#include <algorithm>
Expand Down
4 changes: 3 additions & 1 deletion include/boost/test/impl/unit_test_log.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <boost/test/output/compiler_log_formatter.hpp>
#include <boost/test/output/xml_log_formatter.hpp>

#include <boost/test/utils/timer.hpp>

// Boost
#include <boost/scoped_ptr.hpp>
#include <boost/io/ios_state.hpp>
Expand Down Expand Up @@ -177,7 +179,7 @@ unit_test_log_t::test_unit_start( test_unit const& tu )
//____________________________________________________________________________//

void
unit_test_log_t::test_unit_finish( test_unit const& tu, unsigned long elapsed )
unit_test_log_t::test_unit_finish( test_unit const& tu, elapsed_t elapsed )
{
if( s_log_impl().m_threshold_level > log_test_units )
return;
Expand Down
101 changes: 57 additions & 44 deletions include/boost/test/impl/unit_test_parameters.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -152,28 +152,29 @@ namespace runtime_config {
namespace {

// framework parameters and corresponding command-line arguments
std::string AUTO_START_DBG = "auto_start_dbg";
std::string BREAK_EXEC_PATH = "break_exec_path";
std::string BUILD_INFO = "build_info";
std::string CATCH_SYS_ERRORS = "catch_system_errors";
std::string COLOR_OUTPUT = "color_output";
std::string DETECT_FP_EXCEPT = "detect_fp_exceptions";
std::string DETECT_MEM_LEAKS = "detect_memory_leaks";
std::string LIST_CONTENT = "list_content";
std::string LOG_FORMAT = "log_format";
std::string LOG_LEVEL = "log_level";
std::string LOG_SINK = "log_sink";
std::string OUTPUT_FORMAT = "output_format";
std::string RANDOM_SEED = "random";
std::string REPORT_FORMAT = "report_format";
std::string REPORT_LEVEL = "report_level";
std::string REPORT_SINK = "report_sink";
std::string RESULT_CODE = "result_code";
std::string TESTS_TO_RUN = "run_test";
std::string SAVE_TEST_PATTERN = "save_pattern";
std::string SHOW_PROGRESS = "show_progress";
std::string USE_ALT_STACK = "use_alt_stack";
std::string WAIT_FOR_DEBUGGER = "wait_for_debugger";
std::string AUTO_START_DBG = "auto_start_dbg";
std::string BREAK_EXEC_PATH = "break_exec_path";
std::string BUILD_INFO = "build_info";
std::string CATCH_SYS_ERRORS = "catch_system_errors";
std::string COLOR_OUTPUT = "color_output";
std::string DEPRECATED_TIMER_FORMAT = "deprecated_timer_format";
std::string DETECT_FP_EXCEPT = "detect_fp_exceptions";
std::string DETECT_MEM_LEAKS = "detect_memory_leaks";
std::string LIST_CONTENT = "list_content";
std::string LOG_FORMAT = "log_format";
std::string LOG_LEVEL = "log_level";
std::string LOG_SINK = "log_sink";
std::string OUTPUT_FORMAT = "output_format";
std::string RANDOM_SEED = "random";
std::string REPORT_FORMAT = "report_format";
std::string REPORT_LEVEL = "report_level";
std::string REPORT_SINK = "report_sink";
std::string RESULT_CODE = "result_code";
std::string TESTS_TO_RUN = "run_test";
std::string SAVE_TEST_PATTERN = "save_pattern";
std::string SHOW_PROGRESS = "show_progress";
std::string USE_ALT_STACK = "use_alt_stack";
std::string WAIT_FOR_DEBUGGER = "wait_for_debugger";

static const_string
parameter_2_env_var( const_string param_name )
Expand All @@ -182,28 +183,29 @@ parameter_2_env_var( const_string param_name )
static mtype s_mapping;

if( s_mapping.empty() ) {
s_mapping[AUTO_START_DBG] = "BOOST_TEST_AUTO_START_DBG";
s_mapping[BREAK_EXEC_PATH] = "BOOST_TEST_BREAK_EXEC_PATH";
s_mapping[BUILD_INFO] = "BOOST_TEST_BUILD_INFO";
s_mapping[CATCH_SYS_ERRORS] = "BOOST_TEST_CATCH_SYSTEM_ERRORS";
s_mapping[COLOR_OUTPUT] = "BOOST_TEST_COLOR_OUTPUT";
s_mapping[DETECT_FP_EXCEPT] = "BOOST_TEST_DETECT_FP_EXCEPTIONS";
s_mapping[DETECT_MEM_LEAKS] = "BOOST_TEST_DETECT_MEMORY_LEAK";
s_mapping[LIST_CONTENT] = "BOOST_TEST_LIST_CONTENT";
s_mapping[LOG_FORMAT] = "BOOST_TEST_LOG_FORMAT";
s_mapping[LOG_LEVEL] = "BOOST_TEST_LOG_LEVEL";
s_mapping[LOG_SINK] = "BOOST_TEST_LOG_SINK";
s_mapping[OUTPUT_FORMAT] = "BOOST_TEST_OUTPUT_FORMAT";
s_mapping[RANDOM_SEED] = "BOOST_TEST_RANDOM";
s_mapping[REPORT_FORMAT] = "BOOST_TEST_REPORT_FORMAT";
s_mapping[REPORT_LEVEL] = "BOOST_TEST_REPORT_LEVEL";
s_mapping[REPORT_SINK] = "BOOST_TEST_REPORT_SINK";
s_mapping[RESULT_CODE] = "BOOST_TEST_RESULT_CODE";
s_mapping[TESTS_TO_RUN] = "BOOST_TESTS_TO_RUN";
s_mapping[SAVE_TEST_PATTERN] = "BOOST_TEST_SAVE_PATTERN";
s_mapping[SHOW_PROGRESS] = "BOOST_TEST_SHOW_PROGRESS";
s_mapping[USE_ALT_STACK] = "BOOST_TEST_USE_ALT_STACK";
s_mapping[WAIT_FOR_DEBUGGER] = "BOOST_TEST_WAIT_FOR_DEBUGGER";
s_mapping[AUTO_START_DBG] = "BOOST_TEST_AUTO_START_DBG";
s_mapping[BREAK_EXEC_PATH] = "BOOST_TEST_BREAK_EXEC_PATH";
s_mapping[BUILD_INFO] = "BOOST_TEST_BUILD_INFO";
s_mapping[CATCH_SYS_ERRORS] = "BOOST_TEST_CATCH_SYSTEM_ERRORS";
s_mapping[COLOR_OUTPUT] = "BOOST_TEST_COLOR_OUTPUT";
s_mapping[DEPRECATED_TIMER_FORMAT] = "BOOST_TEST_DEPRECATED_TIMER_FORMAT";
s_mapping[DETECT_FP_EXCEPT] = "BOOST_TEST_DETECT_FP_EXCEPTIONS";
s_mapping[DETECT_MEM_LEAKS] = "BOOST_TEST_DETECT_MEMORY_LEAK";
s_mapping[LIST_CONTENT] = "BOOST_TEST_LIST_CONTENT";
s_mapping[LOG_FORMAT] = "BOOST_TEST_LOG_FORMAT";
s_mapping[LOG_LEVEL] = "BOOST_TEST_LOG_LEVEL";
s_mapping[LOG_SINK] = "BOOST_TEST_LOG_SINK";
s_mapping[OUTPUT_FORMAT] = "BOOST_TEST_OUTPUT_FORMAT";
s_mapping[RANDOM_SEED] = "BOOST_TEST_RANDOM";
s_mapping[REPORT_FORMAT] = "BOOST_TEST_REPORT_FORMAT";
s_mapping[REPORT_LEVEL] = "BOOST_TEST_REPORT_LEVEL";
s_mapping[REPORT_SINK] = "BOOST_TEST_REPORT_SINK";
s_mapping[RESULT_CODE] = "BOOST_TEST_RESULT_CODE";
s_mapping[TESTS_TO_RUN] = "BOOST_TESTS_TO_RUN";
s_mapping[SAVE_TEST_PATTERN] = "BOOST_TEST_SAVE_PATTERN";
s_mapping[SHOW_PROGRESS] = "BOOST_TEST_SHOW_PROGRESS";
s_mapping[USE_ALT_STACK] = "BOOST_TEST_USE_ALT_STACK";
s_mapping[WAIT_FOR_DEBUGGER] = "BOOST_TEST_WAIT_FOR_DEBUGGER";
}

mtype::const_iterator it = s_mapping.find( param_name );
Expand Down Expand Up @@ -282,6 +284,9 @@ init( int& argc, char** argv )
<< cla::dual_name_parameter<bool>( COLOR_OUTPUT + "|x" )
- (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
cla::description = "Allows to switch between catching and ignoring system errors (signals)")
<< cla::named_parameter<bool>( DEPRECATED_TIMER_FORMAT )
- (cla::prefix = "--",cla::separator = "=",cla::guess_name,cla::optional,
cla::description = "Forces HRF output for timing information to mimic the deprecated boost timer output")
<< cla::named_parameter<bool>( DETECT_FP_EXCEPT )
- (cla::prefix = "--",cla::separator = "=",cla::guess_name,cla::optional,
cla::description = "Allows to switch between catching and ignoring floating point exceptions")
Expand Down Expand Up @@ -499,6 +504,14 @@ detect_fp_exceptions()

//____________________________________________________________________________//

bool
deprecated_timer_format()
{
return retrieve_parameter( DEPRECATED_TIMER_FORMAT, s_cla_parser, false );
}

//____________________________________________________________________________//

output_format
report_format()
{
Expand Down
Loading