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

Petr Vorel pvorel@suse.cz
Tue Mar 15 13:25:15 CET 2022


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");
-- 
2.35.1



More information about the ltp mailing list