]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/test/include/boost/test/impl/unit_test_monitor.ipp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / test / include / boost / test / impl / unit_test_monitor.ipp
CommitLineData
7c673cae
FG
1// (C) Copyright Gennadiy Rozental 2001.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5
6// See http://www.boost.org/libs/test for the library home page.
7//
8// File : $RCSfile$
9//
10// Version : $Revision$
11//
12// Description : implements specific subclass of Executon Monitor used by Unit
13// Test Framework to monitor test cases run.
14// ***************************************************************************
15
16#ifndef BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER
17#define BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER
18
19// Boost.Test
20#include <boost/test/unit_test_monitor.hpp>
21#include <boost/test/framework.hpp>
22#include <boost/test/tree/test_unit.hpp>
23#include <boost/test/unit_test_parameters.hpp>
24
25#include <boost/test/detail/suppress_warnings.hpp>
26
27//____________________________________________________________________________//
28
29namespace boost {
30namespace unit_test {
31
32// ************************************************************************** //
33// ************** unit_test_monitor ************** //
34// ************************************************************************** //
35
36unit_test_monitor_t::error_level
37unit_test_monitor_t::execute_and_translate( boost::function<void ()> const& func, unsigned timeout )
38{
39 BOOST_TEST_I_TRY {
40 p_catch_system_errors.value = runtime_config::get<bool>( runtime_config::CATCH_SYS_ERRORS );
41 p_timeout.value = timeout;
42 p_auto_start_dbg.value = runtime_config::get<bool>( runtime_config::AUTO_START_DBG );
43 p_use_alt_stack.value = runtime_config::get<bool>( runtime_config::USE_ALT_STACK );
44 p_detect_fp_exceptions.value = runtime_config::get<bool>( runtime_config::DETECT_FP_EXCEPT );
45
46 vexecute( func );
47 }
48 BOOST_TEST_I_CATCH( execution_exception, ex ) {
49 framework::exception_caught( ex );
50 framework::test_unit_aborted( framework::current_test_case() );
51
52 // translate execution_exception::error_code to error_level
53 switch( ex.code() ) {
54 case execution_exception::no_error: return test_ok;
55 case execution_exception::user_error: return unexpected_exception;
56 case execution_exception::cpp_exception_error: return unexpected_exception;
57 case execution_exception::system_error: return os_exception;
58 case execution_exception::timeout_error: return os_timeout;
59 case execution_exception::user_fatal_error:
60 case execution_exception::system_fatal_error: return fatal_error;
61 default: return unexpected_exception;
62 }
63 }
64
65 return test_ok;
66}
67
68//____________________________________________________________________________//
69
70} // namespace unit_test
71} // namespace boost
72
73#include <boost/test/detail/enable_warnings.hpp>
74
75#endif // BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER