lib/drmtest: make igt_fail work outside of subtests

With the abortable fixtures we can now correctly fail all subsequent
sutbests if we hit upon an igt_assert outside of a subtest.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter 2013-08-19 07:28:42 +02:00
parent 78865847f9
commit 47a32a3aec

View File

@ -691,7 +691,9 @@ static char *run_single_subtest = NULL;
static const char *in_subtest = NULL;
static bool in_fixture = false;
static bool test_with_subtests = false;
static bool skip_subtests_henceforth = false;
static enum {
CONT = 0, SKIP, FAIL
} skip_subtests_henceforth = CONT;
bool __igt_fixture(void)
{
@ -759,7 +761,9 @@ bool __igt_run_subtest(const char *subtest_name)
}
if (skip_subtests_henceforth) {
printf("Subtest %s: SKIP\n", subtest_name);
printf("Subtest %s: %s\n", subtest_name,
skip_subtests_henceforth == SKIP ?
"SKIP" : "FAIL");
return false;
}
@ -803,7 +807,7 @@ void igt_skip(void)
if (in_subtest) {
exit_subtest("SKIP");
} else if (test_with_subtests) {
skip_subtests_henceforth = true;
skip_subtests_henceforth = SKIP;
if (in_fixture)
__igt_fixture_end();
} else {
@ -841,7 +845,13 @@ void igt_fail(int exitcode)
if (in_subtest)
exit_subtest("FAIL");
else {
assert(!test_with_subtests);
assert(!test_with_subtests || in_fixture);
if (in_fixture) {
skip_subtests_henceforth = FAIL;
__igt_fixture_end();
}
exit(exitcode);
}
}