[igt-dev] [PATCH i-g-t] tests/prime_vgem: fix test listing problem

Kamil Konieczny kamil.konieczny at linux.intel.com
Wed Jan 18 14:59:54 UTC 2023


Move call to function with possible usage of card fd inside
of subtest code. Such uses are allowed inside fixups or subtests.
This may eliminate problem when using --list-subtests option,
depending on implementation it can assert like:

sudo build/tests/prime_vgem --list-subtests
...
coherency-blt
(prime_vgem:259195) intel_ctx-CRITICAL: Test assertion failure function intel_ctx_create_all_physical, file ../lib/intel_ctx.c:344:
(prime_vgem:259195) intel_ctx-CRITICAL: Failed assertion: err == 0
(prime_vgem:259195) intel_ctx-CRITICAL: error: -9 != 0
Test prime_vgem failed.

Reported-by: Petri Latvala <petri.latvala at intel.com>
Cc: Petri Latvala <petri.latvala at intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 tests/prime_vgem.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
index f876e748..1eaf19d4 100644
--- a/tests/prime_vgem.c
+++ b/tests/prime_vgem.c
@@ -1093,9 +1093,10 @@ static void test_each_engine(const char *name, int vgem, int i915,
 					unsigned int flags))
 {
 	const struct intel_execution_engine2 *e;
-	const intel_ctx_t *ctx = intel_ctx_create_all_physical(i915);
 
 	igt_subtest_with_dynamic(name) {
+		const intel_ctx_t *ctx = intel_ctx_create_all_physical(i915);
+
 		for_each_ctx_engine(i915, ctx, e) {
 			if (!gem_class_can_store_dword(i915, e->class))
 				continue;
@@ -1108,9 +1109,9 @@ static void test_each_engine(const char *name, int vgem, int i915,
 				fn(i915, vgem, ctx, e->flags);
 			}
 		}
-	}
 
-	intel_ctx_destroy(i915, ctx);
+		intel_ctx_destroy(i915, ctx);
+	}
 }
 
 igt_main
-- 
2.37.2



More information about the igt-dev mailing list