]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests: net: ksft: support marking tests as disruptive
authorStanislav Fomichev <sdf@fomichev.me>
Fri, 2 Aug 2024 00:03:08 +0000 (17:03 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 2 Aug 2024 23:09:27 +0000 (16:09 -0700)
commitf879306834818ebd1722a4372079610cdd466fec
treec572e60571aaba37efdd5b624f6c82141000bfa9
parentab1000976cc7de8e57bdef811dfcfcb6c17a929f
selftests: net: ksft: support marking tests as disruptive

Add new @ksft_disruptive decorator to mark the tests that might
be disruptive to the system. Depending on how well the previous
test works in the CI we might want to disable disruptive tests
by default and only let the developers run them manually.

KSFT framework runs disruptive tests by default. DISRUPTIVE=False
environment (or config file) can be used to disable these tests.
ksft_setup should be called by the test cases that want to use
new decorator (ksft_setup is only called via NetDrvEnv/NetDrvEpEnv for now).

In the future we can add similar decorators to, for example, avoid
running slow tests all the time. And/or have some option to run
only 'fast' tests for some sort of smoke test scenario.

  $ DISRUPTIVE=False ./stats.py
  KTAP version 1
  1..5
  ok 1 stats.check_pause
  ok 2 stats.check_fec
  ok 3 stats.pkt_byte_sum
  ok 4 stats.qstat_by_ifindex
  ok 5 stats.check_down # SKIP marked as disruptive
  # Totals: pass:4 fail:0 xfail:0 xpass:0 skip:1 error:0

v3:
- parse yes and properly treat non-zero nums as true (Petr)

v2:
- convert from cli argument to env variable (Jakub)

Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20240802000309.2368-2-sdf@fomichev.me
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/drivers/net/lib/py/env.py
tools/testing/selftests/drivers/net/stats.py
tools/testing/selftests/net/lib/py/ksft.py