summaryrefslogtreecommitdiff
path: root/lib/igt_core.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-05-08 14:35:37 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2015-05-08 14:42:27 +0100
commit578795ff9549f680d426879cf19ef6124a51fcc4 (patch)
tree7fc95b33d2c2330f00db0dc399750c5221464f1d /lib/igt_core.c
parentbe955173d0481dd7f5dabe4a8531811d17e66470 (diff)
lib: Teach igt to handle signal failures gracefully
If we see a fatal signal in a subtest, fail. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_core.c')
-rw-r--r--lib/igt_core.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index e746832e..251cfd23 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -368,7 +368,7 @@ void __igt_fixture_end(void)
assert(in_fixture);
in_fixture = false;
- longjmp(igt_subtest_jmpbuf, 1);
+ siglongjmp(igt_subtest_jmpbuf, 1);
}
/*
@@ -821,7 +821,7 @@ static void exit_subtest(const char *result)
printf("Subtest %s: %s (%.3fs)\n", in_subtest, result, elapsed);
in_subtest = NULL;
- longjmp(igt_subtest_jmpbuf, 1);
+ siglongjmp(igt_subtest_jmpbuf, 1);
}
/**
@@ -1409,8 +1409,6 @@ static void fatal_sig_handler(int sig)
{
int i;
- restore_all_sig_handler();
-
for (i = 0; i < ARRAY_SIZE(handled_signals); i++) {
if (handled_signals[i].number != sig)
continue;
@@ -1423,9 +1421,13 @@ static void fatal_sig_handler(int sig)
igt_assert_eq(write(STDERR_FILENO, ".\n", 2), 2);
}
+ if (in_subtest)
+ exit_subtest("CRASH");
break;
}
+ restore_all_sig_handler();
+
/*
* exit_handler_disabled is always false here, since when we set it
* we also block signals.