linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: net: fix IOAM test skip return code
@ 2022-07-27  9:37 Kleber Sacilotto de Souza
  2022-07-27 15:15 ` Justin Iurman
  2022-07-27 17:45 ` Jakub Kicinski
  0 siblings, 2 replies; 3+ messages in thread
From: Kleber Sacilotto de Souza @ 2022-07-27  9:37 UTC (permalink / raw)
  To: linux-kernel, linux-kselftest
  Cc: Justin Iurman, Jakub Kicinski, David S . Miller

The ioam6.sh test script exits with an error code (1) when tests are
skipped due to lack of support from userspace/kernel or not enough
permissions. It should return the kselftests SKIP code instead.

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
---
 tools/testing/selftests/net/ioam6.sh | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/net/ioam6.sh b/tools/testing/selftests/net/ioam6.sh
index a2b9fad5a9a6..4ceb401da1bf 100755
--- a/tools/testing/selftests/net/ioam6.sh
+++ b/tools/testing/selftests/net/ioam6.sh
@@ -117,6 +117,8 @@
 #        | Schema Data         |                                     |
 #        +-----------------------------------------------------------+
 
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
 
 ################################################################################
 #                                                                              #
@@ -211,7 +213,7 @@ check_kernel_compatibility()
     echo "SKIP: kernel version probably too old, missing ioam support"
     ip link del veth0 2>/dev/null || true
     ip netns del ioam-tmp-node || true
-    exit 1
+    exit $ksft_skip
   fi
 
   ip -netns ioam-tmp-node route add db02::/64 encap ioam6 mode inline \
@@ -227,7 +229,7 @@ check_kernel_compatibility()
          "without CONFIG_IPV6_IOAM6_LWTUNNEL?"
     ip link del veth0 2>/dev/null || true
     ip netns del ioam-tmp-node || true
-    exit 1
+    exit $ksft_skip
   fi
 
   ip link del veth0 2>/dev/null || true
@@ -752,20 +754,20 @@ nfailed=0
 if [ "$(id -u)" -ne 0 ]
 then
   echo "SKIP: Need root privileges"
-  exit 1
+  exit $ksft_skip
 fi
 
 if [ ! -x "$(command -v ip)" ]
 then
   echo "SKIP: Could not run test without ip tool"
-  exit 1
+  exit $ksft_skip
 fi
 
 ip ioam &>/dev/null
 if [ $? = 1 ]
 then
   echo "SKIP: iproute2 too old, missing ioam command"
-  exit 1
+  exit $ksft_skip
 fi
 
 check_kernel_compatibility
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests: net: fix IOAM test skip return code
  2022-07-27  9:37 [PATCH] selftests: net: fix IOAM test skip return code Kleber Sacilotto de Souza
@ 2022-07-27 15:15 ` Justin Iurman
  2022-07-27 17:45 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Justin Iurman @ 2022-07-27 15:15 UTC (permalink / raw)
  To: Kleber Sacilotto de Souza, linux-kernel, linux-kselftest
  Cc: Jakub Kicinski, David S . Miller

On 7/27/22 11:37, Kleber Sacilotto de Souza wrote:
> The ioam6.sh test script exits with an error code (1) when tests are
> skipped due to lack of support from userspace/kernel or not enough
> permissions. It should return the kselftests SKIP code instead.
> 
> Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
> ---
>   tools/testing/selftests/net/ioam6.sh | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/ioam6.sh b/tools/testing/selftests/net/ioam6.sh
> index a2b9fad5a9a6..4ceb401da1bf 100755
> --- a/tools/testing/selftests/net/ioam6.sh
> +++ b/tools/testing/selftests/net/ioam6.sh
> @@ -117,6 +117,8 @@
>   #        | Schema Data         |                                     |
>   #        +-----------------------------------------------------------+
>   
> +# Kselftest framework requirement - SKIP code is 4.
> +ksft_skip=4
>   
>   ################################################################################
>   #                                                                              #
> @@ -211,7 +213,7 @@ check_kernel_compatibility()
>       echo "SKIP: kernel version probably too old, missing ioam support"
>       ip link del veth0 2>/dev/null || true
>       ip netns del ioam-tmp-node || true
> -    exit 1
> +    exit $ksft_skip
>     fi
>   
>     ip -netns ioam-tmp-node route add db02::/64 encap ioam6 mode inline \
> @@ -227,7 +229,7 @@ check_kernel_compatibility()
>            "without CONFIG_IPV6_IOAM6_LWTUNNEL?"
>       ip link del veth0 2>/dev/null || true
>       ip netns del ioam-tmp-node || true
> -    exit 1
> +    exit $ksft_skip
>     fi
>   
>     ip link del veth0 2>/dev/null || true
> @@ -752,20 +754,20 @@ nfailed=0
>   if [ "$(id -u)" -ne 0 ]
>   then
>     echo "SKIP: Need root privileges"
> -  exit 1
> +  exit $ksft_skip
>   fi
>   
>   if [ ! -x "$(command -v ip)" ]
>   then
>     echo "SKIP: Could not run test without ip tool"
> -  exit 1
> +  exit $ksft_skip
>   fi
>   
>   ip ioam &>/dev/null
>   if [ $? = 1 ]
>   then
>     echo "SKIP: iproute2 too old, missing ioam command"
> -  exit 1
> +  exit $ksft_skip
>   fi
>   
>   check_kernel_compatibility

LGTM, thanks.

Reviewed-by: Justin Iurman <justin.iurman@uliege.be>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests: net: fix IOAM test skip return code
  2022-07-27  9:37 [PATCH] selftests: net: fix IOAM test skip return code Kleber Sacilotto de Souza
  2022-07-27 15:15 ` Justin Iurman
@ 2022-07-27 17:45 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2022-07-27 17:45 UTC (permalink / raw)
  To: Kleber Sacilotto de Souza
  Cc: linux-kernel, linux-kselftest, Justin Iurman, David S . Miller

On Wed, 27 Jul 2022 11:37:42 +0200 Kleber Sacilotto de Souza wrote:
> The ioam6.sh test script exits with an error code (1) when tests are
> skipped due to lack of support from userspace/kernel or not enough
> permissions. It should return the kselftests SKIP code instead.
> 
> Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

Please repost CCing netdev@ (keep Justin's Review tag)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-27 18:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27  9:37 [PATCH] selftests: net: fix IOAM test skip return code Kleber Sacilotto de Souza
2022-07-27 15:15 ` Justin Iurman
2022-07-27 17:45 ` Jakub Kicinski

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