Skip to contentSkip to conversation

tests/gem_exec_reloc: Call igt_(dis)allow_hang inside subtest block

PATCH In review Petri Latvala 2 participants 4 messages Feb 6, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/gem_exec_reloc: Call igt_(dis)allow_hang inside subtest block

gem_exec_reloc --list-subtests breaks otherwise.

---
 tests/gem_exec_reloc.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
tests/gem_exec_reloc.c +8 -7
index 78bb59c..012abc2 100644
@@ -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")
Signature · 6 lines
2.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 13 lines · Petri Latvala

gem_exec_reloc --list-subtests breaks otherwise.

---
 tests/gem_exec_reloc.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
tests/gem_exec_reloc.c +0 -0
index 78bb59c..012abc2 100644

tests/gem_exec_reloc.c igt_main · line 555

Quoted 6 lines
tests/gem_exec_reloc.c +0 -3
@@ -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

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 1/1 tests/gem_exec_reloc: Don't call igt_(dis)allow_hang outside fixtures

gem_exec_reloc --list-subtests breaks otherwise.

v2: use igt_subtest_group (Chris)

---
 tests/gem_exec_reloc.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)
tests/gem_exec_reloc.c +18 -12
index 78bb59c..8356d85 100644
@@ -550,19 +550,25 @@ 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)
-				basic_reloc(fd, m->before, m->after, f->flags);
+		igt_subtest_group {
+			igt_fixture {
+				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)
+					basic_reloc(fd, m->before, m->after, f->flags);
+			}
+
+			igt_fixture {
+				if (f->flags & HANG)
+					igt_disallow_hang(fd, hang);
+			}
 		}
-
-		if (f->flags & HANG)
-			igt_disallow_hang(fd, hang);
 	}
 
 	igt_subtest("basic-softpin")
Signature · 6 lines
2.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#3 lore raw

Re: [PATCH i-g-t] tests/gem_exec_reloc: Don't call igt_(dis)allow_hang outside fixtures

Quoted 6 lines · Petri Latvala

gem_exec_reloc --list-subtests breaks otherwise.

v2: use igt_subtest_group (Chris)

Lgtm, thanks.

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx