selftests: net: set the exit code correctly in Python tests
authorJakub Kicinski <kuba@kernel.org>
Wed, 17 Apr 2024 23:11:40 +0000 (16:11 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 18 Apr 2024 23:15:31 +0000 (16:15 -0700)
commit4fa6bd4b33ac9b914e3d1bb95848239ab8fdde1a
tree85488d7645d62a06b7c5a5a62d9e0c501a852182
parent655614ea2bd3b5774cdb95c7630d8327bf221934
selftests: net: set the exit code correctly in Python tests

Test cases need to exit with non-zero status if they failed,
we currently don't do that:

  # KTAP version 1
  # 1..3
  # # At /root/ksft-net-drv/drivers/net/./ping.py line 18:
  # # Check failed 1 != 2
  # not ok 1 ping.test_v4
  # ok 2 ping.test_v6
  # ok 3 ping.test_tcp
  # # Totals: pass:2 fail:1 xfail:0 xpass:0 skip:0 error:0
  ok 1 selftests: drivers/net: ping.py
  ^^^^

It's a bit tempting to make the exit part of ksft_run(),
but that only works well for very trivial setups. We can
revisit this later, if people forget to call ksft_exit().

Link: https://lore.kernel.org/r/20240417231146.2435572-3-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/drivers/net/stats.py
tools/testing/selftests/net/lib/py/ksft.py
tools/testing/selftests/net/nl_netdev.py