diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-03-18 21:46:54 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-03-19 10:37:40 +0100 |
commit | 72d04b8453bf74b1fcd73f898c13398db4abc381 (patch) | |
tree | bd5089d4a99631e2a0bb8439dc1f46dc079bfafd /lib/igt_core.c | |
parent | f129ee8a39eaaa2b9a8c97d845309e372af00ce9 (diff) |
lib: Add igt_subtest_group
Useful for creating common setup code in igt_fixture which is only
needed by a subset of tests. And since I'm a good citizen it comes
with a library testcase/example included.
v2: Make testcase nastier to ensure a subtest group SKIPS when it's
parent is skipping already. I accidentally got this right, but let's
make sure.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/igt_core.c')
-rw-r--r-- | lib/igt_core.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c index 3c092a5f..947a9ca3 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -97,7 +97,9 @@ * * To allow this i-g-t provides #igt_fixture code blocks for setup code outside * of subtests and automatically skips the subtest code blocks themselves. For - * special cases igt_only_list_subtests() is also provided. + * special cases igt_only_list_subtests() is also provided. For setup code only + * shared by a group of subtest encapsulate the #igt_fixture block and all the + * subtestest in a #igt_subtest_group block. * * # Magic Control Blocks * @@ -889,6 +891,16 @@ bool igt_only_list_subtests(void) return list_subtests; } +void __igt_subtest_group_save(int *save) +{ + *save = skip_subtests_henceforth; +} + +void __igt_subtest_group_restore(int save) +{ + skip_subtests_henceforth = save; +} + static bool skipped_one = false; static bool succeeded_one = false; static bool failed_one = false; |