diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-08-19 07:28:42 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-08-19 08:09:25 +0200 |
commit | 47a32a3aec22f3252a5f551d7b52bb3c2886d0a7 (patch) | |
tree | 21c020fc80404cdc06cd5bf844adf05d1ebc8ce6 /lib/drmtest.c | |
parent | 78865847f9fae7e590960f9836f2ec8b611a190e (diff) |
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>
Diffstat (limited to 'lib/drmtest.c')
-rw-r--r-- | lib/drmtest.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c index f08392af..dac244c6 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -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); } } |