Skip to contentSkip to conversation

lsmod01.sh: Fix failure when CONFIG_MODULE_UNLOAD is not set

PATCH New Radoslav Kolev 2 participants 2 messages Dec 21, 2020 – Jan 5, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lsmod01.sh: Fix failure when CONFIG_MODULE_UNLOAD is not set

If CONFIG_MODULE_UNLOAD is not set lsmod shows '-2' (-ENOENT) for the used by column, but /proc/modules has only '-' there.

---
 testcases/commands/lsmod/lsmod01.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
testcases/commands/lsmod/lsmod01.sh +3 -1
index c373b2893..2e044c718 100755
@@ -44,7 +44,9 @@ cleanup()
 
 lsmod_matches_proc_modules()
 {
-	lsmod_output=$(lsmod | awk '!/Module/{print $1, $2, $3}' | sort)
+	lsmod_output=$(lsmod \
+			| awk '!/Module/{print $1, $2, ($3==-2) ? "-" : $3}' \
+			| sort)
 	if [ -z "$lsmod_output" ]; then
 		tst_brk TBROK "Failed to parse the output from lsmod"
 	fi
Signature · 1 line
2.26.2
Applied
#1 lore raw

PATCH 1/1 lsmod01.sh: Fix failure when CONFIG_MODULE_UNLOAD is not set

Hi Radoslav,

Quoted 2 lines

If CONFIG_MODULE_UNLOAD is not set lsmod shows '-2' (-ENOENT) for the used by column, but /proc/modules has only '-' there.

Merged, thanks!

Kind regards,
Petr