From ee4adf600bdd3aa60cc0e92a39f2111be0a90bc6 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 27 May 2015 15:00:06 +0200 Subject: Added library for supporting unit tests (nw) --- .../UnitTest++/Posix/SignalTranslator.h | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.h (limited to '3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.h') diff --git a/3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.h b/3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.h new file mode 100644 index 00000000000..50da5f996f6 --- /dev/null +++ b/3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.h @@ -0,0 +1,42 @@ +#ifndef UNITTEST_SIGNALTRANSLATOR_H +#define UNITTEST_SIGNALTRANSLATOR_H + +#include +#include + +namespace UnitTest { + +class SignalTranslator +{ +public: + SignalTranslator(); + ~SignalTranslator(); + + static sigjmp_buf* s_jumpTarget; + +private: + sigjmp_buf m_currentJumpTarget; + sigjmp_buf* m_oldJumpTarget; + + struct sigaction m_old_SIGFPE_action; + struct sigaction m_old_SIGTRAP_action; + struct sigaction m_old_SIGSEGV_action; + struct sigaction m_old_SIGBUS_action; + struct sigaction m_old_SIGABRT_action; + struct sigaction m_old_SIGALRM_action; +}; + +#if !defined (__GNUC__) + #define UNITTEST_EXTENSION +#else + #define UNITTEST_EXTENSION __extension__ +#endif + +#define UNITTEST_THROW_SIGNALS_POSIX_ONLY \ + UnitTest::SignalTranslator sig; \ + if (UNITTEST_EXTENSION sigsetjmp(*UnitTest::SignalTranslator::s_jumpTarget, 1) != 0) \ + throw ("Unhandled system exception"); + +} + +#endif -- cgit v1.2.3 From eab88c568793f9d84fc612d83d25337df4d7a2ee Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Wed, 27 May 2015 16:39:12 +0300 Subject: Fixed clang build. (nw) --- 3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to '3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.h') diff --git a/3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.h b/3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.h index 50da5f996f6..5b98d977b93 100644 --- a/3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.h +++ b/3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.h @@ -22,8 +22,8 @@ private: struct sigaction m_old_SIGTRAP_action; struct sigaction m_old_SIGSEGV_action; struct sigaction m_old_SIGBUS_action; - struct sigaction m_old_SIGABRT_action; - struct sigaction m_old_SIGALRM_action; + //struct sigaction m_old_SIGABRT_action; + //struct sigaction m_old_SIGALRM_action; }; #if !defined (__GNUC__) @@ -35,7 +35,7 @@ private: #define UNITTEST_THROW_SIGNALS_POSIX_ONLY \ UnitTest::SignalTranslator sig; \ if (UNITTEST_EXTENSION sigsetjmp(*UnitTest::SignalTranslator::s_jumpTarget, 1) != 0) \ - throw ("Unhandled system exception"); + throw ("Unhandled system exception"); } -- cgit v1.2.3