[LTP] [PATCH 2/3] zram/zram_lib.sh: Skip test if zram module can not be removed

Petr Vorel pvorel@suse.cz
Fri Dec 10 10:03:39 CET 2021


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

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