diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2024-04-29 07:44:22 -0700 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2024-04-30 08:15:31 -0700 |
| commit | ff4b2bfa63bd07cca35f6e704dc5035650595950 (patch) | |
| tree | 477f867e43f040df1664202612270d384df078fb /tools/testing/selftests/drivers/net/hw/lib | |
| parent | 12b6c3a0380a220edb03691689167be13faa4f45 (diff) | |
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/hw/lib')
| -rw-r--r-- | tools/testing/selftests/drivers/net/hw/lib/py/__init__.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/testing/selftests/drivers/net/hw/lib/py/__init__.py b/tools/testing/selftests/drivers/net/hw/lib/py/__init__.py new file mode 100644 index 000000000000..b582885786f5 --- /dev/null +++ b/tools/testing/selftests/drivers/net/hw/lib/py/__init__.py @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0 + +import sys +from pathlib import Path + +KSFT_DIR = (Path(__file__).parent / "../../../../..").resolve() + +try: + sys.path.append(KSFT_DIR.as_posix()) + from net.lib.py import * + from drivers.net.lib.py import * +except ModuleNotFoundError as e: + ksft_pr("Failed importing `net` library from kernel sources") + ksft_pr(str(e)) + ktap_result(True, comment="SKIP") + sys.exit(4) |
