All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Po-Hsu Lin <po-hsu.lin@canonical.com>
Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	netdev@vger.kernel.org, idosch@mellanox.com,
	danieller@mellanox.com, petrm@mellanox.com, shuah@kernel.org,
	pabeni@redhat.com, edumazet@google.com, davem@davemloft.net
Subject: Re: [PATCH] selftests: net: devlink_port_split.py: skip test if no suitable device available
Date: Mon, 6 Mar 2023 10:33:16 -0800	[thread overview]
Message-ID: <20230306103316.3224383e@kernel.org> (raw)
In-Reply-To: <20230306111959.429680-1-po-hsu.lin@canonical.com>

On Mon,  6 Mar 2023 19:19:59 +0800 Po-Hsu Lin wrote:
> The `devlink -j dev show` command output may not contain the "flavour"
> key, for example:
>   $ devlink -j dev show
>   {"dev":{"pci/0001:00:00.0":{},"pci/0002:00:00.0":{}}}

It's not dev that's supposed to have the flavor, it's port.

  devlink -j port show

Are you running with old kernel or old user space?
Flavor is not an optional attribute.

> This will cause a KeyError exception. Fix this by checking the key
> existence first.
> 
> Also, if max lanes is 0 the port splitting won't be tested at all.
> but the script will end normally and thus causing a false-negative
> test result.
> 
> Use a test_ran flag to determine if these tests were skipped and
> return KSFT_SKIP accordingly.
> 
> Link: https://bugs.launchpad.net/bugs/1937133
> Fixes: f3348a82e727 ("selftests: net: Add port split test")
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>

Could you factor out the existing skipping logic from main()
(the code under "if not dev:") and add the test for flavors
to the same function? It'll be a bit more code but cleaner
result IMHO.

  reply	other threads:[~2023-03-06 18:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 11:19 [PATCH] selftests: net: devlink_port_split.py: skip test if no suitable device available Po-Hsu Lin
2023-03-06 18:33 ` Jakub Kicinski [this message]
2023-03-07  2:24   ` Po-Hsu Lin

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=20230306103316.3224383e@kernel.org \
    --to=kuba@kernel.org \
    --cc=danieller@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@mellanox.com \
    --cc=po-hsu.lin@canonical.com \
    --cc=shuah@kernel.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 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.