summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_kmod.c18
-rw-r--r--lib/igt_kmod.h1
2 files changed, 17 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",
diff --git a/lib/igt_kmod.h b/lib/igt_kmod.h
index 3eb6a345..fc0e6fe6 100644
--- a/lib/igt_kmod.h
+++ b/lib/igt_kmod.h
@@ -37,6 +37,7 @@ int igt_i915_driver_unload(void);
void igt_kselftests(const char *module_name,
const char *module_options,
+ const char *result_option,
const char *filter);
#endif /* IGT_KMOD_H */