[LTP] [PATCH 1/2] tst_kernel: Fix search for foo-x86-64 module

xuyang2018.jy@fujitsu.com xuyang2018.jy@fujitsu.com
Wed Mar 16 07:34:45 CET 2022


Hi Petr
I don't understand why we must serach foo-x86-64 module, so what problem 
do you meet?

I used 5.17-rc8,  it still use foo-x86_64 named rule for 
kernel/arch/x86/crypto/libblake2s-x86_64.ko.

If kernel has libblake2s-x86_64 module, then tst_check_driver will use 
libblake2s_x86_64 to find, it should succeed.

If kernel doesn't have libblake2s-x86_64 module, then tst_ckeck_driver 
will search twice ,the first time use libblake2s-x86_64  and the second
time use libblake2s_x86_64, then search failed.

Best Regards
Yang Xu
> Although modules.{builtin,dep} contain modules with both dashes and
> underscores and use this consistently, there the only exception: modules
> for x86_64 arch are always named x86_64 no matter whether they use
> dashes or underscore for the rest. E.g. libblake2s-x86-64.
>
> modinfo works with all 4 combinations of libblake2s[-_]x86[-_]64,
> thus fix tst_search_driver() to allow the same.
>
> before:
> tst_check_driver 3 TPASS: tst_check_drivers libblake2s-x86_64 2>/dev/null passed as expected
> libblake2s-x86-64tst_check_driver 3 TFAIL: tst_check_drivers libblake2s-x86-64 failed unexpectedly
>
> after fix:
> tst_check_driver 3 TPASS: tst_check_drivers libblake2s-x86_64 2>/dev/null passed as expected
> tst_check_driver 3 TPASS: tst_check_drivers libblake2s-x86-64 2>/dev/null passed as expected
>
> Signed-off-by: Petr Vorel<pvorel@suse.cz>
> ---
>   lib/tst_kernel.c | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/lib/tst_kernel.c b/lib/tst_kernel.c
> index 6db85bff0e..ecf4b917e7 100644
> --- a/lib/tst_kernel.c
> +++ b/lib/tst_kernel.c
> @@ -116,6 +116,11 @@ static int tst_search_driver(const char *driver, const char *file)
>   		return -1;
>   	}
>
> +	/* always search for x86_64 */
> +	char *fix = strstr(driver, "x86-64");
> +	if (fix)
> +		fix[3] = '_';
> +
>   	SAFE_ASPRINTF(NULL,&search, "/%s.ko", driver);
>
>   	f = SAFE_FOPEN(NULL, path, "r");


More information about the ltp mailing list