From: Petr Machata <me@pmachata.org>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
pabeni@redhat.com, shuah@kernel.org, petrm@nvidia.com,
linux-kselftest@vger.kernel.org, willemb@google.com,
Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH net-next 1/5] selftests: drv-net: define endpoint structures
Date: Mon, 15 Apr 2024 21:39:06 +0200 [thread overview]
Message-ID: <87v84ie6aj.fsf@nvidia.com> (raw)
In-Reply-To: <661c0cae8110a_3e773229418@willemb.c.googlers.com.notmuch>
Willem de Bruijn <willemdebruijn.kernel@gmail.com> writes:
> 1. Cleaning up remote state in all conditions, including timeout/kill.
>
> Some tests require a setup phase before the test, and a matching
> cleanup phase. If any of the configured state is variable (even
> just a randomized filepath) this needs to be communicated to the
> cleanup phase. The remote filepath is handled well here. But if
> a test needs per-test setup? Say, change MTU or an Ethtool feature.
> Multiple related tests may want to share a setup/cleanup.
Personally I like to wrap responsibilities of this sort in context
managers, e.g. something along these lines:
class changed_mtu:
def __init__(self, dev, mtu):
self.dev = dev
self.mtu = mtu
def __enter__(self):
js = cmd(f"ip -j link show dev {self.dev}", json=True)
self.orig_mtu = something_something(js)
cmd(f"ip link set dev {self.dev} mtu {self.mtu}")
def __exit__(self, type, value, traceback):
cmd(f"ip link set dev {self.dev} mtu {self.orig_mtu}")
with changed_mtu(swp1, 10000):
# MTU is 10K here
# and back to 1500
A lot of this can be made generic, where some object is given a setup /
cleanup commands and just invokes those. But things like MTU, ethtool
speed, sysctls and what have you that need to save a previous state and
revert back to it will probably need a custom handler. Like we have them
in lib.sh as well.
next prev parent reply other threads:[~2024-04-15 20:10 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-12 23:37 [PATCH net-next 0/5] selftests: drv-net: support testing with a remote system Jakub Kicinski
2024-04-12 23:37 ` [PATCH net-next 1/5] selftests: drv-net: define endpoint structures Jakub Kicinski
2024-04-14 17:04 ` Willem de Bruijn
2024-04-15 14:16 ` Jakub Kicinski
2024-04-15 15:23 ` Willem de Bruijn
2024-04-15 19:39 ` Petr Machata [this message]
2024-04-15 8:57 ` Paolo Abeni
2024-04-15 14:19 ` Jakub Kicinski
2024-04-15 16:02 ` Paolo Abeni
2024-04-15 16:11 ` Paolo Abeni
2024-04-12 23:37 ` [PATCH net-next 2/5] selftests: drv-net: add stdout to the command failed exception Jakub Kicinski
2024-04-12 23:37 ` [PATCH net-next 3/5] selftests: drv-net: factor out parsing of the env Jakub Kicinski
2024-04-12 23:37 ` [PATCH net-next 4/5] selftests: drv-net: construct environment for running tests which require an endpoint Jakub Kicinski
2024-04-14 16:45 ` Willem de Bruijn
2024-04-15 14:31 ` Jakub Kicinski
2024-04-15 15:28 ` Willem de Bruijn
2024-04-15 17:36 ` Jakub Kicinski
2024-04-15 9:28 ` Paolo Abeni
2024-04-12 23:37 ` [PATCH net-next 5/5] selftests: drv-net: add a trivial ping test Jakub Kicinski
2024-04-15 9:31 ` Paolo Abeni
2024-04-15 14:33 ` Jakub Kicinski
2024-04-15 16:09 ` Paolo Abeni
2024-04-15 15:30 ` [PATCH net-next 0/5] selftests: drv-net: support testing with a remote system Willem de Bruijn
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=87v84ie6aj.fsf@nvidia.com \
--to=me@pmachata.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=shuah@kernel.org \
--cc=willemb@google.com \
--cc=willemdebruijn.kernel@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.