]> git.baikalelectronics.ru Git - kernel.git/commit
selftests: net: devlink_port_split.py: skip the test if no devlink device
authorPo-Hsu Lin <po-hsu.lin@canonical.com>
Thu, 20 May 2021 10:49:54 +0000 (18:49 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 May 2021 22:46:57 +0000 (15:46 -0700)
commitc19e0c8a6f80ea5df4aa7ae9426d1a9ebb25a910
treee9ec7ca7de2ce37d4e609d70a3d5a11e1b6e93fb
parentcc78c87a9ef9254692040e389c37ad1e56e053e1
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 <po-hsu.lin@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/devlink_port_split.py