From b95ef6de0460d98d2105ef6b7e0d8f2d30c675cc Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 10 May 2017 19:02:47 +0100 Subject: [PATCH] Generate less output in merge_exception_tests --- test/exception/merge_exception_tests.cpp | 2 +- test/helpers/test.hpp | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/test/exception/merge_exception_tests.cpp b/test/exception/merge_exception_tests.cpp index 496c01e7..f22f0c36 100644 --- a/test/exception/merge_exception_tests.cpp +++ b/test/exception/merge_exception_tests.cpp @@ -105,4 +105,4 @@ UNORDERED_TEST(merge_exception_test, ) // clang-format on -RUN_TESTS() +RUN_TESTS_QUIET() diff --git a/test/helpers/test.hpp b/test/helpers/test.hpp index c87a14dd..92d4cc1a 100644 --- a/test/helpers/test.hpp +++ b/test/helpers/test.hpp @@ -31,6 +31,14 @@ return boost::report_errors(); \ } +#define RUN_TESTS_QUIET() \ + int main(int, char**) \ + { \ + BOOST_UNORDERED_TEST_COMPILER_INFO() \ + ::test::test_list::run_tests(true); \ + return boost::report_errors(); \ + } + namespace test { struct registered_test_base { @@ -65,13 +73,20 @@ static inline void add_test(registered_test_base* test) last() = test; } -static inline void run_tests() +static inline void run_tests(bool quiet = false) { for (registered_test_base* i = first(); i; i = i->next) { - BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Running " << i->name << "\n" - << std::flush; + int error_count = boost::detail::test_errors(); + if (!quiet) { + BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Running " << i->name << "\n" + << std::flush; + } i->run(); BOOST_LIGHTWEIGHT_TEST_OSTREAM << std::flush; + if (quiet && error_count != boost::detail::test_errors()) { + BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Error in: " << i->name << "\n" + << std::flush; + } } } }