[Intel-gfx] [PATCH i-g-t 3/3] lib/igt_kmod: Don't call igt_assert or igt_require without a fixture

Petri Latvala petri.latvala at intel.com
Tue Mar 21 12:50:10 UTC 2017


If kmod_module_new_from_name fails, igt_kselftest ends up calling
igt_skip (through igt_require) when not in a fixture. Instead return
normally from igt_kselftest, matching behaviour when the module
loading is successful but it doesn't contain selftests.

Also change one igt_assert to a return for the same reason.

Signed-off-by: Petri Latvala <petri.latvala at intel.com>
CC: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/igt_kmod.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 4b8ea81..b366ade 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -419,7 +419,8 @@ int igt_kselftest_init(struct igt_kselftest *tst,
 	memset(tst, 0, sizeof(*tst));
 
 	tst->module_name = strdup(module_name);
-	igt_assert(tst->module_name);
+	if (!tst->module_name)
+		return 1;
 
 	tst->kmsg = -1;
 
@@ -502,7 +503,9 @@ void igt_kselftests(const char *module_name,
 	IGT_LIST(tests);
 	struct igt_kselftest_list *tl, *tn;
 
-	igt_require(igt_kselftest_init(&tst, module_name) == 0);
+	if (igt_kselftest_init(&tst, module_name) != 0)
+		return;
+
 	igt_fixture
 		igt_require(igt_kselftest_begin(&tst) == 0);
 
-- 
2.9.3



More information about the Intel-gfx mailing list