[Intel-gfx] [PATCH igt] igt/drv_module_reload: Keep injecting load failures until it passes

Chris Wilson chris at chris-wilson.co.uk
Fri Dec 8 22:50:49 UTC 2017


Keep reloading the module with the next load failure until we run out of
injection sites and the module loads successfully. Or it goes boom.

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

diff --git a/tests/drv_module_reload.c b/tests/drv_module_reload.c
index e812e5ec9..3046d8227 100644
--- a/tests/drv_module_reload.c
+++ b/tests/drv_module_reload.c
@@ -303,14 +303,12 @@ hda_dynamic_debug(bool enable)
 
 igt_main
 {
-	int i, err;
-	char buf[64];
+	int err;
 
 	igt_fixture
 		hda_dynamic_debug(true);
 
 	igt_subtest("basic-reload") {
-
 		if ((err = reload(NULL)))
 			igt_fail(err);
 
@@ -322,11 +320,12 @@ igt_main
 		igt_assert_eq(reload("disable_display=1"), 0);
 
 	igt_subtest("basic-reload-inject") {
-		for (i = 0; i < 4; i++) {
-			memset(buf, 0, sizeof(buf));
-			snprintf(buf, sizeof(buf), "inject_load_failure=%d", i);
-			reload(buf);
-		}
+		char buf[64];
+		int i = 0;
+		do {
+			snprintf(buf, sizeof(buf),
+				 "inject_load_failure=%d", ++i);
+		} while (reload(buf));
 	}
 
 	igt_fixture {
-- 
2.15.1



More information about the Intel-gfx mailing list