All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] igt/drv_module_reload: Don't reload on exit
@ 2018-07-27  8:06 Chris Wilson
  2018-07-27  9:09 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
  2018-07-27  9:23 ` [igt-dev] [PATCH i-g-t] " Petri Latvala
  0 siblings, 2 replies; 7+ messages in thread
From: Chris Wilson @ 2018-07-27  8:06 UTC (permalink / raw)
  To: igt-dev

The next test will happily load whatever module it requires.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/drv_module_reload.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/tests/drv_module_reload.c b/tests/drv_module_reload.c
index 34f55eab1..4c06e4caf 100644
--- a/tests/drv_module_reload.c
+++ b/tests/drv_module_reload.c
@@ -340,21 +340,21 @@ hda_dynamic_debug(bool enable)
 
 igt_main
 {
-	int err;
-
-	igt_fixture
+	igt_subtest("basic-reload") {
 		hda_dynamic_debug(true);
 
-	igt_subtest("basic-reload") {
-		if ((err = reload(NULL)))
-			igt_fail(err);
+		igt_assert_eq(reload(NULL), 0);
 
 		gem_sanitycheck();
 		gem_exec_store();
+
+		hda_dynamic_debug(false);
 	}
 
-	igt_subtest("basic-no-display")
+	igt_subtest("basic-no-display") {
 		igt_assert_eq(reload("disable_display=1"), 0);
+		igt_i915_driver_unload();
+	}
 
 	igt_subtest("basic-reload-inject") {
 		int i = 0;
@@ -367,13 +367,4 @@ igt_main
 		/* We expect to hit at least one fault! */
 		igt_assert(i > 1);
 	}
-
-	igt_fixture {
-		if ((err = reload(NULL)))
-			igt_fail(err);
-
-		gem_sanitycheck();
-		gem_exec_store();
-		hda_dynamic_debug(false);
-	}
 }
-- 
2.18.0

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [igt-dev] [PATCH i-g-t] igt/drv_module_reload: Don't reload on exit
@ 2018-07-27 10:04 Chris Wilson
  2018-07-27 10:14 ` Petri Latvala
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2018-07-27 10:04 UTC (permalink / raw)
  To: igt-dev

The next test will happily load whatever module it requires.

v2: Unload at start, mandate tests cleanup after themselves.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Petri Latvala <petri.latvala@intel.com>
---
 tests/drv_module_reload.c | 48 ++++++++++++++++-----------------------
 1 file changed, 19 insertions(+), 29 deletions(-)

diff --git a/tests/drv_module_reload.c b/tests/drv_module_reload.c
index 34f55eab1..cf4aea80d 100644
--- a/tests/drv_module_reload.c
+++ b/tests/drv_module_reload.c
@@ -220,20 +220,6 @@ static void store_all(int fd)
 	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
 }
 
-static int
-reload(const char *opts_i915)
-{
-	int err = IGT_EXIT_SUCCESS;
-
-	if ((err = igt_i915_driver_unload()))
-		return err;
-
-	if ((err = igt_i915_driver_load(opts_i915)))
-		return err;
-
-	return err;
-}
-
 static int open_parameters(const char *module_name)
 {
 	char path[256];
@@ -340,21 +326,30 @@ hda_dynamic_debug(bool enable)
 
 igt_main
 {
-	int err;
+	igt_subtest("basic-reload") {
+		int load_error;
+
+		igt_i915_driver_unload();
 
-	igt_fixture
 		hda_dynamic_debug(true);
+		load_error = igt_i915_driver_load(NULL);
+		hda_dynamic_debug(false);
 
-	igt_subtest("basic-reload") {
-		if ((err = reload(NULL)))
-			igt_fail(err);
+		igt_assert_eq(load_error, 0);
 
 		gem_sanitycheck();
 		gem_exec_store();
+
+		/* only default modparams, can leave module loaded */
 	}
 
-	igt_subtest("basic-no-display")
-		igt_assert_eq(reload("disable_display=1"), 0);
+	igt_subtest("basic-no-display") {
+		igt_i915_driver_unload();
+
+		igt_assert_eq(igt_i915_driver_load("disable_display=1"), 0);
+
+		igt_i915_driver_unload();
+	}
 
 	igt_subtest("basic-reload-inject") {
 		int i = 0;
@@ -366,14 +361,9 @@ igt_main
 
 		/* We expect to hit at least one fault! */
 		igt_assert(i > 1);
-	}
-
-	igt_fixture {
-		if ((err = reload(NULL)))
-			igt_fail(err);
 
-		gem_sanitycheck();
-		gem_exec_store();
-		hda_dynamic_debug(false);
+		/* inject_fault() leaves the module unloaded */
 	}
+
+	/* Subtests should unload the module themselves if they use modparams */
 }
-- 
2.18.0

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-07-27 10:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-27  8:06 [igt-dev] [PATCH i-g-t] igt/drv_module_reload: Don't reload on exit Chris Wilson
2018-07-27  9:09 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2018-07-27  9:23 ` [igt-dev] [PATCH i-g-t] " Petri Latvala
2018-07-27  9:42   ` Petri Latvala
2018-07-27  9:45   ` Chris Wilson
2018-07-27 10:04 Chris Wilson
2018-07-27 10:14 ` Petri Latvala

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.