diff mbox series

[1/1,V2] Selftests: net: Improve missing modules error message

Message ID 20240823054833.144612-1-david.hunter.linux@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [1/1,V2] Selftests: net: Improve missing modules error message | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 7 this patch: 7
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 7 this patch: 7
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success net selftest script(s) already in Makefile
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 7 this patch: 7
netdev/checkpatch warning WARNING: line length of 87 exceeds 80 columns WARNING: line length of 94 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-25--21-00 (tests: 714)

Commit Message

David Hunter Aug. 23, 2024, 5:48 a.m. UTC
The error message descirbing 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
---
 .../selftests/net/test_ingress_egress_chaining.sh     | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Jakub Kicinski Aug. 26, 2024, 3:50 p.m. UTC | #1
On Fri, 23 Aug 2024 01:48:30 -0400 David Hunter wrote:
> Subject: [PATCH 1/1 V2] Selftests: net: Improve missing modules error message

don't capitalize the prefix

> The error message descirbing the required modules is inaccurate.

spellcheck the commit message, please

> 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.

>  needed_mods="act_mirred cls_flower sch_ingress"
> +mods_missing=""
> +numb_mods_needed=0;

trailing semicolon

> +
>  for mod in $needed_mods; do
> -	modinfo $mod &>/dev/null || { echo "SKIP: Need act_mirred module"; exit $ksft_skip; }
> +	modinfo $mod &>/dev/null ||
> +	{ mods_missing="$mods_missing$mod " ; numb_mods_needed=$(expr $numb_mods_needed + 1);}

this is getting too long, use a "&& continue" instead of ||

>  done
>  
> +if [[ $numb_mods_needed>0 ]]; then

no need to use [[]], -gt

> +	echo "SKIP: $numb_mods_needed modules needed: $mods_missing" ; exit $ksft_skip;

why single line with semicolons, it can be two lines

> +fi
> +
> +
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/test_ingress_egress_chaining.sh b/tools/testing/selftests/net/test_ingress_egress_chaining.sh
index 08adff6bb3b6..d4b97662849b 100644
--- a/tools/testing/selftests/net/test_ingress_egress_chaining.sh
+++ b/tools/testing/selftests/net/test_ingress_egress_chaining.sh
@@ -13,10 +13,19 @@  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 ||
+	{ mods_missing="$mods_missing$mod " ; numb_mods_needed=$(expr $numb_mods_needed + 1);}
 done
 
+if [[ $numb_mods_needed>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))"