summaryrefslogtreecommitdiff
path: root/lib/igt_kmod.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-12-22 18:05:16 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-12-22 18:09:48 +0000
commite6d52317724eaa7314f7d8e53b313f5a5676ecdf (patch)
tree74081b44ca2cd39002fbe62651668d99a19abf6d /lib/igt_kmod.c
parentbc000862e8c6f05a2d960a5a300e1e1d6c8c7026 (diff)
lib/selftest: Query module parameter for error code.
"Live" selftesting of i915.ko happens during device probing which eats the error code and does not propagate it back to module loading. Workaround this by writing the error code back to the module parameter and probing it after a "successful" install. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_kmod.c')
-rw-r--r--lib/igt_kmod.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index c41367d8..657a0e55 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -359,8 +359,17 @@ static void tests_add(struct test_list *tl, struct igt_list *list)
igt_list_add_tail(&tl->link, &pos->link);
}
+static int open_parameters(const char *module_name)
+{
+ char path[256];
+
+ snprintf(path, sizeof(path), "/sys/module/%s/parameters", module_name);
+ return open(path, O_RDONLY);
+}
+
void igt_kselftests(const char *module_name,
const char *module_options,
+ const char *result,
const char *filter)
{
const char *param_prefix = "igt__";
@@ -432,13 +441,18 @@ void igt_kselftests(const char *module_name,
tl->param, module_options ?: "");
err = modprobe(kmod, options);
- kmod_module_remove_module(kmod, 0);
-
+ if (err == 0 && result) {
+ int dir = open_parameters(module_name);
+ igt_sysfs_scanf(dir, result, "%d", &err);
+ close(dir);
+ }
if (err == -ENOTTY) /* special case */
err = 0;
if (err)
kmsg_dump(kmsg);
+ kmod_module_remove_module(kmod, 0);
+
errno = 0;
igt_assert_f(err == 0,
"kselftest \"%s %s\" failed: %s [%d]\n",