diff options
author | Gav Wood <g@ethdev.com> | 2015-08-13 21:02:02 +0800 |
---|---|---|
committer | Gav Wood <g@ethdev.com> | 2015-08-13 21:02:02 +0800 |
commit | 95974f1a92f690a0502dd01b382fccf3a29dc947 (patch) | |
tree | 478521997ac71a5cfe91a4016944e2fe63d374af /boostTest.cpp | |
parent | 7f1d288f62b1bd68cd2d896ca5e9bdbd9cad2423 (diff) | |
parent | 30f37815296f61d2c236b493b3e66870cdaccf56 (diff) | |
download | dexon-solidity-95974f1a92f690a0502dd01b382fccf3a29dc947.tar dexon-solidity-95974f1a92f690a0502dd01b382fccf3a29dc947.tar.gz dexon-solidity-95974f1a92f690a0502dd01b382fccf3a29dc947.tar.bz2 dexon-solidity-95974f1a92f690a0502dd01b382fccf3a29dc947.tar.lz dexon-solidity-95974f1a92f690a0502dd01b382fccf3a29dc947.tar.xz dexon-solidity-95974f1a92f690a0502dd01b382fccf3a29dc947.tar.zst dexon-solidity-95974f1a92f690a0502dd01b382fccf3a29dc947.zip |
Merge pull request #2604 from winsvega/verbosity
Nice Error Report
Diffstat (limited to 'boostTest.cpp')
-rw-r--r-- | boostTest.cpp | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/boostTest.cpp b/boostTest.cpp index 1523a7a1..f448c48e 100644 --- a/boostTest.cpp +++ b/boostTest.cpp @@ -18,11 +18,75 @@ * @author Marko Simovic <markobarko@gmail.com> * @date 2014 * Stub for generating main boost.test module. + * Original code taken from boost sources. */ #define BOOST_TEST_MODULE EthereumTests #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" -#define BOOST_DISABLE_WIN32 //disables SEH warning +//#define BOOST_DISABLE_WIN32 //disables SEH warning +#define BOOST_TEST_NO_MAIN #include <boost/test/included/unit_test.hpp> #pragma GCC diagnostic pop + +#include <test/TestHelper.h> +using namespace boost::unit_test; + +//Custom Boost Initialization +test_suite* init_func( int argc, char* argv[] ) +{ + if (argc == 0) + argv[1]=(char*)"a"; + + dev::test::Options::get(); + + return 0; +} + +//Custom Boost Unit Test Main +int main( int argc, char* argv[] ) +{ + try + { + framework::init( init_func, argc, argv ); + + if( !runtime_config::test_to_run().is_empty() ) + { + test_case_filter filter( runtime_config::test_to_run() ); + + traverse_test_tree( framework::master_test_suite().p_id, filter ); + } + + framework::run(); + + results_reporter::make_report(); + + return runtime_config::no_result_code() + ? boost::exit_success + : results_collector.results( framework::master_test_suite().p_id ).result_code(); + } + catch (framework::nothing_to_test const&) + { + return boost::exit_success; + } + catch (framework::internal_error const& ex) + { + results_reporter::get_stream() << "Boost.Test framework internal error: " << ex.what() << std::endl; + + return boost::exit_exception_failure; + } + catch (framework::setup_error const& ex) + { + results_reporter::get_stream() << "Test setup error: " << ex.what() << std::endl; + + return boost::exit_exception_failure; + } + catch (...) + { + results_reporter::get_stream() << "Boost.Test framework internal error: unknown reason" << std::endl; + + return boost::exit_exception_failure; + } + + return 0; +} |