summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_core.c10
-rw-r--r--lib/igt_core.h6
2 files changed, 9 insertions, 7 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.
diff --git a/lib/igt_core.h b/lib/igt_core.h
index 3a9e5822..b15d9ffe 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -107,7 +107,7 @@ void __igt_fixture_end(void) __attribute__((noreturn));
#define igt_fixture for (int igt_tokencat(__tmpint,__LINE__) = 0; \
igt_tokencat(__tmpint,__LINE__) < 1 && \
__igt_fixture() && \
- (setjmp(igt_subtest_jmpbuf) == 0); \
+ (sigsetjmp(igt_subtest_jmpbuf, 1) == 0); \
igt_tokencat(__tmpint,__LINE__) ++, \
__igt_fixture_complete())
@@ -164,14 +164,14 @@ bool __igt_run_subtest(const char *subtest_name);
* This is a simpler version of igt_subtest_f()
*/
#define igt_subtest(name) for (; __igt_run_subtest((name)) && \
- (setjmp(igt_subtest_jmpbuf) == 0); \
+ (sigsetjmp(igt_subtest_jmpbuf, 1) == 0); \
igt_success())
#define __igt_subtest_f(tmp, format...) \
for (char tmp [256]; \
snprintf( tmp , sizeof( tmp ), \
format), \
__igt_run_subtest( tmp ) && \
- (setjmp(igt_subtest_jmpbuf) == 0); \
+ (sigsetjmp(igt_subtest_jmpbuf, 1) == 0); \
igt_success())
/**