netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<edumazet@google.com>, <petrm@nvidia.com>, <razor@blackwall.org>,
	<mirsad.todorovac@alu.unizg.hr>, Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net 01/17] selftests: forwarding: Skip test when no interfaces are specified
Date: Wed, 2 Aug 2023 10:51:02 +0300	[thread overview]
Message-ID: <20230802075118.409395-2-idosch@nvidia.com> (raw)
In-Reply-To: <20230802075118.409395-1-idosch@nvidia.com>

As explained in [1], the forwarding selftests are meant to be run with
either physical loopbacks or veth pairs. The interfaces are expected to
be specified in a user-provided forwarding.config file or as command
line arguments. By default, this file is not present and the tests fail:

 # make -C tools/testing/selftests TARGETS=net/forwarding run_tests
 [...]
 TAP version 13
 1..102
 # timeout set to 45
 # selftests: net/forwarding: bridge_igmp.sh
 # Command line is not complete. Try option "help"
 # Failed to create netif
 not ok 1 selftests: net/forwarding: bridge_igmp.sh # exit=1
 [...]

Fix by skipping a test if interfaces are not provided either via the
configuration file or command line arguments.

 # make -C tools/testing/selftests TARGETS=net/forwarding run_tests
 [...]
 TAP version 13
 1..102
 # timeout set to 45
 # selftests: net/forwarding: bridge_igmp.sh
 # SKIP: Cannot create interface. Name not specified
 ok 1 selftests: net/forwarding: bridge_igmp.sh # SKIP

[1] tools/testing/selftests/net/forwarding/README

Fixes: 81573b18f26d ("selftests/net/forwarding: add Makefile to install tests")
Reported-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
Closes: https://lore.kernel.org/netdev/856d454e-f83c-20cf-e166-6dc06cbc1543@alu.unizg.hr/
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Tested-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
---
 tools/testing/selftests/net/forwarding/lib.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 9ddb68dd6a08..975fc5168c63 100755
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -225,6 +225,11 @@ create_netif_veth()
 	for ((i = 1; i <= NUM_NETIFS; ++i)); do
 		local j=$((i+1))
 
+		if [ -z ${NETIFS[p$i]} ]; then
+			echo "SKIP: Cannot create interface. Name not specified"
+			exit $ksft_skip
+		fi
+
 		ip link show dev ${NETIFS[p$i]} &> /dev/null
 		if [[ $? -ne 0 ]]; then
 			ip link add ${NETIFS[p$i]} type veth \
-- 
2.40.1


  reply	other threads:[~2023-08-02  7:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02  7:51 [PATCH net 00/17] selftests: forwarding: Various fixes Ido Schimmel
2023-08-02  7:51 ` Ido Schimmel [this message]
2023-08-02  7:51 ` [PATCH net 02/17] selftests: forwarding: Switch off timeout Ido Schimmel
2023-08-02  7:51 ` [PATCH net 03/17] selftests: forwarding: bridge_mdb: Check iproute2 version Ido Schimmel
2023-08-02  7:51 ` [PATCH net 04/17] selftests: forwarding: bridge_mdb_max: " Ido Schimmel
2023-08-02  7:51 ` [PATCH net 05/17] selftests: forwarding: Set default IPv6 traceroute utility Ido Schimmel
2023-08-02  7:51 ` [PATCH net 06/17] selftests: forwarding: Add a helper to skip test when using veth pairs Ido Schimmel
2023-08-02  7:51 ` [PATCH net 07/17] selftests: forwarding: ethtool: Skip " Ido Schimmel
2023-08-02  7:51 ` [PATCH net 08/17] selftests: forwarding: ethtool_extended_state: " Ido Schimmel
2023-08-02  7:51 ` [PATCH net 09/17] selftests: forwarding: hw_stats_l3_gre: " Ido Schimmel
2023-08-02  7:51 ` [PATCH net 10/17] selftests: forwarding: ethtool_mm: " Ido Schimmel
2023-08-02 10:52   ` Vladimir Oltean
2023-08-02 12:27     ` Petr Machata
2023-08-02 13:30       ` Ido Schimmel
2023-08-02 13:33         ` Vladimir Oltean
2023-08-02 14:22         ` Petr Machata
2023-08-02  7:51 ` [PATCH net 11/17] selftests: forwarding: tc_actions: Use ncat instead of nc Ido Schimmel
2023-08-02  7:51 ` [PATCH net 12/17] selftests: forwarding: tc_flower: Relax success criterion Ido Schimmel
2023-08-02  7:51 ` [PATCH net 13/17] selftests: forwarding: tc_tunnel_key: Make filters more specific Ido Schimmel
2023-08-02  8:30   ` Davide Caratti
2023-08-02  8:37     ` Ido Schimmel
2023-08-02  8:52       ` Davide Caratti
2023-08-02  7:51 ` [PATCH net 14/17] selftests: forwarding: tc_flower_l2_miss: Fix failing test with old libnet Ido Schimmel
2023-08-02  7:51 ` [PATCH net 15/17] selftests: forwarding: bridge_mdb: " Ido Schimmel
2023-08-02  7:51 ` [PATCH net 16/17] selftests: forwarding: bridge_mdb_max: " Ido Schimmel
2023-08-02  7:51 ` [PATCH net 17/17] selftests: forwarding: bridge_mdb: Make test more robust Ido Schimmel

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=20230802075118.409395-2-idosch@nvidia.com \
    --to=idosch@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=mirsad.todorovac@alu.unizg.hr \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=razor@blackwall.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).