| f0bd1931 | 10-Mar-2026 |
Gal Pressman <gal@nvidia.com> |
selftests: net: fix timeout passed as positional argument to communicate()
The cited commit refactored the hardcoded timeout=5 into a parameter, but dropped the keyword from the communicate() call.
selftests: net: fix timeout passed as positional argument to communicate()
The cited commit refactored the hardcoded timeout=5 into a parameter, but dropped the keyword from the communicate() call. Since Popen.communicate()'s first positional argument is 'input' (not 'timeout'), the timeout value is silently treated as stdin input and the call never enforces a timeout.
Pass timeout as a keyword argument to restore the intended behavior.
Reviewed-by: Nimrod Oren <noren@nvidia.com> Signed-off-by: Gal Pressman <gal@nvidia.com> Link: https://patch.msgid.link/20260310115803.2521050-3-gal@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 6e4dff20 | 23-Feb-2026 |
Jakub Kicinski <kuba@kernel.org> |
selftests: net: py: add cmd info for ksft_wait failure
Gal recently complained:
When [ksft_wait failure] happens, the test fails with a cryptic message: # Exception| Exception: Did not rece
selftests: net: py: add cmd info for ksft_wait failure
Gal recently complained:
When [ksft_wait failure] happens, the test fails with a cryptic message: # Exception| Exception: Did not receive ready message
Let's try to include the stdout/stderr of the command we tried to start. E.g. for cmd("false", ksft_wait=True):
# Exception| lib.py.utils.CmdInitFailure: Did not receive ready message # Exception| CMD: false # Exception| EXIT: 1
We need to factor out _process_terminate() otherwise the exit path may try to write to already disconnected self.ksft_term_fd.
Reviewed-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260223202633.4126087-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 04abab18 | 23-Feb-2026 |
Jakub Kicinski <kuba@kernel.org> |
selftests: net: py: use repr(cmd) for failure exceptions
Reuse repr(cmd) instead of manually formatting a similar string.
Before: # Exception| lib.py.utils.CmdExitFailure: Command failed: false
selftests: net: py: use repr(cmd) for failure exceptions
Reuse repr(cmd) instead of manually formatting a similar string.
Before: # Exception| lib.py.utils.CmdExitFailure: Command failed: false # Exception| STDOUT: b'' # Exception| STDERR: b''
After: # Exception| lib.py.utils.CmdExitFailure: Command failed # Exception| CMD: false # Exception| EXIT: 1
Reviewed-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260223202633.4126087-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 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 ...
|
| 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 ...
|