]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/test/impl/unit_test_main.ipp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / test / impl / unit_test_main.ipp
index 1780c6b93b2a0af3cf1cd62db8f8d66b1c24d63d..c553c45121c8e19cf9dbcd1a288e6c3e87074fa1 100644 (file)
@@ -37,6 +37,7 @@
 #include <stdexcept>
 #include <iostream>
 #include <iomanip>
+#include <iterator>
 #include <set>
 
 #include <boost/test/detail/suppress_warnings.hpp>
@@ -174,18 +175,34 @@ private:
     std::set<std::string>   m_labels;
 };
 
+struct framework_shutdown_helper {
+    ~framework_shutdown_helper() {
+        try {
+            framework::shutdown();
+        }
+        catch(...) {
+            std::cerr << "Boost.Test shutdown exception caught" << std::endl;
+        }
+    }
+};
+
 } // namespace ut_detail
 
 // ************************************************************************** //
 // **************                  unit_test_main              ************** //
 // ************************************************************************** //
 
+
+
 int BOOST_TEST_DECL
 unit_test_main( init_unit_test_func init_func, int argc, char* argv[] )
 {
     int result_code = 0;
 
+    ut_detail::framework_shutdown_helper shutdown_helper;
+
     BOOST_TEST_I_TRY {
+        
         framework::init( init_func, argc, argv );
 
         if( runtime_config::get<bool>( runtime_config::btrt_wait_for_debugger ) ) {
@@ -247,14 +264,17 @@ unit_test_main( init_unit_test_func init_func, int argc, char* argv[] )
 
         result_code = boost::exit_exception_failure;
     }
+    BOOST_TEST_I_CATCH( std::logic_error, ex ) {
+        results_reporter::get_stream() << "Test setup error: " << ex.what() << std::endl;
+
+        result_code = boost::exit_exception_failure;
+    }
     BOOST_TEST_I_CATCHALL() {
         results_reporter::get_stream() << "Boost.Test framework internal error: unknown reason" << std::endl;
 
         result_code = boost::exit_exception_failure;
     }
 
-    framework::shutdown();
-
     return result_code;
 }