diff --git a/root/core/CMakeLists.txt b/root/core/CMakeLists.txt index 515a7b7728..b7fc561e0e 100644 --- a/root/core/CMakeLists.txt +++ b/root/core/CMakeLists.txt @@ -5,4 +5,6 @@ ROOTTEST_ADD_TEST(TEnv ROOTTEST_ADD_TEST(assertHumanReadable MACRO assertHumanReadable.cxx+ OUTREF assertHumanReadable.ref - ) \ No newline at end of file + ) + +ROOTTEST_ADD_TESTDIRS() diff --git a/root/core/sighandler/CMakeLists.txt b/root/core/sighandler/CMakeLists.txt new file mode 100644 index 0000000000..23970f120d --- /dev/null +++ b/root/core/sighandler/CMakeLists.txt @@ -0,0 +1,17 @@ +ROOTTEST_ADD_TEST(testSigBus + MACRO testSigBus.C + PASSREGEX "bus error") + +ROOTTEST_ADD_TEST(testSigSegV + MACRO testSigSegV.C + PASSREGEX "segmentation violation") + +ROOTTEST_ADD_TEST(testSigIll + MACRO testSigIll.C + PASSREGEX "illegal instruction") + +ROOTTEST_ADD_TEST(testSigFPE + MACRO testSigFPE.C + PASSREGEX "floating exception") + +ROOTTEST_ADD_TESTDIRS() diff --git a/root/core/sighandler/testSigBus.C b/root/core/sighandler/testSigBus.C new file mode 100644 index 0000000000..e3ba39ee38 --- /dev/null +++ b/root/core/sighandler/testSigBus.C @@ -0,0 +1,30 @@ +#include "TThread.h" +#include + +void *handle(void *ptr) +{ + long nr = (long) ptr; + void *mem = NULL; + for (int i = 0; ; i++) { + mem = malloc(8); + free(mem); + } + return 0; +} + +void testSigBus() +{ + TThread *h1 = new TThread("h1", handle, (void*) 1); + h1->Run(); + TThread *h2 = new TThread("h2", handle, (void*) 2); + h2->Run(); + TThread *h3 = new TThread("h3", handle, (void*) 3); + h3->Run(); + + kill(getpid(),SIGBUS); + + h1->Join(); + h2->Join(); + h3->Join(); +} + diff --git a/root/core/sighandler/testSigFPE.C b/root/core/sighandler/testSigFPE.C new file mode 100644 index 0000000000..c01be8dd73 --- /dev/null +++ b/root/core/sighandler/testSigFPE.C @@ -0,0 +1,30 @@ +#include "TThread.h" +#include + +void *handle(void *ptr) +{ + long nr = (long) ptr; + void *mem = NULL; + for (int i = 0; ; i++) { + mem = malloc(8); + free(mem); + } + return 0; +} + +void testSigFPE() +{ + TThread *h1 = new TThread("h1", handle, (void*) 1); + h1->Run(); + TThread *h2 = new TThread("h2", handle, (void*) 2); + h2->Run(); + TThread *h3 = new TThread("h3", handle, (void*) 3); + h3->Run(); + + kill(getpid(),SIGFPE); + + h1->Join(); + h2->Join(); + h3->Join(); +} + diff --git a/root/core/sighandler/testSigIll.C b/root/core/sighandler/testSigIll.C new file mode 100644 index 0000000000..79271c9c93 --- /dev/null +++ b/root/core/sighandler/testSigIll.C @@ -0,0 +1,30 @@ +#include "TThread.h" +#include + +void *handle(void *ptr) +{ + long nr = (long) ptr; + void *mem = NULL; + for (int i = 0; ; i++) { + mem = malloc(8); + free(mem); + } + return 0; +} + +void testSigIll() +{ + TThread *h1 = new TThread("h1", handle, (void*) 1); + h1->Run(); + TThread *h2 = new TThread("h2", handle, (void*) 2); + h2->Run(); + TThread *h3 = new TThread("h3", handle, (void*) 3); + h3->Run(); + + kill(getpid(),SIGILL); + + h1->Join(); + h2->Join(); + h3->Join(); +} + diff --git a/root/core/sighandler/testSigSegV.C b/root/core/sighandler/testSigSegV.C new file mode 100644 index 0000000000..d754b5abe8 --- /dev/null +++ b/root/core/sighandler/testSigSegV.C @@ -0,0 +1,30 @@ +#include "TThread.h" +#include + +void *handle(void *ptr) +{ + long nr = (long) ptr; + void *mem = NULL; + for (int i = 0; ; i++) { + mem = malloc(8); + free(mem); + } + return 0; +} + +void testSigSegV() +{ + TThread *h1 = new TThread("h1", handle, (void*) 1); + h1->Run(); + TThread *h2 = new TThread("h2", handle, (void*) 2); + h2->Run(); + TThread *h3 = new TThread("h3", handle, (void*) 3); + h3->Run(); + + kill(getpid(),SIGSEGV); + + h1->Join(); + h2->Join(); + h3->Join(); +} +