[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231201120313.36c2e722@kernel.org>
Date: Fri, 1 Dec 2023 12:03:13 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Michal Michalik <michal.michalik@...el.com>
Cc: netdev@...r.kernel.org, vadim.fedorenko@...ux.dev,
arkadiusz.kubalewski@...el.com, jonathan.lemon@...il.com,
pabeni@...hat.com, poros@...hat.com, milena.olech@...el.com,
mschmidt@...hat.com, linux-clk@...r.kernel.org, bvanassche@....org,
davem@...emloft.net, edumazet@...gle.com
Subject: Re: [PATCH RFC net-next v4 2/2] selftests/dpll: add DPLL system
integration selftests
On Thu, 23 Nov 2023 05:52:43 -0500 Michal Michalik wrote:
> +++ b/tools/testing/selftests/drivers/net/netdevsim/dpll/ynlfamilyhandler.py
> @@ -0,0 +1,49 @@
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Wrapper for the YNL library used to interact with the netlink interface.
> +#
> +# Copyright (c) 2023, Intel Corporation.
> +# Author: Michal Michalik <michal.michalik@...el.com>
> +
> +import sys
> +from pathlib import Path
> +from dataclasses import dataclass
> +
> +from .consts import KSRC, YNLSPEC, YNLPATH
> +
> +
> +try:
> + ynl_full_path = Path(KSRC) / YNLPATH
> + sys.path.append(ynl_full_path.as_posix())
> + from lib import YnlFamily
> +except ModuleNotFoundError:
> + print("Failed importing `ynl` library from kernel sources, please set KSRC")
> + sys.exit(1)
Do you have any suggestions on how we could build up a common Python
library for selftests? Can we create a directory for "library" code
somewhere under tools/testing/ ? Adding a wrapper like this for every
test is going to hurt.
Calling out to YNL, manipulating network namespaces, manipulating
netdevsim instances, etc - will be fairly common for a lot of networking
tests.
There's already some code in tools/testing/selftests/bpf/test_offload.py
which is likely Python-incompetent cause I wrote it. But much like YNL
it'd be nice if it was available for new tests for reuse.
Can we somehow "add to python's library search path" or some such?
Powered by blists - more mailing lists