diff options
author | Benoit Foucher <benoit@zeroc.com> | 2018-04-01 08:14:22 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2018-04-01 08:14:22 +0200 |
commit | ab836be545d3d1d4b320e79383dbb988426e335c (patch) | |
tree | 8a08e5d8b6c5d19f7c7d901a0c716cc8b781867b /cpp/test/include | |
parent | Fixed C++ connection factory build failure (diff) | |
download | ice-ab836be545d3d1d4b320e79383dbb988426e335c.tar.bz2 ice-ab836be545d3d1d4b320e79383dbb988426e335c.tar.xz ice-ab836be545d3d1d4b320e79383dbb988426e335c.zip |
Fixed test controller to not let test failure go unnoticed (ICE-8776)v3.7.1-rc0
Diffstat (limited to 'cpp/test/include')
-rw-r--r-- | cpp/test/include/TestCommon.h | 56 |
1 files changed, 11 insertions, 45 deletions
diff --git a/cpp/test/include/TestCommon.h b/cpp/test/include/TestCommon.h index 8a04a9fc081..609d7a39b14 100644 --- a/cpp/test/include/TestCommon.h +++ b/cpp/test/include/TestCommon.h @@ -125,50 +125,8 @@ int mainEntryPoint(int, char**); } -class TestFailedException : public ::Ice::LocalException +class TestFailedException { -public: - - TestFailedException(const char* file, int line) : - LocalException(file, line) - { - } - - TestFailedException(const char* file, int line, const ::std::string& r) : - LocalException(file, line), - reason(r) - { - } - -#ifndef ICE_CPP11_COMPILER - virtual ~TestFailedException() throw() - { - } -#endif - - virtual ::std::string ice_id() const - { - return "::TestFailedException"; - } - -#ifdef ICE_CPP11_MAPPING - virtual IceUtil::Exception* ice_cloneImpl() const - { - return new TestFailedException(*this); - } -#else - virtual TestFailedException* ice_clone() const - { - return new TestFailedException(*this); - } -#endif - - virtual void ice_throw() const - { - throw *this; - } - - ::std::string reason; }; void @@ -176,7 +134,7 @@ inline testFailed(const char* expr, const char* file, unsigned int line) { std::cout << "failed!" << std::endl; std::cout << file << ':' << line << ": assertion `" << expr << "' failed" << std::endl; - throw TestFailedException(__FILE__, __LINE__, "Test Failed"); + throw TestFailedException(); } #define DEFINE_TEST(name) \ @@ -195,7 +153,15 @@ inline testFailed(const char* expr, const char* file, unsigned int line) int dllMain(int argc, char** argv, Test::MainHelper* helper) \ { \ Test::MainHelperInit init(helper, name, helper->redirect()); \ - int status = Test::mainEntryPoint(argc, argv); \ + int status; \ + try \ + { \ + status = Test::mainEntryPoint(argc, argv); \ + } \ + catch(const TestFailedException&) \ + { \ + status = 1; \ + } \ communicatorInstance = ICE_NULLPTR; \ return status; \ } \ |