* [PATCH v1 net-next] selftests/net: packetdrill: Support single protocol test.
@ 2025-08-19 23:14 Kuniyuki Iwashima
2025-08-20 11:29 ` Willem de Bruijn
2025-08-21 2:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Kuniyuki Iwashima @ 2025-08-19 23:14 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Willem de Bruijn, Kuniyuki Iwashima,
Kuniyuki Iwashima, netdev
Currently, we cannot write IPv4 or IPv6 specific packetdrill tests
as ksft_runner.sh runs each .pkt file for both protocols.
Let's support single protocol test by checking --ip_version in the
.pkt file.
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
---
.../selftests/net/packetdrill/ksft_runner.sh | 47 +++++++++++--------
1 file changed, 28 insertions(+), 19 deletions(-)
diff --git a/tools/testing/selftests/net/packetdrill/ksft_runner.sh b/tools/testing/selftests/net/packetdrill/ksft_runner.sh
index a7e790af38ff..0ae6eeeb1a8e 100755
--- a/tools/testing/selftests/net/packetdrill/ksft_runner.sh
+++ b/tools/testing/selftests/net/packetdrill/ksft_runner.sh
@@ -3,21 +3,22 @@
source "$(dirname $(realpath $0))/../../kselftest/ktap_helpers.sh"
-readonly ipv4_args=('--ip_version=ipv4 '
- '--local_ip=192.168.0.1 '
- '--gateway_ip=192.168.0.1 '
- '--netmask_ip=255.255.0.0 '
- '--remote_ip=192.0.2.1 '
- '-D CMSG_LEVEL_IP=SOL_IP '
- '-D CMSG_TYPE_RECVERR=IP_RECVERR ')
-
-readonly ipv6_args=('--ip_version=ipv6 '
- '--mtu=1520 '
- '--local_ip=fd3d:0a0b:17d6::1 '
- '--gateway_ip=fd3d:0a0b:17d6:8888::1 '
- '--remote_ip=fd3d:fa7b:d17d::1 '
- '-D CMSG_LEVEL_IP=SOL_IPV6 '
- '-D CMSG_TYPE_RECVERR=IPV6_RECVERR ')
+declare -A ip_args=(
+ [ipv4]="--ip_version=ipv4
+ --local_ip=192.168.0.1
+ --gateway_ip=192.168.0.1
+ --netmask_ip=255.255.0.0
+ --remote_ip=192.0.2.1
+ -D CMSG_LEVEL_IP=SOL_IP
+ -D CMSG_TYPE_RECVERR=IP_RECVERR"
+ [ipv6]="--ip_version=ipv6
+ --mtu=1520
+ --local_ip=fd3d:0a0b:17d6::1
+ --gateway_ip=fd3d:0a0b:17d6:8888::1
+ --remote_ip=fd3d:fa7b:d17d::1
+ -D CMSG_LEVEL_IP=SOL_IPV6
+ -D CMSG_TYPE_RECVERR=IPV6_RECVERR"
+)
if [ $# -ne 1 ]; then
ktap_exit_fail_msg "usage: $0 <script>"
@@ -38,12 +39,20 @@ if [[ -n "${KSFT_MACHINE_SLOW}" ]]; then
failfunc=ktap_test_xfail
fi
+ip_versions=$(grep -E '^--ip_version=' $script | cut -d '=' -f 2)
+if [[ -z $ip_versions ]]; then
+ ip_versions="ipv4 ipv6"
+elif [[ ! "$ip_versions" =~ ^ipv[46]$ ]]; then
+ ktap_exit_fail_msg "Too many or unsupported --ip_version: $ip_versions"
+ exit "$KSFT_FAIL"
+fi
+
ktap_print_header
ktap_set_plan 2
-unshare -n packetdrill ${ipv4_args[@]} ${optargs[@]} $script > /dev/null \
- && ktap_test_pass "ipv4" || $failfunc "ipv4"
-unshare -n packetdrill ${ipv6_args[@]} ${optargs[@]} $script > /dev/null \
- && ktap_test_pass "ipv6" || $failfunc "ipv6"
+for ip_version in $ip_versions; do
+ unshare -n packetdrill ${ip_args[$ip_version]} ${optargs[@]} $script > /dev/null \
+ && ktap_test_pass $ip_version || $failfunc $ip_version
+done
ktap_finished
--
2.51.0.rc1.167.g924127e9c0-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v1 net-next] selftests/net: packetdrill: Support single protocol test.
2025-08-19 23:14 [PATCH v1 net-next] selftests/net: packetdrill: Support single protocol test Kuniyuki Iwashima
@ 2025-08-20 11:29 ` Willem de Bruijn
2025-08-21 2:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2025-08-20 11:29 UTC (permalink / raw)
To: Kuniyuki Iwashima, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: Simon Horman, Willem de Bruijn, Kuniyuki Iwashima,
Kuniyuki Iwashima, netdev
Kuniyuki Iwashima wrote:
> Currently, we cannot write IPv4 or IPv6 specific packetdrill tests
> as ksft_runner.sh runs each .pkt file for both protocols.
>
> Let's support single protocol test by checking --ip_version in the
> .pkt file.
>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
> ---
> .../selftests/net/packetdrill/ksft_runner.sh | 47 +++++++++++--------
> 1 file changed, 28 insertions(+), 19 deletions(-)
>
> diff --git a/tools/testing/selftests/net/packetdrill/ksft_runner.sh b/tools/testing/selftests/net/packetdrill/ksft_runner.sh
> index a7e790af38ff..0ae6eeeb1a8e 100755
> --- a/tools/testing/selftests/net/packetdrill/ksft_runner.sh
> +++ b/tools/testing/selftests/net/packetdrill/ksft_runner.sh
> @@ -3,21 +3,22 @@
>
> source "$(dirname $(realpath $0))/../../kselftest/ktap_helpers.sh"
>
> -readonly ipv4_args=('--ip_version=ipv4 '
> - '--local_ip=192.168.0.1 '
> - '--gateway_ip=192.168.0.1 '
> - '--netmask_ip=255.255.0.0 '
> - '--remote_ip=192.0.2.1 '
> - '-D CMSG_LEVEL_IP=SOL_IP '
> - '-D CMSG_TYPE_RECVERR=IP_RECVERR ')
> -
> -readonly ipv6_args=('--ip_version=ipv6 '
> - '--mtu=1520 '
> - '--local_ip=fd3d:0a0b:17d6::1 '
> - '--gateway_ip=fd3d:0a0b:17d6:8888::1 '
> - '--remote_ip=fd3d:fa7b:d17d::1 '
> - '-D CMSG_LEVEL_IP=SOL_IPV6 '
> - '-D CMSG_TYPE_RECVERR=IPV6_RECVERR ')
> +declare -A ip_args=(
> + [ipv4]="--ip_version=ipv4
> + --local_ip=192.168.0.1
> + --gateway_ip=192.168.0.1
> + --netmask_ip=255.255.0.0
> + --remote_ip=192.0.2.1
> + -D CMSG_LEVEL_IP=SOL_IP
> + -D CMSG_TYPE_RECVERR=IP_RECVERR"
> + [ipv6]="--ip_version=ipv6
> + --mtu=1520
> + --local_ip=fd3d:0a0b:17d6::1
> + --gateway_ip=fd3d:0a0b:17d6:8888::1
> + --remote_ip=fd3d:fa7b:d17d::1
> + -D CMSG_LEVEL_IP=SOL_IPV6
> + -D CMSG_TYPE_RECVERR=IPV6_RECVERR"
> +)
>
> if [ $# -ne 1 ]; then
> ktap_exit_fail_msg "usage: $0 <script>"
> @@ -38,12 +39,20 @@ if [[ -n "${KSFT_MACHINE_SLOW}" ]]; then
> failfunc=ktap_test_xfail
> fi
>
> +ip_versions=$(grep -E '^--ip_version=' $script | cut -d '=' -f 2)
> +if [[ -z $ip_versions ]]; then
> + ip_versions="ipv4 ipv6"
> +elif [[ ! "$ip_versions" =~ ^ipv[46]$ ]]; then
> + ktap_exit_fail_msg "Too many or unsupported --ip_version: $ip_versions"
> + exit "$KSFT_FAIL"
> +fi
> +
> ktap_print_header
> ktap_set_plan 2
>
> -unshare -n packetdrill ${ipv4_args[@]} ${optargs[@]} $script > /dev/null \
> - && ktap_test_pass "ipv4" || $failfunc "ipv4"
> -unshare -n packetdrill ${ipv6_args[@]} ${optargs[@]} $script > /dev/null \
> - && ktap_test_pass "ipv6" || $failfunc "ipv6"
> +for ip_version in $ip_versions; do
> + unshare -n packetdrill ${ip_args[$ip_version]} ${optargs[@]} $script > /dev/null \
> + && ktap_test_pass $ip_version || $failfunc $ip_version
minor if respinning: indentation of 4 spaces instead of tab.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v1 net-next] selftests/net: packetdrill: Support single protocol test.
2025-08-19 23:14 [PATCH v1 net-next] selftests/net: packetdrill: Support single protocol test Kuniyuki Iwashima
2025-08-20 11:29 ` Willem de Bruijn
@ 2025-08-21 2:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-21 2:50 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: davem, edumazet, kuba, pabeni, horms, willemb, kuni1840, netdev
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 19 Aug 2025 23:14:57 +0000 you wrote:
> Currently, we cannot write IPv4 or IPv6 specific packetdrill tests
> as ksft_runner.sh runs each .pkt file for both protocols.
>
> Let's support single protocol test by checking --ip_version in the
> .pkt file.
>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
>
> [...]
Here is the summary with links:
- [v1,net-next] selftests/net: packetdrill: Support single protocol test.
https://git.kernel.org/netdev/net-next/c/a5c10aa3d1ba
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-21 2:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19 23:14 [PATCH v1 net-next] selftests/net: packetdrill: Support single protocol test Kuniyuki Iwashima
2025-08-20 11:29 ` Willem de Bruijn
2025-08-21 2:50 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.