public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Radoslav Kolev <radoslav.kolev@suse.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] lsmod01.sh: Fix failure when CONFIG_MODULE_UNLOAD is not set
Date: Mon, 21 Dec 2020 13:51:11 +0200	[thread overview]
Message-ID: <20201221115111.31982-1-radoslav.kolev@suse.com> (raw)

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

Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com>
---
 testcases/commands/lsmod/lsmod01.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/testcases/commands/lsmod/lsmod01.sh b/testcases/commands/lsmod/lsmod01.sh
index c373b2893..2e044c718 100755
--- a/testcases/commands/lsmod/lsmod01.sh
+++ b/testcases/commands/lsmod/lsmod01.sh
@@ -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
-- 
2.26.2


             reply	other threads:[~2020-12-21 11:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-21 11:51 Radoslav Kolev [this message]
2021-01-05 11:47 ` [LTP] [PATCH] lsmod01.sh: Fix failure when CONFIG_MODULE_UNLOAD is not set Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201221115111.31982-1-radoslav.kolev@suse.com \
    --to=radoslav.kolev@suse.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox