Skip to contentSkip to conversation

device-drivers/zram: zram_lib: Fix modinfo's usage

PATCH New Leo Yu-Chi Liang 2 participants 2 messages Sep 17, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 device-drivers/zram: zram_lib: Fix modinfo's usage

zram_lib uses the exit code of modinfo to determine the presence of zram module, but the exit code does not have direct relation to it.

We could be missing zram module and modinfo still exits "successfully" because it has done its job of informing the user zram is missing.

Such behavior would give confusing zram test report. Without this patch, some of the system run LTP without zram module would have a FAIL instead of CONF as a result.

---
 testcases/kernel/device-drivers/zram/zram_lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/device-drivers/zram/zram_lib.sh +1 -1
index 3f4d1d55f..372b93990 100755
@@ -211,5 +211,5 @@ zram_mount()
 	tst_res TPASS "mount of zram device(s) succeeded"
 }
 
-modinfo zram > /dev/null 2>&1 ||
+modinfo zram 2>&1 | grep filename > /dev/null 2>&1 ||
 	tst_brk TCONF "zram not configured in kernel"
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/1 device-drivers/zram: zram_lib: Fix modinfo's usage

Hi!

Quoted 2 lines

zram_lib uses the exit code of modinfo to determine the presence of zram module, but the exit code does not have direct relation to it.

What distribution is this? Where did the modinfo binary came from?

It works fine with modinfo from the kmod packages, see:

https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/tree/tools/modinfo.c#n463

Signature · 2 lines
Cyril Hrubis
[email protected]