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

Petr Vorel pvorel@suse.cz
Thu Dec 9 22:11:04 CET 2021


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

Although I'm not sure if we should attempt to rmmod, maybe quit when lsmod
detects zram would be better.

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.

Kind regards,
Petr


More information about the ltp mailing list