diff mbox

[i-g-t] tests/gem_exec_reloc: Call igt_(dis)allow_hang inside subtest block

Message ID 1486376161-550-1-git-send-email-petri.latvala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Petri Latvala Feb. 6, 2017, 10:16 a.m. UTC
gem_exec_reloc --list-subtests breaks otherwise.

CC: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
---
 tests/gem_exec_reloc.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Comments

Chris Wilson Feb. 6, 2017, 10:39 a.m. UTC | #1
On Mon, Feb 06, 2017 at 12:16:01PM +0200, Petri Latvala wrote:
> gem_exec_reloc --list-subtests breaks otherwise.
> 
> CC: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> ---
>  tests/gem_exec_reloc.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/gem_exec_reloc.c b/tests/gem_exec_reloc.c
> index 78bb59c..012abc2 100644
> --- a/tests/gem_exec_reloc.c
> +++ b/tests/gem_exec_reloc.c
> @@ -550,19 +550,20 @@ igt_main
>  	for (f = flags; f->name; f++) {
>  		igt_hang_t hang;
>  
> -		if (f->flags & HANG)
> -			hang = igt_allow_hang(fd, 0, 0);
> -

I keep forgetting what can and can't be called outside of igt_subtest.
Ok, I keep forgetting that we can't call everything outside of a
fixture.

In this case, doing a

	igt_subtest_group {
		igt_fixture {
			if (f->flags & HANG)
				hang = igt_allow_hang(fd, 0, 0);
		}

		....

		igt_fixture {
			if (f->flags & HANG)
				igt_disallow_hang(fd, hang);
		}
	}

might allow for future expansion more easily, and the subtest grouping
will help error recovery between different combinations.
-Chris
diff mbox

Patch

diff --git a/tests/gem_exec_reloc.c b/tests/gem_exec_reloc.c
index 78bb59c..012abc2 100644
--- a/tests/gem_exec_reloc.c
+++ b/tests/gem_exec_reloc.c
@@ -550,19 +550,20 @@  igt_main
 	for (f = flags; f->name; f++) {
 		igt_hang_t hang;
 
-		if (f->flags & HANG)
-			hang = igt_allow_hang(fd, 0, 0);
-
 		for (m = modes; m->name; m++) {
 			igt_subtest_f("%s%s%s",
 				      f->basic ? "basic-" : "",
 				      m->name,
-				      f->name)
+				      f->name) {
+				if (f->flags & HANG)
+					hang = igt_allow_hang(fd, 0, 0);
+
 				basic_reloc(fd, m->before, m->after, f->flags);
-		}
 
-		if (f->flags & HANG)
-			igt_disallow_hang(fd, hang);
+				if (f->flags & HANG)
+					igt_disallow_hang(fd, hang);
+			}
+		}
 	}
 
 	igt_subtest("basic-softpin")