All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Bommu Krishnaiah <krishnaiah.bommu@intel.com>,
	Intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t v3] tests/i915/gem_ctx_persistence: Convert engine subtests to dynamic
Date: Thu, 30 Jan 2020 21:01:25 +0000	[thread overview]
Message-ID: <20200130210125.5623-1-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20200130204124.29907-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Converts all per-engine tests into dynamic subtests and in the process:

 * Put back I915_EXEC_BSD legacy coverage.
 * Remove one added static engine list usage.
 * Compact code by driving two groups of the name/func table.

v2:
 * Convert smoketest to proper all engines.

v3:
 * Undo subgroup mistake. (Chris)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
---
 tests/i915/gem_ctx_persistence.c | 110 ++++++++++++++-----------------
 1 file changed, 50 insertions(+), 60 deletions(-)

diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c
index 8b9633b214ff..67bee72da6ca 100644
--- a/tests/i915/gem_ctx_persistence.c
+++ b/tests/i915/gem_ctx_persistence.c
@@ -693,6 +693,7 @@ static void __smoker(int i915, unsigned int engine, int expected)
 	int fd, extra;
 
 	fd = gem_reopen_driver(i915);
+	gem_context_copy_engines(i915, 0, fd, 0);
 	gem_context_set_persistence(fd, 0, expected > 0);
 	spin = igt_spin_new(fd, .engine = engine, .flags = IGT_SPIN_FENCE_OUT);
 
@@ -721,7 +722,7 @@ static void __smoker(int i915, unsigned int engine, int expected)
 	}
 
 	spin->handle = 0;
-	igt_spin_free(i915, spin);
+	igt_spin_free(fd, spin);
 }
 
 static void smoker(int i915, unsigned int engine, unsigned int *ctl)
