virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Benjamin Poirier <benjamin.poirier@gmail.com>
Cc: netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com,
	davem@davemloft.net, edumazet@google.com, parav@nvidia.com,
	mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
	shuah@kernel.org, petrm@nvidia.com, liuhangbin@gmail.com,
	vladimir.oltean@nxp.com, idosch@nvidia.com,
	virtualization@lists.linux.dev
Subject: Re: [patch net-next 3/6] selftests: forwarding: add ability to assemble NETIFS array by driver name
Date: Sat, 13 Apr 2024 15:27:57 +0200	[thread overview]
Message-ID: <ZhqIXZYnHA0MZT3L@nanopsycho> (raw)
In-Reply-To: <ZhmbxntSvXrsnEG1@f4>

Fri, Apr 12, 2024 at 10:38:30PM CEST, benjamin.poirier@gmail.com wrote:
>On 2024-04-12 17:13 +0200, Jiri Pirko wrote:
>> From: Jiri Pirko <jiri@nvidia.com>
>> 
>> Allow driver tests to work without specifying the netdevice names.
>> Introduce a possibility to search for available netdevices according to
>> set driver name. Allow test to specify the name by setting
>> NETIF_FIND_DRIVER variable.
>> 
>> Note that user overrides this either by passing netdevice names on the
>> command line or by declaring NETIFS array in custom forwarding.config
>> configuration file.
>> 
>> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>> ---
>>  tools/testing/selftests/net/forwarding/lib.sh | 39 +++++++++++++++++++
>>  1 file changed, 39 insertions(+)
>> 
>> diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
>> index 6f6a0f13465f..06633518b3aa 100644
>> --- a/tools/testing/selftests/net/forwarding/lib.sh
>> +++ b/tools/testing/selftests/net/forwarding/lib.sh
>> @@ -55,6 +55,9 @@ declare -A NETIFS=(
>>  : "${NETIF_CREATE:=yes}"
>>  : "${NETIF_TYPE:=veth}"
>>  
>> +# Whether to find netdevice according to the specified driver.
>> +: "${NETIF_FIND_DRIVER:=}"
>> +
>
>This section of the file sets default values for variables that can be
>set by users in forwarding.config. NETIF_FIND_DRIVER is more like
>NUM_NETIFS, it is set by tests, so I don't think it should be listed
>there.

Well, currently there is a mixture of config variables and test
definitions/requirements. For example REQUIRE_JQ, REQUIRE_MZ, REQUIRE_MTOOLS
are not forwarding.config configurable (they are, they should not be ;))

Where do you suggest to move NETIF_FIND_DRIVER?


>
>>  # Constants for ping tests:
>>  # How many packets should be sent.
>>  : "${PING_COUNT:=10}"
>> @@ -94,6 +97,42 @@ if [[ ! -v NUM_NETIFS ]]; then
>>  	exit $ksft_skip
>>  fi
>>  
>> +##############################################################################
>> +# Find netifs by test-specified driver name
>> +
>> +driver_name_get()
>> +{
>> +	local dev=$1; shift
>> +	local driver_path="/sys/class/net/$dev/device/driver"
>> +
>> +	if [ ! -L $driver_path ]; then
>> +		echo ""
>> +	else
>> +		basename `realpath $driver_path`
>> +	fi
>> +}
>> +
>> +find_netif()
>> +{
>> +	local ifnames=`ip -j -p link show | jq -e -r ".[].ifname"`
>
>-p and -e can be omitted

True. Will remove them.

  reply	other threads:[~2024-04-13 13:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 15:13 [patch net-next 0/6] selftests: virtio_net: introduce initial testing infrastructure Jiri Pirko
2024-04-12 15:13 ` [patch net-next 1/6] virtio: add debugfs infrastructure to allow to debug virtio features Jiri Pirko
2024-04-12 15:13 ` [patch net-next 2/6] selftests: forwarding: move couple of initial check to the beginning Jiri Pirko
2024-04-12 15:13 ` [patch net-next 3/6] selftests: forwarding: add ability to assemble NETIFS array by driver name Jiri Pirko
2024-04-12 20:38   ` Benjamin Poirier
2024-04-13 13:27     ` Jiri Pirko [this message]
2024-04-14 19:32       ` Benjamin Poirier
2024-04-15  8:40         ` Jiri Pirko
2024-04-12 15:13 ` [patch net-next 4/6] selftests: forwarding: add check_driver() helper Jiri Pirko
2024-04-12 15:13 ` [patch net-next 5/6] selftests: forwarding: add wait_for_dev() helper Jiri Pirko
2024-04-12 20:43   ` Benjamin Poirier
2024-04-13 13:29     ` Jiri Pirko
2024-04-12 15:13 ` [patch net-next 6/6] selftests: virtio_net: add initial tests Jiri Pirko
2024-04-12 20:46   ` Benjamin Poirier
2024-04-13 13:29     ` Jiri Pirko
2024-04-13  1:04 ` [patch net-next 0/6] selftests: virtio_net: introduce initial testing infrastructure Jakub Kicinski
2024-04-13 13:23   ` Jiri Pirko
2024-04-15 17:26     ` Jakub Kicinski
2024-04-16  9:53       ` Jiri Pirko
2024-04-16 13:03         ` Jiri Pirko
2024-04-17  4:36           ` Jason Wang

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=ZhqIXZYnHA0MZT3L@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=benjamin.poirier@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parav@nvidia.com \
    --cc=petrm@nvidia.com \
    --cc=shuah@kernel.org \
    --cc=virtualization@lists.linux.dev \
    --cc=vladimir.oltean@nxp.com \
    --cc=xuanzhuo@linux.alibaba.com \
    /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).