mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-23 07:46:15 +00:00
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>
This commit is contained in:
parent
be955173d0
commit
578795ff95
@ -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.
|
||||
|
@ -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())
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user