netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Abhinav Jain <jain.abhinav177@gmail.com>
Cc: horms@kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, shuah@kernel.org, netdev@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	skhan@linuxfoundation.org, javier.carrasco.cruz@gmail.com
Subject: Re: [PATCH v3] sefltests: net: Add on/off checks for network interface non fixed features
Date: Fri, 14 Jun 2024 18:50:07 -0700	[thread overview]
Message-ID: <20240614185007.36ef425a@kernel.org> (raw)
In-Reply-To: <20240614113240.41550-1-jain.abhinav177@gmail.com>

On Fri, 14 Jun 2024 11:32:40 +0000 Abhinav Jain wrote:
> This patch addresses the TODO (add non fixed feature on/off check).
> I have tested it manually on my system after making changes as suggested
> in v1 and v2 linked below for reference.
> Patch now restores the features being tested to their initial state.

Can you separate the features on/off and auto-adding veth into two
commits/patches? Then send them as a series?

> diff --git a/tools/testing/selftests/net/netdevice.sh b/tools/testing/selftests/net/netdevice.sh
> index e3afcb424710..d937d39dda6a 100755
> --- a/tools/testing/selftests/net/netdevice.sh
> +++ b/tools/testing/selftests/net/netdevice.sh
> @@ -104,6 +104,20 @@ kci_netdev_ethtool()
>  {
>  	netdev=$1
>  
> +	#check if netdev is provided as an argument
> +	if [ -z "$netdev" ]; then
> +		echo "No network device provided, creating a veth pair"
> +		ip link add veth0 type veth peer name veth1
> +		netdev="veth0"
> +		veth_created=1
> +	else
> +		#check if the provided netdev exists
> +		if ! ip link show "$netdev" > /dev/null 2>&1; then
> +			echo "Network device $netdev does not exist."
> +			return 1
> +		fi
> +	fi

I don't think this will work, since the function won't get called at
all if there is no netdev. You need to do the auto-adding around the

while read netdev

loop.

To test locally you can use network namespaces, or build and boot a
network-less kernel using vng:
https://github.com/linux-netdev/nipa/wiki/How-to-run-netdev-selftests-CI-style

      reply	other threads:[~2024-06-15  1:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 11:32 [PATCH v3] sefltests: net: Add on/off checks for network interface non fixed features Abhinav Jain
2024-06-15  1:50 ` Jakub Kicinski [this message]

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=20240614185007.36ef425a@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jain.abhinav177@gmail.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --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 \
    --cc=skhan@linuxfoundation.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).