aboutsummaryrefslogtreecommitdiff
path: root/tests/testutils.c
diff options
context:
space:
mode:
authorDavid Gibson <dgibson@sneetch.ozlabs.ibm.com>2005-11-22 16:46:40 +1100
committerDavid Gibson <dgibson@sneetch.ozlabs.ibm.com>2005-11-22 16:46:40 +1100
commit3627b79c57f38bb24c6c073fd679cb23aeecf344 (patch)
treecc4b604638166dad9593ad78633936b43853d4a4 /tests/testutils.c
parent95894b7cd7a36ecb3675650093351bc90918ed86 (diff)
downloadlibhugetlbfs-3627b79c57f38bb24c6c073fd679cb23aeecf344.tar.gz
Various updates.
Diffstat (limited to 'tests/testutils.c')
-rw-r--r--tests/testutils.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/testutils.c b/tests/testutils.c
index 40998d7..bd284d4 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -4,6 +4,7 @@
#include <stdlib.h>
#include <limits.h>
#include <string.h>
+#include <signal.h>
#include <sys/vfs.h>
#include "hugetests.h"
@@ -17,10 +18,26 @@ void __attribute__((weak)) cleanup(void)
{
}
+static void segv_handler(int signum, siginfo_t *si, void *uc)
+{
+ FAIL("Segmentation fault");
+}
+
+
void test_init(int argc, char *argv[])
{
+ int err;
+ struct sigaction sa = {
+ .sa_sigaction = segv_handler,
+ .sa_flags = SA_SIGINFO,
+ };
+
test_name = argv[0];
+ err = sigaction(SIGSEGV, &sa, NULL);
+ if (err)
+ FAIL("Can't install SEGV handler");
+
if (getenv("QUIET_TEST"))
verbose_test = 0;
}