[PATCH i-g-t] lib/igt_kmod: Allow to load kunit from alias

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Mar 4 16:05:29 UTC 2024


Hi Lucas,
On 2024-02-22 at 11:30:44 -0800, Lucas De Marchi wrote:
> Instead of only allowing to load the from the module name, also allow it
> from alias by using kmod_module_new_from_lookup(). With that a user can
> have their on aliases and the kernel can also export a compat alias for
> future module renames.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>

It is somehow test listing failing: ./dmabuf --list

tests/dmabuf:
Checking invalid option handling...
Checking valid option handling...
Checking subtest enumeration...
test does seem to be using igt_main() (should have subtests) and yet --list-subtests is empty!
FAIL: tests/dmabuf

Regards,
Kamil

>  lib/igt_kmod.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
> index cc242838f..43c52eaab 100644
> --- a/lib/igt_kmod.c
> +++ b/lib/igt_kmod.c
> @@ -1443,6 +1443,7 @@ void igt_kunit(const char *module_name, const char *suite, const char *opts)
>  int igt_ktest_init(struct igt_ktest *tst,
>  		   const char *module_name)
>  {
> +	struct kmod_list *l = NULL;
>  	int err;
>  
>  	memset(tst, 0, sizeof(*tst));
> @@ -1453,9 +1454,14 @@ int igt_ktest_init(struct igt_ktest *tst,
>  
>  	tst->kmsg = -1;
>  
> -	err = kmod_module_new_from_name(kmod_ctx(), module_name, &tst->kmod);
> -	if (err)
> +	err = kmod_module_new_from_lookup(kmod_ctx(), module_name, &l);
> +	if (err < 0)
>  		return err;
> +	if (!l)
> +		return -ENOENT;
> +
> +	tst->kmod = kmod_module_get_module(l);
> +	kmod_module_unref_list(l);
>  
>  	return 0;
>  }
> -- 
> 2.43.0
> 


More information about the igt-dev mailing list