[igt-dev] [PATCH i-g-t] tests/i915/module_load: Add probe subtest
Arkadiusz Hiler
arkadiusz.hiler at intel.com
Tue Dec 11 13:02:06 UTC 2018
The subtest is intended to be run as the very first thing on a machine with
i915 blacklisted. It is supposed to be a catch-all for warnings/issues that
happen during the initial module load.
If i915 turns out to be already loaded, the subtest simply skips.
Cc: Petri Latvala <petri.latvala at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
---
tests/i915/module_load.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/tests/i915/module_load.c b/tests/i915/module_load.c
index 7fe83520..14552990 100644
--- a/tests/i915/module_load.c
+++ b/tests/i915/module_load.c
@@ -324,8 +324,48 @@ hda_dynamic_debug(bool enable)
fclose(fp);
}
+static void
+reprobe_connectors(int fd)
+{
+ int i, ret;
+ struct drm_mode_get_connector conn;
+
+ drmModeResPtr res = drmModeGetResources(fd);
+ if (!res)
+ return;
+
+ for (i = 0; i < res->count_connectors; ++i) {
+ memset(&conn, 0, sizeof(conn));
+ conn.connector_id = res->connectors[i];
+ ret = drmIoctl(fd, DRM_IOCTL_MODE_GETCONNECTOR, &conn);
+ igt_assert_neq(ret, -EFAULT);
+ }
+
+ drmModeFreeResources(res);
+}
+
igt_main
{
+ /* This subtest is intended to be run as the very first thing on a
+ * machine with i915 blacklisted. It is supposed to be a catch-all for
+ * warnings/issues that happen during the initial module load. */
+ igt_subtest("probe") {
+ int fd;
+
+ if (igt_kmod_is_loaded("i915"))
+ igt_skip("i915 already loaded\n");
+
+ /* modprobe happens here */
+ fd = __drm_open_driver(DRIVER_INTEL);
+ igt_assert(fd > 0);
+
+ /* connectors probing happens during boot because vtconsole,
+ * so let's mimic that */
+ reprobe_connectors(fd);
+
+ close(fd);
+ }
+
igt_subtest("reload") {
int load_error;
--
2.19.2
More information about the igt-dev
mailing list