[igt-dev] [PATCH i-g-t 2/3] tests/i915_load: Add 'load' subtest

Arkadiusz Hiler arkadiusz.hiler at intel.com
Wed Oct 17 12:15:44 UTC 2018


This subtest is meant to be run as a first thing on your system, making
it a catch-all for all the issues we can hit during the HW init, so the
runner can do its magic by looking for dragons in the dmesg and
overriding the final result if any were spotted.

To have full "normal boot" experience it also probes all the connectors.

The subtest warns if the driver is already loaded, so we know that
there's something off with the environment configuration.

It's already blacklisted for Intel's CI, along the other
module-wrangling subtests.

Cc: Petri Latvala <petri.latvala at intel.com>
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
---
 tests/i915_load.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/tests/i915_load.c b/tests/i915_load.c
index cf4aea80..4f61d280 100644
--- a/tests/i915_load.c
+++ b/tests/i915_load.c
@@ -35,6 +35,7 @@
 #include <signal.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
+#include <xf86drmMode.h>
 
 
 #define LOCAL_I915_EXEC_BSD_SHIFT      (13)
@@ -324,8 +325,46 @@ hda_dynamic_debug(bool enable)
 	fclose(fp);
 }
 
+static void
+reprobe_connectors(int fd)
+{
+	int i;
+	drmModeConnectorPtr conn;
+
+	drmModeResPtr res = drmModeGetResources(fd);
+	if (!res)
+		return;
+
+	for (i = 0; i < res->count_connectors; ++i) {
+		/* drmModeGetConnector forces probe */
+		conn = drmModeGetConnector(fd, res->connectors[i]);
+		igt_assert(conn);
+		drmModeFreeConnector(conn);
+	}
+
+	drmModeFreeResources(res);
+}
+
 igt_main
 {
+	igt_subtest("load") {
+		int fd, load_error;
+		bool i915_already_loaded;
+
+		i915_already_loaded = igt_kmod_is_loaded("i915");
+		igt_warn_on(i915_already_loaded);
+
+		if (!i915_already_loaded) {
+			load_error = igt_i915_driver_load(NULL);
+			igt_assert_eq(load_error, 0);
+		}
+
+		fd = __drm_open_driver(DRIVER_INTEL);
+		igt_assert(fd > 0);
+		reprobe_connectors(fd);
+		close(fd);
+	}
+
 	igt_subtest("basic-reload") {
 		int load_error;
 
-- 
2.17.2



More information about the igt-dev mailing list