[igt-dev] [PATCH i-g-t] igt/drv_module_reload: Go through all fail injection checkpoints

Michał Winiarski michal.winiarski at intel.com
Wed Jun 6 11:32:41 UTC 2018


Currently, we're only testing with inject_load_failure=1.
Let's use the values from debugfs if present. Otherwise, it's safe to
assume that there are at least 4 checkpoints (the initial value when the
modparam was introduced).

Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/drv_module_reload.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/tests/drv_module_reload.c b/tests/drv_module_reload.c
index 3046d822..4176cacf 100644
--- a/tests/drv_module_reload.c
+++ b/tests/drv_module_reload.c
@@ -301,6 +301,23 @@ hda_dynamic_debug(bool enable)
 	fclose(fp);
 }
 
+#define DEFAULT_FAIL_INJECTION_NUM 4
+static unsigned int
+inject_load_failure_max()
+{
+	int fd;
+	char buf[64];
+	unsigned int val = DEFAULT_FAIL_INJECTION_NUM;
+
+	fd = __drm_open_driver(DRIVER_INTEL);
+	__igt_debugfs_read(fd, "i915_fail_injection_info", buf, sizeof(buf));
+	sscanf(buf, "Available checkpoints: %u", &val);
+
+	close(fd);
+
+	return val;
+}
+
 igt_main
 {
 	int err;
@@ -321,11 +338,14 @@ igt_main
 
 	igt_subtest("basic-reload-inject") {
 		char buf[64];
-		int i = 0;
+		unsigned int i = 0;
+		unsigned int max = inject_load_failure_max();
+
 		do {
 			snprintf(buf, sizeof(buf),
 				 "inject_load_failure=%d", ++i);
-		} while (reload(buf));
+			igt_fail_on(reload(buf));
+		} while (i <= max);
 	}
 
 	igt_fixture {
-- 
2.17.0



More information about the igt-dev mailing list