Mercurial > fife-parpg
comparison ext/UnitTest++/src/Posix/SignalTranslator.h @ 37:0d325e9d5953
added unittest++ files into ext. Not hooked into build scripts yet
author | jasoka@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 12 Jul 2008 12:00:57 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
36:6f1227f4932b | 37:0d325e9d5953 |
---|---|
1 #ifndef UNITTEST_SIGNALTRANSLATOR_H | |
2 #define UNITTEST_SIGNALTRANSLATOR_H | |
3 | |
4 #include <setjmp.h> | |
5 #include <signal.h> | |
6 | |
7 namespace UnitTest { | |
8 | |
9 class SignalTranslator | |
10 { | |
11 public: | |
12 SignalTranslator(); | |
13 ~SignalTranslator(); | |
14 | |
15 static sigjmp_buf* s_jumpTarget; | |
16 | |
17 private: | |
18 sigjmp_buf m_currentJumpTarget; | |
19 sigjmp_buf* m_oldJumpTarget; | |
20 | |
21 struct sigaction m_old_SIGFPE_action; | |
22 struct sigaction m_old_SIGTRAP_action; | |
23 struct sigaction m_old_SIGSEGV_action; | |
24 struct sigaction m_old_SIGBUS_action; | |
25 struct sigaction m_old_SIGABRT_action; | |
26 struct sigaction m_old_SIGALRM_action; | |
27 }; | |
28 | |
29 #ifdef SOLARIS | |
30 #define UNITTEST_EXTENSION | |
31 #else | |
32 #define UNITTEST_EXTENSION __extension__ | |
33 #endif | |
34 | |
35 #define UNITTEST_THROW_SIGNALS \ | |
36 UnitTest::SignalTranslator sig; \ | |
37 if (UNITTEST_EXTENSION sigsetjmp(*UnitTest::SignalTranslator::s_jumpTarget, 1) != 0) \ | |
38 throw ("Unhandled system exception"); | |
39 | |
40 } | |
41 | |
42 #endif |