lib/drmtest: skip fixtures after an igt_skip

This way we can just enclose all igt_skip/igt_require calls into
fixtures even when we have subtests, and still output correct SKIP
message for all of them. Wohoo, magic!

The only thing which doesn't work yet is enumerating failed subtests,
but I think that should work out on top of this.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter
2013-08-19 07:23:49 +02:00
parent 3df8300e23
commit 78865847f9
2 changed files with 35 additions and 6 deletions
+30 -4
View File
@@ -620,6 +620,8 @@ off_t prime_get_size(int dma_buf_fd)
}
/* signal interrupt helpers */
static bool igt_only_list_subtests(void);
static pid_t signal_helper = -1;
long long int sig_stat;
static void __attribute__((noreturn)) signal_helper_process(pid_t pid)
@@ -687,9 +689,28 @@ void igt_stop_signal_helper(void)
static bool list_subtests = false;
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;
bool __igt_fixture(void)
{
if (igt_only_list_subtests())
return false;
if (skip_subtests_henceforth)
return false;
in_fixture = true;
return true;
}
void __igt_fixture_end(void)
{
in_fixture = false;
longjmp(igt_subtest_jmpbuf, 1);
}
void igt_subtest_init(int argc, char **argv)
{
int c, option_index = 0;
@@ -730,6 +751,7 @@ out:
bool __igt_run_subtest(const char *subtest_name)
{
assert(!in_subtest);
assert(!in_fixture);
if (list_subtests) {
printf("%s\n", subtest_name);
@@ -756,7 +778,7 @@ const char *igt_subtest_name(void)
return in_subtest;
}
bool igt_only_list_subtests(void)
static bool igt_only_list_subtests(void)
{
return list_subtests;
}
@@ -777,12 +799,16 @@ static void exit_subtest(const char *result)
void igt_skip(void)
{
skipped_one = true;
if (in_subtest)
if (in_subtest) {
exit_subtest("SKIP");
else if (test_with_subtests)
} else if (test_with_subtests) {
skip_subtests_henceforth = true;
else
if (in_fixture)
__igt_fixture_end();
} else {
exit(77);
}
}
void __igt_skip_check(const char *file, const int line,