@@ -734,6 +735,7 @@ static void smoker(int i915, unsigned int engine, unsigned int *ctl)
 
 static void smoketest(int i915)
 {
+	const struct intel_execution_engine2 *e;
 	uint32_t *ctl;
 
 	/*
@@ -744,9 +746,9 @@ static void smoketest(int i915)
 	ctl = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(ctl != MAP_FAILED);
 
-	for_each_physical_engine(e, i915) {
+	__for_each_physical_engine(i915, e) {
 		igt_fork(child, 4)
-			smoker(i915, eb_ring(e), ctl);
+			smoker(i915, e->flags, ctl);
 	}
 
 	sleep(20);
@@ -759,7 +761,20 @@ static void smoketest(int i915)
 
 igt_main
 {
-	const struct intel_execution_engine2 *e;
+	struct {
+		const char *name;
+		void (*func)(int fd, unsigned int engine);
+	} *test, tests[] = {
+		{ "persistence", test_persistence },
+		{ "cleanup", test_nonpersistent_cleanup },
+		{ "queued", test_nonpersistent_queued },
+		{ "mixed", test_nonpersistent_mixed },
+		{ "mixed-process", test_process_mixed },
+		{ "hostile", test_nonpersistent_hostile },
+		{ "hostile-preempt", test_nonpersistent_hostile_preempt },
+		{ "hang", test_nonpersistent_hang },
+		{ NULL, NULL },
+	};
 	int i915;
 
 	igt_fixture {
@@ -772,6 +787,8 @@ igt_main
 		igt_allow_hang(i915, 0, 0);
 	}
 
+	/* Legacy execbuf engine selection flags. */
+
 	igt_subtest("idempotent")
 		test_idempotent(i915);
 
@@ -792,71 +809,44 @@ igt_main
 	igt_subtest("hang")
 		test_nohangcheck_hang(i915);
 
-	__for_each_static_engine(e) {
-		igt_subtest_group {
-			igt_fixture {
-				gem_require_ring(i915, e->flags);
-				gem_require_contexts(i915);
+	igt_subtest_group {
+		igt_fixture
+			gem_require_contexts(i915);
+
+		for (test = tests; test->name; test++) {
+			igt_subtest_with_dynamic_f("legacy-engines-%s",
+						   test->name) {
+				for_each_engine(e, i915) {
+					igt_dynamic_f("%s", e->name)
+						test->func(i915, eb_ring(e));
+				}
 			}
-
-			igt_subtest_f("legacy-%s-persistence", e->name)
-				test_persistence(i915, e->flags);
-
-			igt_subtest_f("legacy-%s-cleanup", e->name)
-				test_nonpersistent_cleanup(i915, e->flags);
-
-			igt_subtest_f("legacy-%s-queued", e->name)
-				test_nonpersistent_queued(i915, e->flags);
-
-			igt_subtest_f("legacy-%s-mixed", e->name)
-				test_nonpersistent_mixed(i915, e->flags);
-
-			igt_subtest_f("legacy-%s-mixed-process", e->name)
-				test_process_mixed(i915, e->flags);
-
-			igt_subtest_f("legacy-%s-hostile", e->name)
-				test_nonpersistent_hostile(i915, e->flags);
-
-			igt_subtest_f("legacy-%s-hostile-preempt", e->name)
-				test_nonpersistent_hostile_preempt(i915,
-								   e->flags);
 		}
-	}
-
-        __for_each_physical_engine(i915, e) {
-                igt_subtest_group {
-                        igt_fixture
-                                gem_require_contexts(i915);
-
-			igt_subtest_f("%s-persistence", e->name)
-				test_persistence(i915, e->flags);
-
-			igt_subtest_f("%s-cleanup", e->name)
-				test_nonpersistent_cleanup(i915, e->flags);
 
-			igt_subtest_f("%s-queued", e->name)
-				test_nonpersistent_queued(i915, e->flags);
-
-			igt_subtest_f("%s-mixed", e->name)
-				test_nonpersistent_mixed(i915, e->flags);
+		/* Assert things are under control. */
+		igt_assert(!gem_context_has_engine_map(i915, 0));
+	}
 
-			igt_subtest_f("%s-mixed-process", e->name)
-				test_process_mixed(i915, e->flags);
+	/* New way of selecting engines. */
 
-			igt_subtest_f("%s-hostile", e->name)
-				test_nonpersistent_hostile(i915, e->flags);
+	igt_subtest_group {
+		const struct intel_execution_engine2 *e;
 
-			igt_subtest_f("%s-hostile-preempt", e->name)
-				test_nonpersistent_hostile_preempt(i915,
-								   e->flags);
+		igt_fixture
+			gem_require_contexts(i915);
 
-			igt_subtest_f("%s-hang", e->name)
-				test_nonpersistent_hang(i915, e->flags);
+		for (test = tests; test->name; test++) {
+			igt_subtest_with_dynamic_f("engines-%s", test->name) {
+				__for_each_physical_engine(i915, e) {
+					igt_dynamic_f("%s", e->name)
+						test->func(i915, e->flags);
+				}
+			}
 		}
-	}
 
-	igt_subtest("smoketest")
-		smoketest(i915);
+		igt_subtest("smoketest")
+			smoketest(i915);
+	}
 
 	igt_fixture {
 		close(i915);
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Bommu Krishnaiah <krishnaiah.bommu@intel.com>,
	Intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: [igt-dev] [PATCH i-g-t v3] tests/i915/gem_ctx_persistence: Convert engine subtests to dynamic
Date: Thu, 30 Jan 2020 21:01:25 +0000	[thread overview]
Message-ID: <20200130210125.5623-1-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20200130204124.29907-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Converts all per-engine tests into dynamic subtests and in the process:

 * Put back I915_EXEC_BSD legacy coverage.
 * Remove one added static engine list usage.
 * Compact code by driving two groups of the name/func table.

v2:
 * Convert smoketest to proper all engines.

v3:
 * Undo subgroup mistake. (Chris)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
---
 tests/i915/gem_ctx_persistence.c | 110 ++++++++++++++-----------------
 1 file changed, 50 insertions(+), 60 deletions(-)

diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c
index 8b9633b214ff..67bee72da6ca 100644
--- a/tests/i915/gem_ctx_persistence.c
+++ b/tests/i915/gem_ctx_persistence.c
@@ -693,6 +693,7 @@ static void __smoker(int i915, unsigned int engine, int expected)
 	int fd, extra;
 
 	fd = gem_reopen_driver(i915);
+	gem_context_copy_engines(i915, 0, fd, 0);
 	gem_context_set_persistence(fd, 0, expected > 0);
 	spin = igt_spin_new(fd, .engine = engine, .flags = IGT_SPIN_FENCE_OUT);
 
@@ -721,7 +722,7 @@ static void __smoker(int i915, unsigned int engine, int expected)
 	}
 
 	spin->handle = 0;
-	igt_spin_free(i915, spin);
+	igt_spin_free(fd, spin);
 }
 
 static void smoker(int i915, unsigned int engine, unsigned int *ctl)
@@ -734,6 +735,7 @@ static void smoker(int i915, unsigned int engine, unsigned int *ctl)
 
 static void smoketest(int i915)
 {
+	const struct intel_execution_engine2 *e;
 	uint32_t *ctl;
 
 	/*
@@ -744,9 +746,9 @@ static void smoketest(int i915)
 	ctl = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(ctl != MAP_FAILED);
 
-	for_each_physical_engine(e, i915) {
+	__for_each_physical_engine(i915, e) {
 		igt_fork(child, 4)
-			smoker(i915, eb_ring(e), ctl);
+			smoker(i915, e->flags, ctl);
 	}
 
 	sleep(20);
@@ -759,7 +761,20 @@ static void smoketest(int i915)
 
 igt_main
 {
-	const struct intel_execution_engine2 *e;
+	struct {
+		const char *name;
+		void (*func)(int fd, unsigned int engine);
+	} *test, tests[] = {
+		{ "persistence", test_persistence },
+		{ "cleanup", test_nonpersistent_cleanup },
+		{ "queued", test_nonpersistent_queued },
+		{ "mixed", test_nonpersistent_mixed },
+		{ "mixed-process", test_process_mixed },
+		{ "hostile", test_nonpersistent_hostile },
+		{ "hostile-preempt", test_nonpersistent_hostile_preempt },
+		{ "hang", test_nonpersistent_hang },
+		{ NULL, NULL },
+	};
 	int i915;
 
 	igt_fixture {
@@ -772,6 +787,8 @@ igt_main
 		igt_allow_hang(i915, 0, 0);
 	}
 
+	/* Legacy execbuf engine selection flags. */
+
 	igt_subtest("idempotent")
 		test_idempotent(i915);
 
@@ -792,71 +809,44 @@ igt_main
 	igt_subtest("hang")
 		test_nohangcheck_hang(i915);
 
-	__for_each_static_engine(e) {
-		igt_subtest_group {
-			igt_fixture {
-				gem_require_ring(i915, e->flags);
-				gem_require_contexts(i915);
+	igt_subtest_group {
+		igt_fixture
+			gem_require_contexts(i915);
+
+		for (test = tests; test->name; test++) {
+			igt_subtest_with_dynamic_f("legacy-engines-%s",
+						   test->name) {
+				for_each_engine(e, i915) {
+					igt_dynamic_f("%s", e->name)
+						test->func(i915, eb_ring(e));
+				}
 			}
-
-			igt_subtest_f("legacy-%s-persistence", e->name)
-				test_persistence(i915, e->flags);
-
-			igt_subtest_f("legacy-%s-cleanup", e->name)
-				test_nonpersistent_cleanup(i915, e->flags);
-
-			igt_subtest_f("legacy-%s-queued", e->name)
-				test_nonpersistent_queued(i915, e->flags);
-
-			igt_subtest_f("legacy-%s-mixed", e->name)
-				test_nonpersistent_mixed(i915, e->flags);
-
-			igt_subtest_f("legacy-%s-mixed-process", e->name)
-				test_process_mixed(i915, e->flags);
-
-			igt_subtest_f("legacy-%s-hostile", e->name)
-				test_nonpersistent_hostile(i915, e->flags);
-
-			igt_subtest_f("legacy-%s-hostile-preempt", e->name)
-				test_nonpersistent_hostile_preempt(i915,
-								   e->flags);
 		}
-	}
-
-        __for_each_physical_engine(i915, e) {
-                igt_subtest_group {
-                        igt_fixture
-                                gem_require_contexts(i915);
-
-			igt_subtest_f("%s-persistence", e->name)
-				test_persistence(i915, e->flags);
-
-			igt_subtest_f("%s-cleanup", e->name)
-				test_nonpersistent_cleanup(i915, e->flags);
 
-			igt_subtest_f("%s-queued", e->name)
-				test_nonpersistent_queued(i915, e->flags);
-
-			igt_subtest_f("%s-mixed", e->name)
-				test_nonpersistent_mixed(i915, e->flags);
+		/* Assert things are under control. */
+		igt_assert(!gem_context_has_engine_map(i915, 0));
+	}
 
-			igt_subtest_f("%s-mixed-process", e->name)
-				test_process_mixed(i915, e->flags);
+	/* New way of selecting engines. */
 
-			igt_subtest_f("%s-hostile", e->name)
-				test_nonpersistent_hostile(i915, e->flags);
+	igt_subtest_group {
+		const struct intel_execution_engine2 *e;
 
-			igt_subtest_f("%s-hostile-preempt", e->name)
-				test_nonpersistent_hostile_preempt(i915,
-								   e->flags);
+		igt_fixture
+			gem_require_contexts(i915);
 
-			igt_subtest_f("%s-hang", e->name)
-				test_nonpersistent_hang(i915, e->flags);
+		for (test = tests; test->name; test++) {
+			igt_subtest_with_dynamic_f("engines-%s", test->name) {
+				__for_each_physical_engine(i915, e) {
+					igt_dynamic_f("%s", e->name)
+						test->func(i915, e->flags);
+				}
+			}
 		}
-	}
 
-	igt_subtest("smoketest")
-		smoketest(i915);
+		igt_subtest("smoketest")
+			smoketest(i915);
+	}
 
 	igt_fixture {
 		close(i915);
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2020-01-30 21:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30 20:41 [Intel-gfx] [PATCH i-g-t] tests/i915/gem_ctx_persistence: Convert engine subtests to dynamic Tvrtko Ursulin
2020-01-30 20:41 ` [igt-dev] " Tvrtko Ursulin
2020-01-30 20:44 ` [Intel-gfx] " Tvrtko Ursulin
2020-01-30 20:44   ` Tvrtko Ursulin
2020-01-30 20:50   ` [Intel-gfx] " Chris Wilson
2020-01-30 20:50     ` [igt-dev] [Intel-gfx] " Chris Wilson
2020-01-30 20:47 ` Chris Wilson
2020-01-30 20:47   ` [igt-dev] " Chris Wilson
2020-01-30 20:56   ` Tvrtko Ursulin
2020-01-30 20:56     ` [igt-dev] " Tvrtko Ursulin
2020-01-30 21:17     ` Chris Wilson
2020-01-30 21:17       ` [igt-dev] " Chris Wilson
2020-01-30 20:52 ` [Intel-gfx] [PATCH i-g-t v2] " Tvrtko Ursulin
2020-01-30 20:56   ` Chris Wilson
2020-01-30 20:56     ` [igt-dev] " Chris Wilson
2020-01-30 20:59     ` Tvrtko Ursulin
2020-01-30 20:59       ` [igt-dev] " Tvrtko Ursulin
2020-01-30 20:56 ` [igt-dev] ✗ GitLab.Pipeline: failure for " Patchwork
2020-01-30 21:01 ` Tvrtko Ursulin [this message]
2020-01-30 21:01   ` [igt-dev] [PATCH i-g-t v3] " Tvrtko Ursulin
2020-01-30 21:07   ` [Intel-gfx] " Chris Wilson
2020-01-30 21:07     ` Chris Wilson
2020-01-30 21:16 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2020-01-30 21:26 ` [igt-dev] ✗ GitLab.Pipeline: failure for tests/i915/gem_ctx_persistence: Convert engine subtests to dynamic (rev3) Patchwork
2020-01-30 21:33 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2020-02-02 12:49 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200130210125.5623-1-tvrtko.ursulin@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=krishnaiah.bommu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.