diff options
author | Jakub Kicinski <kuba@kernel.org> | 2024-04-29 16:44:22 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-04-30 17:15:31 +0200 |
commit | ff4b2bfa63bd07cca35f6e704dc5035650595950 (patch) | |
tree | 477f867e43f040df1664202612270d384df078fb /tools/testing/selftests/drivers/net/lib | |
parent | net: page_pool: support error injection (diff) | |
download | linux-ff4b2bfa63bd07cca35f6e704dc5035650595950.tar.xz linux-ff4b2bfa63bd07cca35f6e704dc5035650595950.zip |
selftests: drv-net-hw: support using Python from net hw tests
We created a separate directory for HW-only tests, recently.
Glue in the Python test library there, Python is a bit annoying
when it comes to using library code located "lower"
in the directory structure.
Reuse the Env class, but let tests require non-nsim setup.
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20240429144426.743476-3-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/drivers/net/lib')
-rw-r--r-- | tools/testing/selftests/drivers/net/lib/py/env.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/testing/selftests/drivers/net/lib/py/env.py b/tools/testing/selftests/drivers/net/lib/py/env.py index e2ab637e56dc..5c8f695b2536 100644 --- a/tools/testing/selftests/drivers/net/lib/py/env.py +++ b/tools/testing/selftests/drivers/net/lib/py/env.py @@ -2,7 +2,7 @@ import os from pathlib import Path -from lib.py import KsftSkipEx +from lib.py import KsftSkipEx, KsftXfailEx from lib.py import cmd, ip from lib.py import NetNS, NetdevSimDev from .remote import Remote @@ -76,7 +76,7 @@ class NetDrvEpEnv: nsim_v4_pfx = "192.0.2." nsim_v6_pfx = "2001:db8::" - def __init__(self, src_path): + def __init__(self, src_path, nsim_test=None): self.env = _load_env_file(src_path) @@ -88,7 +88,10 @@ class NetDrvEpEnv: self._ns_peer = None if "NETIF" in self.env: + if nsim_test is True: + raise KsftXfailEx("Test only works on netdevsim") self._check_env() + self.dev = ip("link show dev " + self.env['NETIF'], json=True)[0] self.v4 = self.env.get("LOCAL_V4") @@ -98,6 +101,9 @@ class NetDrvEpEnv: kind = self.env["REMOTE_TYPE"] args = self.env["REMOTE_ARGS"] else: + if nsim_test is False: + raise KsftXfailEx("Test does not work on netdevsim") + self.create_local() self.dev = self._ns.nsims[0].dev |