]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/test/test/framework-ts/log-formatter-test.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / test / test / framework-ts / log-formatter-test.cpp
index 59051568d14778b0715b833a56d39986461f0cca..02df428f7924eeda01f7e7391b2c79c26f5e5138 100644 (file)
@@ -17,6 +17,8 @@
 #include <boost/test/framework.hpp>
 #include <boost/test/unit_test_parameters.hpp>
 #include <boost/test/utils/nullstream.hpp>
+#include <boost/test/execution_monitor.hpp>
+
 typedef boost::onullstream onullstream_type;
 
 // BOOST
@@ -76,6 +78,16 @@ void very_bad_exception()  {
 
 void bad_foo2() { bad_foo(); } // tests with clashing names
 
+void timeout_foo()
+{
+    using boost::execution_exception;
+    execution_exception::location dummy;
+    throw execution_exception(
+          execution_exception::timeout_error,
+          "fake  timeout",
+          dummy);
+}
+
 //____________________________________________________________________________//
 
 void check( output_test_stream& output,
@@ -127,7 +139,7 @@ struct guard {
 BOOST_AUTO_TEST_CASE( test_logs )
 {
     guard G;
-    ut_detail::ignore_unused_variable_warning( G );
+    boost::ignore_unused( G );
 
 #define PATTERN_FILE_NAME "log-formatter-test.pattern"
 
@@ -178,6 +190,20 @@ BOOST_AUTO_TEST_CASE( test_logs )
         ts_main->add( ts_3 );
         ts_main->add( ts_4 );
 
+    test_suite* ts_timeout = BOOST_TEST_SUITE( "Timeout" );
+        ts_timeout->add( BOOST_TEST_CASE( good_foo ) );
+        test_case * tc_timeout = BOOST_TEST_CASE( timeout_foo );
+        ts_timeout->add( tc_timeout );
+
+    test_suite* ts_timeout_nested = BOOST_TEST_SUITE( "Timeout-nested" );
+        ts_timeout_nested->add( BOOST_TEST_CASE( good_foo ) );
+        test_suite* ts_timeout_internal = BOOST_TEST_SUITE( "Timeout" );
+          ts_timeout_internal->add( BOOST_TEST_CASE( good_foo ) );
+          test_case * tc_timeout_internal = BOOST_TEST_CASE( timeout_foo );
+          ts_timeout_internal->add( tc_timeout_internal );
+        ts_timeout_nested->add( ts_timeout_internal );
+        ts_timeout_nested->add( BOOST_TEST_CASE_NAME( good_foo, "good_foo2" ) );
+
     check( test_output, ts_1 );
 
     check( test_output, ts_1b );
@@ -194,6 +220,10 @@ BOOST_AUTO_TEST_CASE( test_logs )
     ts_3->depends_on( ts_1 );
 
     check( test_output, ts_main );
+
+    check( test_output, ts_timeout );
+
+    check( test_output, ts_timeout_nested );
 }
 
 //____________________________________________________________________________//
@@ -201,7 +231,7 @@ BOOST_AUTO_TEST_CASE( test_logs )
 BOOST_AUTO_TEST_CASE( test_logs_junit_info_closing_tags )
 {
     guard G;
-    ut_detail::ignore_unused_variable_warning( G );
+    boost::ignore_unused( G );
 
 #define PATTERN_FILE_NAME_JUNIT "log-formatter-test.pattern.junit"
 
@@ -226,6 +256,27 @@ BOOST_AUTO_TEST_CASE( test_logs_junit_info_closing_tags )
     boost::unit_test::framework::impl::setup_for_execution( *ts_main );
 
     check( test_output, OF_JUNIT, ts_main->p_id, log_successful_tests );
+
+    test_suite* ts_timeout = BOOST_TEST_SUITE( "Timeout" );
+        ts_timeout->add( BOOST_TEST_CASE( good_foo ) );
+        test_case * tc_timeout = BOOST_TEST_CASE( timeout_foo );
+        ts_timeout->add( tc_timeout );
+
+    check( test_output, OF_JUNIT, ts_timeout->p_id, log_successful_tests );
+
+
+    test_suite* ts_account_failures = BOOST_TEST_SUITE( "1 junit failure is not error" );
+        ts_account_failures->add( BOOST_TEST_CASE( bad_foo ) );
+        ts_account_failures->add( BOOST_TEST_CASE( very_bad_foo ) );
+        ts_account_failures->add( BOOST_TEST_CASE( good_foo ) );
+        ts_account_failures->add( BOOST_TEST_CASE( bad_foo2 ) );
+
+    char const* argv2[] = { "a.exe", "--run_test=*", "--build_info=false"  };
+    int argc2 = sizeof(argv2)/sizeof(argv2[0]);
+    boost::unit_test::runtime_config::init( argc2, (char**)argv2 );
+    boost::unit_test::framework::impl::setup_for_execution( *ts_account_failures );
+
+    check( test_output, OF_JUNIT, ts_account_failures->p_id, log_messages );
 }
 
 // EOF