summaryrefslogtreecommitdiff
path: root/lib/drmtest.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-08-19 07:23:49 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-08-19 08:09:25 +0200
commit78865847f9fae7e590960f9836f2ec8b611a190e (patch)
tree48988bef5776f86641a5dfe68ef6f3eb49101fe3 /lib/drmtest.c
parent3df8300e23a6a610f738722872743b0670298f99 (diff)
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>
Diffstat (limited to 'lib/drmtest.c')
-rw-r--r--lib/drmtest.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c
index ac254ab8..f08392af 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -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,