All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/igt_kmod: Allow specifying libkmod config via environment variables
@ 2017-09-12 15:44 Joonas Lahtinen
  2017-09-12 15:51 ` Chris Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Joonas Lahtinen @ 2017-09-12 15:44 UTC (permalink / raw)
  To: Intel graphics driver community testing & development; +Cc: Daniel Vetter

Allow specifying the kernel module configuration via environment
variables. This allows enumerating the subtests of the kselftest
wrappers from sysroot directory.

IGT_KMOD_CONFIG_PATHS="" \
IGT_KMOD_DIRNAME="/path/to/sysroot/lib/modules/X.Y.Z" \
	tests/drm_mm --list-subtests

Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Petri Latvala <petri.latvala@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 lib/igt_kmod.c | 44 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 40 insertions(+), 4 deletions(-)

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 58624cd1..f468a4da 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -56,14 +56,50 @@ static void squelch(void *data, int priority,
 static struct kmod_ctx *kmod_ctx(void)
 {
 	static struct kmod_ctx *ctx;
+	const char **config_paths = NULL;
+	char *config_paths_str;
+	char *dirname;
+
+	if (ctx)
+		goto out;
+
+	dirname = getenv("IGT_KMOD_DIRNAME");
+	if (dirname)
+		igt_debug("kmod dirname = %s\n", dirname);
+
+	config_paths_str = getenv("IGT_KMOD_CONFIG_PATHS");
+	if (config_paths_str)
+		igt_debug("kmod config paths = %s\n", config_paths_str);
+
+	if (config_paths_str) {
+		unsigned count = !!strlen(config_paths_str);
+		unsigned i;
+		char* p;
+
+		p = config_paths_str;
+		while ((p = strchr(p, ':'))) p++, count++;
 
-	if (!ctx) {
-		ctx = kmod_new(NULL, NULL);
-		igt_assert(ctx != NULL);
 
-		kmod_set_log_fn(ctx, squelch, NULL);
+		config_paths = malloc(sizeof(*config_paths) * (count + 1));
+		igt_assert(config_paths != NULL);
+
+		p = config_paths_str;
+		for (i = 0; i < count; ++i) {
+			config_paths[i] = p;
+
+			if ((p = strchr(p, ':')))
+				*p++ = '\0';
+		}
+		config_paths[i] = NULL;
 	}
 
+	ctx = kmod_new(dirname, config_paths);
+	igt_assert(ctx != NULL);
+
+	free(config_paths);
+
+	kmod_set_log_fn(ctx, squelch, NULL);
+out:
 	return ctx;
 }
 
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-09-13 12:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-12 15:44 [PATCH i-g-t] lib/igt_kmod: Allow specifying libkmod config via environment variables Joonas Lahtinen
2017-09-12 15:51 ` Chris Wilson
2017-09-13 10:37   ` Chris Wilson
2017-09-13 12:40     ` Joonas Lahtinen
2017-09-12 17:51 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-09-13  0:16 ` ✗ Fi.CI.IGT: failure " Patchwork

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.