[LTP] [PATCH 2/3] zram/zram_lib.sh: Skip test if zram module can not be removed
xuyang2018.jy@fujitsu.com
xuyang2018.jy@fujitsu.com
Fri Dec 10 10:31:36 CET 2021
Hi Petr
> Hi Xu,
>
>> Hi Petr
>>> Hi Xu, Cyril,
>
>>>> Hi!
>>>>> tst_set_timeout $((dev_num*450))
>
>>>>> + rmmod zram> /dev/null 2>&1 || tst_brk TCONF "zram module is being used"
>>> This is wrong:
>
>>> $ lsmod | grep zram
>>> # rmmod zram; echo $?
>>> rmmod: ERROR: Module zram is not currently loaded
>>> 1
>
>>> Why not detect with lsmod? i.e.:
>
>>> if lsmod | grep zram; then
>>> rmmod zram> /dev/null 2>&1 || tst_brk TCONF "zram module is being used"
>>> fi
>
>> Yes
>>> Although I'm not sure if we should attempt to rmmod, maybe quit when lsmod
>>> detects zram would be better.
>> If zram module was loaded but not used, then we can rmmod and do
>> modprobe(case needs a clean zram envrionment). IMO, it doesn't affect
>> any things.
>> If zram module was loaded but used, then rmmod failed and case skips.
> OK, it's safe, ack.
>
>> ps: zram01 need to rmmod and modprobe zram. So if kernel built with
>> CONFIG_ZRAM=y, we also need to TCONF. But it is another story.
> +1
>
Since zram_lib.sh uses tst_needs_driver to search module in
modules.dep/modules.builtin. Maybe we can introduce a new macro
TST_NEEDS_MODULES (like TST_NEEDS_DIRVERS)?
The difference between TST_NEEDS_MODULES and TST_NEEDS_DIRVERS is that
the former needs module, but the latter needs module or builtin.
But I am not sure whether have many shell case needs this(Like network.)
Of course, kconfig shell api also can do this.
Ok, I am back to this case and write my v2 patch.
Best Regards
Yang Xu
> Kind regards,
> Petr
>
>>> Also it wouldn't harm to add at least rmmod into TST_NEEDS_CMDS (in the
>>> zram_lib.sh + take into account TST_NEEDS_CMDS from tests), but that's another
>>> story.
>> Agree.
>
>> Best Regards
>> Yang Xu
More information about the ltp
mailing list