[LTP] [PATCH v3] madvise11.c:Check loadable module before rmmod

Cyril Hrubis chrubis@suse.cz
Mon Mar 13 13:37:12 CET 2023


Hi!
> > That does not solve the problem completely though, if we have a kernel
> > where the hwpoinson_inject is set to N in config the test will attempt
> > to rmmod it and get different error.
> 
> 
> I have tested on the kernel which set to N in config and the test will report:
> tst_test.c:1180: TCONF: hwpoison_inject driver not available
> 
> I think it should caused by following configuration of test case:
>         .needs_drivers = (const char *const []) {
>                 HW_MODULE,
>                 NULL
>         },
> 
> So the scenario of "N in kernel config" already handled by LTP framework, i have
> to say LTP frame work already do a lot of things which i have no idea... xD

Ah, missed that part as well.

Looking at lib/tst_kernel.c we can also easily add tst_buildin_driver()
function into the LTP library with just:

diff --git a/lib/tst_kernel.c b/lib/tst_kernel.c
index ecf4b917e..6000522b7 100644
--- a/lib/tst_kernel.c
+++ b/lib/tst_kernel.c
@@ -153,6 +153,11 @@ static int tst_check_driver_(const char *driver)
        return -1;
 }

+int tst_buildin_driver(const char *driver)
+{
+       return !tst_search_driver(driver, "modules.buildin");
+}
+
 int tst_check_driver(const char *driver)
 {
 #ifdef __ANDROID__


-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list