netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Hunter <david.hunter.linux@gmail.com>
To: kuba@kernel.org
Cc: davem@davemloft.net, david.hunter.linux@gmail.com,
	edumazet@google.com, javier.carrasco.cruz@gmail.com,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	netdev@vger.kernel.org, pabeni@redhat.com, shuah@kernel.org
Subject: [PATCH 1/1 V3] selftests: net: improve missing modules error message
Date: Tue, 27 Aug 2024 16:56:29 -0400	[thread overview]
Message-ID: <20240827205629.51004-1-david.hunter.linux@gmail.com> (raw)
In-Reply-To: <20240826085010.27ff4377@kernel.org>

The error message describing the required modules is inaccurate.
Currently, only  "SKIP: Need act_mirred module" is printed when any of
the modules are missing. As a result, users might only include that
module; however, three modules are required.

Fix the error message to show any/all modules needed for the script file
to properly execute.

Signed-off-by: David Hunter <david.hunter.linux@gmail.com>
---

V1 --> V2
	- included subject prefixes 
	- split the patch into two separate patches (one for each issue)
	- fixed typos in message body
	- removed second, unnecessary for loop
V2 --> V3
	- fixed subject prefix (omit capitilization)
	- fixed spelling mistake in commit message
	- fixed coding style based on recommendations
---
 .../selftests/net/test_ingress_egress_chaining.sh    | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/test_ingress_egress_chaining.sh b/tools/testing/selftests/net/test_ingress_egress_chaining.sh
index 08adff6bb3b6..007a5d04c3e1 100644
--- a/tools/testing/selftests/net/test_ingress_egress_chaining.sh
+++ b/tools/testing/selftests/net/test_ingress_egress_chaining.sh
@@ -13,10 +13,20 @@ if [ "$(id -u)" -ne 0 ];then
 fi
 
 needed_mods="act_mirred cls_flower sch_ingress"
+mods_missing=""
+numb_mods_needed=0
+
 for mod in $needed_mods; do
-	modinfo $mod &>/dev/null || { echo "SKIP: Need act_mirred module"; exit $ksft_skip; }
+	modinfo $mod &>/dev/null && continue
+	mods_missing="$mods_missing$mod "
+	numb_mods_needed=$(expr $numb_mods_needed + 1)
 done
 
+if [ $numb_mods_needed -gt 0 ]; then
+	echo "SKIP: $numb_mods_needed modules needed: $mods_missing"
+	exit $ksft_skip
+fi
+
 ns="ns$((RANDOM%899+100))"
 veth1="veth1$((RANDOM%899+100))"
 veth2="veth2$((RANDOM%899+100))"
-- 
2.43.0


  reply	other threads:[~2024-08-27 20:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-23  5:48 [PATCH 1/1 V2] Selftests: net: Improve missing modules error message David Hunter
2024-08-26 15:50 ` Jakub Kicinski
2024-08-27 20:56   ` David Hunter [this message]
2024-08-27 21:06     ` [PATCH 1/1 V3] selftests: net: improve " Jakub Kicinski

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=20240827205629.51004-1-david.hunter.linux@gmail.com \
    --to=david.hunter.linux@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).