| ce0f92dc | 13-Jan-2026 |
Jakub Kicinski <kuba@kernel.org> |
selftests: net: py: teach cmd() how to print itself
Teach cmd() how to print itself, to make debug prints easier. Example output (leading # due to ksft_pr()):
# CMD: /root/ksft-net-drv/drivers/ne
selftests: net: py: teach cmd() how to print itself
Teach cmd() how to print itself, to make debug prints easier. Example output (leading # due to ksft_pr()):
# CMD: /root/ksft-net-drv/drivers/net/gro # EXIT: 1 # STDOUT: ipv6 with ext header does coalesce: # STDERR: Expected {200 }, Total 1 packets # Received {100 [!=200]100 [!=0]}, Total 2 packets.
Reviewed-by: Petr Machata <petrm@nvidia.com> Link: https://patch.msgid.link/20260113000740.255360-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 7a1ff354 | 08-Jan-2026 |
Jakub Kicinski <kuba@kernel.org> |
selftests: net: py: ensure defer() is only used within a test case
I wasted a couple of hours recently after accidentally adding a defer() from within a function which itself was called as part of d
selftests: net: py: ensure defer() is only used within a test case
I wasted a couple of hours recently after accidentally adding a defer() from within a function which itself was called as part of defer(). This leads to an infinite loop of defer(). Make sure this cannot happen and raise a helpful exception.
I understand that the pair of _ksft_defer_arm() calls may not be the most Pythonic way to implement this, but it's easy enough to understand.
Reviewed-by: Petr Machata <petrm@nvidia.com> Link: https://patch.msgid.link/20260108225257.2684238-2-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 15011a57 | 20-Nov-2025 |
Jakub Kicinski <kuba@kernel.org> |
selftests: net: py: read ip link info about remote dev
We're already saving the info about the local dev in env.dev for the tests, save remote dev as well. This is more symmetric, env generally prov
selftests: net: py: read ip link info about remote dev
We're already saving the info about the local dev in env.dev for the tests, save remote dev as well. This is more symmetric, env generally provides the same info for local and remote end.
While at it make sure that we reliably get the detailed info about the local dev. nsim used to read the dev info without -d.
Reviewed-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20251120021024.2944527-8-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| e02b52ec | 20-Nov-2025 |
Jakub Kicinski <kuba@kernel.org> |
selftests: net: py: support ksft ready without wait
There's a common synchronization problem when a script (Python test) uses a C program to set up some state (usually start a receiving process for
selftests: net: py: support ksft ready without wait
There's a common synchronization problem when a script (Python test) uses a C program to set up some state (usually start a receiving process for traffic). The script needs to know when the process has fully initialized. The inverse of the problem exists for shutting the process down - we need a reliable way to tell the process to exit.
We added helpers to do this safely in commit 71477137994f ("selftests: drv-net: add a way to wait for a local process") unfortunately the two operations (wait for init, and shutdown) are controlled by a single parameter (ksft_wait). Add support for using ksft_ready without using the second fd for exit.
This is useful for programs which wait for a specific number of packets to rx so exit_wait is a good match, but we still need to wait for init.
Reviewed-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Reviewed-by: breno Leitao <leitao@debian.org> Link: https://patch.msgid.link/20251120021024.2944527-7-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 6ae67f11 | 20-Nov-2025 |
Jakub Kicinski <kuba@kernel.org> |
selftests: net: py: add test variants
There's a lot of cases where we try to re-run the same code with different parameters. We currently need to either use a generator method or create a "main" cas
selftests: net: py: add test variants
There's a lot of cases where we try to re-run the same code with different parameters. We currently need to either use a generator method or create a "main" case implementation which then gets called by trivial case functions:
def _test(x, y, z): ...
def case_int(): _test(1, 2, 3)
def case_str(): _test('a', 'b', 'c')
Add support for variants, similar to kselftests_harness.h and a lot of other frameworks. Variants can be added as decorator to test functions:
@ksft_variants([(1, 2, 3), ('a', 'b', 'c')]) def case(x, y, z): ...
ksft_run() will auto-generate case names: case.1_2_3 case.a_b_c
Because the names may not always be pretty (and to avoid forcing classes to implement case-friendly __str__()) add a wrapper class KsftNamedVariant which lets the user specify the name for the variant.
Note that ksft_run's args are still supported. ksft_run splices args and variant params together.
Reviewed-by: Willem de Bruijn <willemb@google.com> Reviewed-by: Petr Machata <petrm@nvidia.com> Link: https://patch.msgid.link/20251120021024.2944527-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 80970e0f | 20-Nov-2025 |
Jakub Kicinski <kuba@kernel.org> |
selftests: net: py: extract the case generation logic
In preparation for adding test variants move the test case collection logic to a dedicated function. New helper returns
(function, args, name,
selftests: net: py: extract the case generation logic
In preparation for adding test variants move the test case collection logic to a dedicated function. New helper returns
(function, args, name, )
tuples. The main test loop can simply run them, not much logic or discernment needed.
Reviewed-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20251120021024.2944527-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|