netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<edumazet@google.com>, <pabeni@redhat.com>, <shuah@kernel.org>,
	<sdf@google.com>, <donald.hunter@gmail.com>,
	<linux-kselftest@vger.kernel.org>, <petrm@nvidia.com>
Subject: Re: [PATCH net-next v2 3/7] selftests: net: add scaffolding for Netlink tests in Python
Date: Thu, 4 Apr 2024 11:11:57 +0200	[thread overview]
Message-ID: <87cyr5h0o6.fsf@nvidia.com> (raw)
In-Reply-To: <20240403023426.1762996-4-kuba@kernel.org>


Jakub Kicinski <kuba@kernel.org> writes:

> Add glue code for accessing the YNL library which lives under
> tools/net and YAML spec files from under Documentation/.
> Automatically figure out if tests are run in tree or not.
> Since we'll want to use this library both from net and
> drivers/net test targets make the library a target as well,
> and automatically include it when net or drivers/net are
> included. Making net/lib a target ensures that we end up
> with only one copy of it, and saves us some path guessing.
>
> Add a tiny bit of formatting support to be able to output KTAP
> from the start.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> v2:
>  - include the net/lib only in install
>  - support passing state to tests
>  - don't apply Path() on what's already a Path()
>  - fix spacing in Makefile's filter()
>  - sort imports
>
> CC: shuah@kernel.org
> CC: linux-kselftest@vger.kernel.org
> ---
>  tools/testing/selftests/Makefile              |  9 +-
>  tools/testing/selftests/net/lib/Makefile      |  8 ++
>  .../testing/selftests/net/lib/py/__init__.py  |  6 ++
>  tools/testing/selftests/net/lib/py/consts.py  |  9 ++
>  tools/testing/selftests/net/lib/py/ksft.py    | 96 +++++++++++++++++++
>  tools/testing/selftests/net/lib/py/utils.py   | 47 +++++++++
>  tools/testing/selftests/net/lib/py/ynl.py     | 49 ++++++++++
>  7 files changed, 223 insertions(+), 1 deletion(-)
>  create mode 100644 tools/testing/selftests/net/lib/Makefile
>  create mode 100644 tools/testing/selftests/net/lib/py/__init__.py
>  create mode 100644 tools/testing/selftests/net/lib/py/consts.py
>  create mode 100644 tools/testing/selftests/net/lib/py/ksft.py
>  create mode 100644 tools/testing/selftests/net/lib/py/utils.py
>  create mode 100644 tools/testing/selftests/net/lib/py/ynl.py
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index e1504833654d..f533eb7054fe 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -116,6 +116,13 @@ TARGETS += zram
>  TARGETS_HOTPLUG = cpu-hotplug
>  TARGETS_HOTPLUG += memory-hotplug
>  
> +# Networking tests want the net/lib target, include it automatically
> +ifneq ($(filter net,$(TARGETS)),)
> +ifeq ($(filter net/lib,$(TARGETS)),)
> +	INSTALL_DEP_TARGETS := net/lib
> +endif
> +endif
> +
>  # User can optionally provide a TARGETS skiplist.  By default we skip
>  # BPF since it has cutting edge build time dependencies which require
>  # more effort to install.
> @@ -245,7 +252,7 @@ ifdef INSTALL_PATH
>  	install -m 744 run_kselftest.sh $(INSTALL_PATH)/
>  	rm -f $(TEST_LIST)
>  	@ret=1;	\
> -	for TARGET in $(TARGETS); do \
> +	for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \
>  		BUILD_TARGET=$$BUILD/$$TARGET;	\
>  		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install \
>  				INSTALL_PATH=$(INSTALL_PATH)/$$TARGET \
> diff --git a/tools/testing/selftests/net/lib/Makefile b/tools/testing/selftests/net/lib/Makefile
> new file mode 100644
> index 000000000000..5730682aeffb
> --- /dev/null
> +++ b/tools/testing/selftests/net/lib/Makefile
> @@ -0,0 +1,8 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +TEST_FILES := ../../../../../Documentation/netlink/s*

Not sure I understand the motivation for the wildcard. Currently this
matches Documentation/netlink/specs. Do you expect everything that
starts with s to be a testfile?

> +TEST_FILES += ../../../../net/*

Likewise this -- it's just tools/net/ynl? Will everything that's there
be a testfile?

> +TEST_INCLUDES := $(wildcard py/*.py)
> +
> +include ../../lib.mk

Other than that it looks OK.

Reviewed-by: Petr Machata <petrm@nvidia.com>

  reply	other threads:[~2024-04-04 10:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03  2:34 [PATCH net-next v2 0/7] selftests: net: groundwork for YNL-based tests Jakub Kicinski
2024-04-03  2:34 ` [PATCH net-next v2 1/7] netlink: specs: define ethtool header flags Jakub Kicinski
2024-04-04 10:38   ` Petr Machata
2024-04-03  2:34 ` [PATCH net-next v2 2/7] tools: ynl: copy netlink error to NlError Jakub Kicinski
2024-04-04 10:39   ` Petr Machata
2024-04-03  2:34 ` [PATCH net-next v2 3/7] selftests: net: add scaffolding for Netlink tests in Python Jakub Kicinski
2024-04-04  9:11   ` Petr Machata [this message]
2024-04-03  2:34 ` [PATCH net-next v2 4/7] selftests: nl_netdev: add a trivial Netlink netdev test Jakub Kicinski
2024-04-04 10:39   ` Petr Machata
2024-04-03  2:34 ` [PATCH net-next v2 5/7] netdevsim: report stats by default, like a real device Jakub Kicinski
2024-04-04 10:40   ` Petr Machata
2024-04-04 13:52     ` Jakub Kicinski
2024-04-04 13:40   ` Paolo Abeni
2024-04-04 13:53     ` Jakub Kicinski
2024-04-03  2:34 ` [PATCH net-next v2 6/7] selftests: drivers: add scaffolding for Netlink tests in Python Jakub Kicinski
2024-04-04 10:42   ` Petr Machata
2024-04-05  1:58     ` Jakub Kicinski
2024-04-03  2:34 ` [PATCH net-next v2 7/7] testing: net-drv: add a driver test for stats reporting Jakub Kicinski
2024-04-04 17:40 ` [PATCH net-next v2 0/7] selftests: net: groundwork for YNL-based tests patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cyr5h0o6.fsf@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@google.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).