diff options
author | Po-Hsu Lin | 2023-03-16 00:53:53 +0800 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-03-22 13:33:50 +0100 |
commit | 51b6912a6bac0c9460205b3d9555be9d33b70f31 (patch) | |
tree | 48909c328b12979b8551a79d6606c76b1f2e7fab /rust | |
parent | 76d8a9a194caa755a634ce6687f60229f1c64f8f (diff) |
selftests: net: devlink_port_split.py: skip test if no suitable device available
[ Upstream commit 24994513ad13ff2c47ba91d2b5df82c3d496c370 ]
The `devlink -j port show` command output may not contain the "flavour"
key, an example from Ubuntu 22.10 s390x LPAR(5.19.0-37-generic), with
mlx4 driver and iproute2-5.15.0:
{"port":{"pci/0001:00:00.0/1":{"type":"eth","netdev":"ens301"},
"pci/0001:00:00.0/2":{"type":"eth","netdev":"ens301d1"},
"pci/0002:00:00.0/1":{"type":"eth","netdev":"ens317"},
"pci/0002:00:00.0/2":{"type":"eth","netdev":"ens317d1"}}}
This will cause a KeyError exception.
Create a validate_devlink_output() to check for this "flavour" from
devlink command output to avoid this KeyError exception. Also let
it handle the check for `devlink -j dev show` output in main().
Apart from this, if the test was not started because the max lanes of
the designated device is 0. The script will still return 0 and thus
causing a false-negative test result.
Use a found_max_lanes flag to determine if these tests were skipped
due to this reason and return KSFT_SKIP to make it more clear.
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>
Link: https://lore.kernel.org/r/20230315165353.229590-1-po-hsu.lin@canonical.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'rust')
0 files changed, 0 insertions, 0 deletions