From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com, ncardwell@google.com,
shuah@kernel.org, linux-kselftest@vger.kernel.org,
fw@strlen.de, Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft
Date: Wed, 28 Aug 2024 09:58:16 -0400 [thread overview]
Message-ID: <66cf2cf8efd6f_33815c29411@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <20240827173905.65b8efcc@kernel.org>
Jakub Kicinski wrote:
> Very exciting to see packetdrill tests making their way upstream!
>
> On Tue, 27 Aug 2024 15:32:29 -0400 Willem de Bruijn wrote:
> > RFC points for discussion
> >
> > ksft: the choice for this python framework introduces a dependency on
> > the YNL scripts, and some non-obvious code:
> > - to include the net/lib dep in tools/testing/selftests/Makefile
> > - a boilerplate lib/py/__init__.py that each user of ksft will need
> > It seems preferable to me to use ksft.py over reinventing the wheel,
> > e.g., to print KTAP output. But perhaps we can make it more obvious
> > for future ksft users, and make the dependency on YNL optional.
>
> No preference here, the wrapper script uses little of the python
> code, and use of YNL seems unlikely, so it's a coin toss whether
> it's worth linking up to net/lib/py or just writing a bit of bash.
>
> > kselftest-per-directory: copying packetdrill_ksft.py to create a
> > separate script per dir is a bit of a hack. A single script is much
> > simpler, optionally with nested KTAP (not supported yet by ksft). But,
> > I'm afraid that running time without intermediate output will be very
> > long when we integrate all packetdrill scripts.
>
> Not sure what you mean by intermediate output (the perl wrapper prints
> immediately, do you have perl?). We do have some nested ktap parsing
> in nipa, but small tweaks would be necessary to "decapsulate" the first
> layer completely. My bigger concern would be runtime, if the time it
> takes to run all tests grows we spawn multiple VMs and load balance
> the test cases.
>
> All in all, trying to support single script is probably not worth the
> extra effort.
>
> > nf_conntrack: we can dedup the common.sh.
> >
> > *pkt files: which of the 150+ scripts on github are candidates for
> > kselftests, all or a subset? To avoid change detector tests.
>
> Other than avoiding known flakes - no concerns. Is the distinction
> between "change detector" vs hard tests (uAPI change / RFC compliance),
> well defined? Not sure if that's really possible but if so it would be
> nice to "sort" the tests into different dirs.
It's not as clear-cut as API/RFC.
The major change detector issues are with timing, as packetdrill
scripts have timestamped lines. I think usec TCP timestamps were an
issue at some point. On-going is that we increase allowed variance on
debug builds. Note to self that that is missing here.
I think that all tests we open sourced to github so far were chosen to
be robust. Will double check and err on the side of caution.
> > And what
> > is the best way to eventually send up to 150 files, 7K LoC.
>
> Just send them, slice into a handful (<10) of patches if you can.
> 7k LoC is same order of magnitude as initial drivers we merge.
>
> To be clear let's start with a small patch like this one.
> Since this is a new target I'll have to reconfigure the runners.
> So we'll see how well this works once it's merged.
> Spinning up new runners is a bit tedious but here new target seems
> quite justified.
Ack. Thanks for that guidance.
> > tools/testing/selftests/Makefile | 7 +-
> > .../selftests/net/packetdrill/.gitignore | 1 +
> > .../selftests/net/packetdrill/Makefile | 28 ++++++
> > .../net/packetdrill/lib/py/__init__.py | 15 ++++
> > .../net/packetdrill/packetdrill_ksft.py | 90 +++++++++++++++++++
> > .../net/packetdrill/tcp/common/defaults.sh | 63 +++++++++++++
> > .../net/packetdrill/tcp/common/set_sysctls.py | 38 ++++++++
> > .../net/packetdrill/tcp/inq/client.pkt | 51 +++++++++++
> > .../net/packetdrill/tcp/inq/server.pkt | 51 +++++++++++
> > .../tcp/md5/md5-only-on-client-ack.pkt | 28 ++++++
>
> prolly need a config file to enable kconfig for MD5 ?
> perils of adding new targets
>
> > diff --git a/tools/testing/selftests/net/packetdrill/.gitignore b/tools/testing/selftests/net/packetdrill/.gitignore
> > new file mode 100644
> > index 0000000000000..a40f1a600eb94
> > --- /dev/null
> > +++ b/tools/testing/selftests/net/packetdrill/.gitignore
> > @@ -0,0 +1 @@
> > +tcp*sh
>
> Is this right or should it be tcp_*.py ?
>
> > diff --git a/tools/testing/selftests/net/packetdrill/Makefile b/tools/testing/selftests/net/packetdrill/Makefile
> > new file mode 100644
> > index 0000000000000..d94c51098d1f0
> > --- /dev/null
> > +++ b/tools/testing/selftests/net/packetdrill/Makefile
> > @@ -0,0 +1,28 @@
> > +# SPDX-License-Identifier: GPL-2.0
>
> Would be nice to add a few lines here with an overview of how the
> packetdrill tests get executed. People may jump in here to try to
> add new tests, since that's how ksft usually operates.
>
> > +def scriptname_to_testdir(filepath):
> > + """Extract the directory to run from this filename."""
> > +
> > + suffix = ".sh"
>
> .sh again ?
>
> > diff --git a/tools/testing/selftests/net/packetdrill/tcp/common/defaults.sh b/tools/testing/selftests/net/packetdrill/tcp/common/defaults.sh
>
> > +# Override the default qdisc on the tun device.
> > +# Many tests fail with timing errors if the default
> > +# is FQ and that paces their flows.
> > +tc qdisc add dev tun0 root pfifo
> > +
>
> nit: double new line
>
> > diff --git a/tools/testing/selftests/net/packetdrill/tcp/common/set_sysctls.py b/tools/testing/selftests/net/packetdrill/tcp/common/set_sysctls.py
> > new file mode 100755
> > index 0000000000000..5ddf456ae973a
> > --- /dev/null
> > +++ b/tools/testing/selftests/net/packetdrill/tcp/common/set_sysctls.py
>
> What calls this one? I can't grep it out.
Whoops. I changed test directories and apparently these ones don't
rely on this.
Thanks for the review. I'll take a quick stab at a standalone script
to see whether that is easier. Else will resubmit with these and
Paolo's feedback addressed.
In particular to Paolo's feedback: running multiple tests in parallel
like run_all.py can. Come to think of it, maybe I should import
run_all.py, modifying it to output KTAP and ksft return codes.
next prev parent reply other threads:[~2024-08-28 13:58 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 19:32 [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft Willem de Bruijn
2024-08-28 0:39 ` Jakub Kicinski
2024-08-28 13:58 ` Willem de Bruijn [this message]
2024-08-28 8:20 ` Paolo Abeni
2024-08-28 14:03 ` Willem de Bruijn
2024-08-28 16:01 ` Jakub Kicinski
2024-08-28 19:33 ` Willem de Bruijn
2024-08-28 21:00 ` Jakub Kicinski
2024-08-30 15:20 ` Willem de Bruijn
2024-08-30 17:33 ` Jakub Kicinski
2024-08-30 18:47 ` Willem de Bruijn
2024-08-30 21:44 ` Jakub Kicinski
2024-08-30 21:52 ` Willem de Bruijn
2024-09-01 21:15 ` Willem de Bruijn
2024-09-02 16:46 ` Jakub Kicinski
2024-09-02 16:56 ` Jakub Kicinski
2024-09-02 20:50 ` Willem de Bruijn
2024-09-05 3:27 ` Willem de Bruijn
2024-08-30 21:46 ` Willem de Bruijn
2024-08-28 16:26 ` Matthieu Baerts
2024-08-28 15:01 ` Stanislav Fomichev
2024-08-28 15:36 ` Jakub Kicinski
2024-08-28 15:43 ` Willem de Bruijn
2024-08-28 17:20 ` Stanislav Fomichev
2024-08-28 18:23 ` Jakub Kicinski
2024-08-28 18:36 ` Stanislav Fomichev
2024-08-28 18:26 ` Mina Almasry
2024-08-28 18:39 ` Jakub Kicinski
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=66cf2cf8efd6f_33815c29411@willemb.c.googlers.com.notmuch \
--to=willemdebruijn.kernel@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=willemb@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox