RE: [PATCH] selftests: net: devlink_port_split.py: skip the test if no devlink device

From: Danielle Ratson <hidden>
Date: 2021-05-20 15:00:43
Also in: linux-kselftest, lkml

-----Original Message-----
From: Po-Hsu Lin <redacted>
Sent: Thursday, May 20, 2021 1:50 PM
To: linux-kernel@vger.kernel.org; linux-kselftest@vger.kernel.org; netdev@vger.kernel.org
Cc: po-hsu.lin@canonical.com; shuah@kernel.org; kuba@kernel.org; davem@davemloft.net; skhan@linuxfoundation.org
Subject: [PATCH] selftests: net: devlink_port_split.py: skip the test if no devlink device

When there is no devlink device, the following command will return:
  $ devlink -j dev show
  {dev:{}}

This will cause IndexError when trying to access the first element in dev of this json dataset. Use the kselftest framework skip code to
skip this test in this case.

Example output with this change:
  # selftests: net: devlink_port_split.py
  # no devlink device was found, test skipped
  ok 7 selftests: net: devlink_port_split.py # SKIP

Link: https://bugs.launchpad.net/bugs/1928889
Signed-off-by: Po-Hsu Lin <redacted>
Reviewed-by: Danielle Ratson <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help