In order to be able to save the current value of a sysctl without changing
it, split the relevant bit out of sysctl_set() into a new helper.
Signed-off-by: Petr Machata
Reviewed-by: Ido Schimmel
---
Cc: Shuah Khan
Cc: linux-kselftest@vger.kernel.org
Notes:
v2:
- New patch.
tools
-by: Petr Machata
Reviewed-by: Ido Schimmel
---
Cc: Shuah Khan
Cc: linux-kselftest@vger.kernel.org
Notes:
v2:
- Do not set seed on test init and run the stability tests first to catch
the cases of a missed pernet seed init.
.../testing/selftests/net/forwarding/Makefile | 1 +
.../net
Matthieu Baerts writes:
> Hi Petr,
>
> Thank you for the review!
>
> On 05/06/2024 12:38, Petr Machata wrote:
>>
>> "Matthieu Baerts (NGI0)" writes:
>>
>>> If there is an error to create the first netns with 'setup_ns()',
>>>
"Matthieu Baerts (NGI0)" writes:
> If there is an error to create the first netns with 'setup_ns()',
> 'cleanup_ns()' will be called with an empty string as first parameter.
>
> The consequences is that 'cleanup_ns()' will try to delete an invalid
> netns, and wait 20 seconds if the netns list
-by: Petr Machata
Reviewed-by: Ido Schimmel
---
Cc: Shuah Khan
Cc: linux-kselftest@vger.kernel.org
.../testing/selftests/net/forwarding/Makefile | 1 +
.../net/forwarding/router_mpath_seed.sh | 322 ++
2 files changed, 323 insertions(+)
create mode 100755 tools/testing
AIL.
>>
>> Signed-off-by: Jakub Kicinski
I'm still confused that the failure was shown for $rcv_if_name==bridge,
yet we are testing $h1==veth. But mechanically the code is correct.
Reviewed-by: Petr Machata
Jakub Kicinski writes:
> On Wed, 15 May 2024 11:02:28 +0200 Petr Machata wrote:
>> >> And then either replace the existing xfail_on_veth's (there are just a
>> >> handful) or convert xfail_on_veth to a wrapper around xfail_on_kind.
>> >
>> > I thi
Jakub Kicinski writes:
> On Mon, 13 May 2024 15:25:38 +0200 Petr Machata wrote:
>> For veth specifically there is xfail_on_veth:
>>
>> xfail_on_veth $rcv_if_name \
>> check_rcv $rcv_if_name "Unicast IPv4 to unknown MAC address" \
>>
Jakub Kicinski writes:
> @@ -157,7 +168,7 @@ run_test()
>
> check_rcv $rcv_if_name "Unicast IPv4 to unknown MAC address" \
> "$smac > $UNKNOWN_UC_ADDR1, ethertype IPv4 (0x0800)" \
> - false
> + false true
>
> check_rcv $rcv_if_name "Unicast
Willem de Bruijn 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
This test lacks a topology diagram, making the setup not obvious.
Add one.
Signed-off-by: Petr Machata
---
.../testing/selftests/net/forwarding/router_nh.sh | 14 ++
1 file changed, 14 insertions(+)
diff --git a/tools/testing/selftests/net/forwarding/router_nh.sh
b/tools/testing
This test lacks a topology diagram, making the setup not obvious.
Add one.
Signed-off-by: Petr Machata
---
.../net/forwarding/router_mpath_nh_res.sh | 35 +++
1 file changed, 35 insertions(+)
diff --git a/tools/testing/selftests/net/forwarding/router_mpath_nh_res.sh
b
This test lacks a topology diagram, making the setup not obvious.
Add one.
Cc: David Ahern
Signed-off-by: Petr Machata
---
.../net/forwarding/router_mpath_nh.sh | 35 +++
1 file changed, 35 insertions(+)
diff --git a/tools/testing/selftests/net/forwarding
assumed to be, resulting in ethtool_lanes.sh
test failure.
To avoid that, ensure that the lanes parameter is indeed dumped by waiting
for it explicitly, before preforming the test cases.
Signed-off-by: Danielle Ratson
Reviewed-by: Petr Machata
Signed-off-by: Petr Machata
---
.../selftests/drivers
iteration. Nevertheless it's not correct. Include tc_common.sh as
appropriate.
Signed-off-by: Petr Machata
---
tools/testing/selftests/drivers/net/hw/hw_stats_l3.sh | 1 +
tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh | 1 +
2 files changed, 2 insertions(+)
diff --git a/tools
rewording the messages so that they are not excessively
long.
Some check_err messages do not indicate what the issue actually is, so
reword them to say it's a "ping with", like is the case in some other
instances in this test.
Signed-off-by: Petr Machata
---
tools/testing/selftests/driv
.
Instead, cap the value at 0. mausezahn will use an appropriate minimum
packet length.
Cc: Vladimir Oltean
Cc: Tobias Waldekranz
Signed-off-by: Petr Machata
---
tools/testing/selftests/drivers/net/hw/ethtool_rmon.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests
$ksft_skip is used to mark selftests that have tooling issues. The fact
that LLDPad is running, but shouldn't, is one such issue. Therefore have
bail_on_lldpad() bail with $ksft_skip.
Signed-off-by: Petr Machata
Reviewed-by: Benjamin Poirier
---
tools/testing/selftests/net/forwarding/lib.sh
The variable should contain at least NUM_NETIFS interfaces, stored
as keys named "p$i", for i in `seq $NUM_NETIFS`.
Signed-off-by: Petr Machata
Reviewed-by: Benjamin Poirier
---
tools/testing/selftests/net/forwarding/lib.sh | 22 ++-
1 file changed, 17 insert
. Instead make the unit part
of the name of the argument to further clarify what units are expected.
Cc: Hangbin Liu
Signed-off-by: Petr Machata
Reviewed-by: Benjamin Poirier
---
tools/testing/selftests/net/forwarding/lib.sh | 22 ++-
tools/testing/selftests/net/lib.sh
in selftests.
- Patches #8 to #10 add topology diagrams to several selftests.
This should have been part of the mlxsw leg of NH group stats patches,
but again, it did not fit in due to size.
Danielle Ratson (1):
selftests: mlxsw: ethtool_lanes: Wait for lanes parameter dump
explicitly
Petr Machata
:0
>
> Signed-off-by: Jakub Kicinski
LGTM
Reviewed-by: Petr Machata
Jakub Kicinski writes:
> Add a Python test for the basic ops.
>
> # ./net/nl_netdev.py
> KTAP version 1
> 1..3
> ok 1 nl_netdev.empty_check
> ok 2 nl_netdev.lo_check
> ok 3 nl_netdev.page_pool_check
> # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
>
> Signed-off-by: Jakub
Jakub Kicinski writes:
> Using "with" on an entire driver test env is supported already,
> but it's also useful to use "with" on an individual nsim.
>
> Signed-off-by: Jakub Kicinski
Reviewed-by: Petr Machata
Jakub Kicinski writes:
> Instead of a summary line print the full exception.
> This makes debugging Python tests much easier.
>
> Signed-off-by: Jakub Kicinski
Reviewed-by: Petr Machata
> @@ -85,7 +86,8 @@ KSFT_RESULT = None
> totals['xfail'] += 1
>
tdev.py line 38:
> # Check failed 0 != 10
> not ok 3 nl_netdev.page_pool_check
>
> Signed-off-by: Jakub Kicinski
Reviewed-by: Petr Machata
> +def _fail(*args):
> +global KSFT_RESULT
> +KSFT_RESULT = False
> +
> +frame = inspect.stack()[2]
> +ks
he test against netdevsim.
>
> Signed-off-by: Jakub Kicinski
Reviewed-by: Petr Machata
However:
> diff --git a/tools/testing/selftests/net/lib/py/nsim.py
> b/tools/testing/selftests/net/lib/py/nsim.py
> new file mode 100644
> index ..25ae0d081788
> --- /dev/
; Note that the tests which used pause always initialize the setting
> so they shouldn't be affected by the different starting value.
>
> Signed-off-by: Jakub Kicinski
Reviewed-by: Petr Machata
Just:
> @@ -330,6 +331,49 @@ static const struct net_device_ops nsim_vf_netdev_
f.
>
> Signed-off-by: Jakub Kicinski
Reviewed-by: Petr Machata
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
Jakub Kicinski writes:
> Typing e.nl_msg.error when processing exception is a bit tedious
> and counter-intuitive. Set a local .error member to the positive
> value of the netlink level error.
>
> Signed-off-by: Jakub Kicinski
Reviewed-by: Petr Machata
}})
>
> Note that not all commands accept all the flags,
> but the meaning of the bits does not change command
> to command.
>
> Signed-off-by: Jakub Kicinski
Reviewed-by: Petr Machata
Jakub Kicinski writes:
> On Wed, 3 Apr 2024 10:58:19 +0200 Petr Machata wrote:
>> Also, it's not clear what "del thing" should do in that context, because
>> if cfg also keeps a reference, __del__ won't get called. There could be
>> a direct method, like thing.e
Jakub Kicinski writes:
> On Wed, 3 Apr 2024 00:04:14 +0200 Petr Machata wrote:
>> > Yes, I was wondering about that. It must be doable, IIRC
>> > the multi-threading API "injects" args from a tuple.
>> > I was thinking something along the lines o
Jakub Kicinski writes:
> On Tue, 2 Apr 2024 18:37:44 +0200 Petr Machata wrote:
>> Yeah, this would be usually done through context managers, as I mention
>> in the other e-mail. But then cfg would be lexically scoped, which IMHO
>> is a good thing, but then it need
Jakub Kicinski writes:
> On Tue, 2 Apr 2024 10:31:11 -0700 Jakub Kicinski wrote:
>> Yes, I was wondering about that. It must be doable, IIRC
>> the multi-threading API "injects" args from a tuple.
>> I was thinking something along the lines of:
>>
>> with NetDrvEnv(__file__) as cfg:
>>
Jakub Kicinski 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
Jakub Kicinski writes:
> Add a very simple test to make sure drivers report expected
> stats. Drivers which implement FEC or pause configuration
> should report relevant stats. Qstats must be reported,
> at least packet and byte counts, and they must match
> total device stats.
>
> Tested with
Jakub Kicinski writes:
> On Tue, 26 Mar 2024 11:31:31 +0100 Petr Machata wrote:
>> Jakub Kicinski writes:
>>
>> > a standard feature of kselftest. If "env" file exists in the test
>> > directory kselftest would load its contents before running eve
that invalidates result of the selftest. Since the metatest
only uses the bare basics (just pass/fail), hopefully such fundamental
breakages would be noticed.
Signed-off-by: Petr Machata
---
.../testing/selftests/net/forwarding/Makefile | 1 +
.../selftests/net/forwarding/lib_sh_test.sh | 208
-veth topology, they don't do anything.
Use the helper in the HW-stats part of router_mpath_nh_lib selftest.
Signed-off-by: Petr Machata
---
tools/testing/selftests/net/forwarding/lib.sh | 14 ++
.../net/forwarding/router_mpath_nh_lib.sh | 12 +---
2 files
() and log_test_xfail() can be reexpressed as thin
wrappers around log_test.
Signed-off-by: Petr Machata
---
tools/testing/selftests/net/forwarding/lib.sh | 92 ++-
tools/testing/selftests/net/lib.sh| 9 ++
2 files changed, 77 insertions(+), 24 deletions(-)
diff --git a/tools
When run on a slow machine, the scheduler traffic tests can be expected to
fail, and should be reported as XFAIL in that case. Therefore run these
tests through the perf_sensitive wrapper.
Signed-off-by: Petr Machata
---
.../selftests/net/forwarding/sch_ets_tests.sh | 19
:
xfail_on_slow tests_run
... or, on the other side of the granularity spectrum, to override
individual checks:
xfail_on_slow check_err $? "Expected much, got little."
Signed-off-by: Petr Machata
---
tools/testing/selftests/net/forwarding/lib.sh | 23 ++-
1 fi
cases where devlink_lib is, the inclusion is not
visible in the file itself, and relying on it would be confusing.
Cc: Davide Caratti
Signed-off-by: Petr Machata
---
tools/testing/selftests/net/forwarding/tc_tunnel_key.sh | 2 --
tools/testing/selftests/net/lib.sh | 6 +-
2
different, and we want to reuse the same logic.
Use the new helper when setting RET in check_err().
Re-express check_fail() in terms of check_err() to avoid duplication.
Signed-off-by: Petr Machata
---
Notes:
v1:
- Clarify intended usage by s/set_ret/ret_set_ksft_status/,
s/nret
. Note that it will be fixed using a
more reusable way in a following patch.
For the two resource_scale selftests, the log should simply not be written,
because there is no problem.
Cc: Tobias Waldekranz
Signed-off-by: Petr Machata
---
tools/testing/selftests/drivers/net/hw/ethtool_rmon.sh
Since the selftests that are not supposed to run on veth pairs are now in
their own dedicated directory, the skip_on_veth logic can go away. Drop it
from the selftests, and from lib.sh.
Cc: Danielle Ratson
Signed-off-by: Petr Machata
---
.../testing/selftests/drivers/net/hw/ethtool.sh | 2
Waldekranz
Cc: Danielle Ratson
Cc: Davide Caratti
Cc: Johannes Nixdorf
Suggested-by: Jakub Kicinski
Signed-off-by: Petr Machata
---
.../testing/selftests/drivers/net/hw/Makefile | 25 +++
.../net/hw}/devlink_port_split.py | 0
.../forwarding => drivers/net
This library is always sourced in the context where lib.sh has already been
sourced as well. Therefore drop the explicit sourcing and expect the client
to already have done it. This will simplify moving some of the clients to a
different directory.
Signed-off-by: Petr Machata
---
tools/testing
That any sort of customization is possible at all, let alone how it should
be done, is currently not at all clear. Document the whats and hows in
README.
Signed-off-by: Petr Machata
Reviewed-by: Benjamin Poirier
---
tools/testing/selftests/net/forwarding/README | 33 +++
1 file
-by: Petr Machata
Reviewed-by: Benjamin Poirier
---
.../net/forwarding/forwarding.config.sample | 53 --
tools/testing/selftests/net/forwarding/lib.sh | 69 ---
2 files changed, 74 insertions(+), 48 deletions(-)
diff --git a/tools/testing/selftests/net/forwarding
once
more is meaningless.
So avoid the outer X=... bit, and instead express the same idea though the
do-nothing ":" built-in as : "${X:=Y}". This also cleans up the block
nicely and makes it more readable.
Signed-off-by: Petr Machata
Reviewed-by: Benjamin Poirier
---
tools/te
selftest that checks this
functionality in lib.sh.
v1 (vs. an RFC circulated through linux-kselftest):
- Patch #9:
- Clarify intended usage by s/set_ret/ret_set_ksft_status/,
s/nret/ksft_status/
Petr Machata (14):
selftests: net: libs: Change variable fallback syntax
selftests: forw
Jakub Kicinski writes:
> On Mon, 25 Mar 2024 18:29:10 +0100 Petr Machata wrote:
>> +The forwarding selftests framework uses a number of variables that
>> +influence its behavior and tools it invokes, and how it invokes them, in
>> +various ways. A number of these variab
Jakub Kicinski writes:
> On Mon, 25 Mar 2024 18:29:16 +0100 Petr Machata wrote:
>> +set_ret()
>> +{
>> +local nret=$1; shift
>
> May be worth throwing in a comment that $1 must be a legal ksft ret
> code, not any exit code from random com
Jakub Kicinski writes:
> On Mon, 25 Mar 2024 18:29:07 +0100 Petr Machata wrote:
>> As discussed on the bi-weekly call on Jan 30, and in mailing around
>> kernel CI effort, some changes are desirable in the suite of forwarding
>> selftests the better to work with the CI to
() and log_test_xfail() can be reexpressed as thin
wrappers around log_test.
Signed-off-by: Petr Machata
---
tools/testing/selftests/net/forwarding/lib.sh | 92 ++-
tools/testing/selftests/net/lib.sh| 9 ++
2 files changed, 77 insertions(+), 24 deletions(-)
diff --git a/tools
that invalidates result of the selftest. Since the metatest
only uses the bare basics (just pass/fail), hopefully such fundamental
breakages would be noticed.
Signed-off-by: Petr Machata
---
.../testing/selftests/net/forwarding/Makefile | 1 +
.../selftests/net/forwarding/lib_sh_test.sh | 208
:
xfail_on_slow tests_run
... or, on the other side of the granularity spectrum, to override
individual checks:
xfail_on_slow check_err $? "Expected much, got little."
Signed-off-by: Petr Machata
---
tools/testing/selftests/net/forwarding/lib.sh | 23 ++-
1 fi
-veth topology, they don't do anything.
Use the helper in the HW-stats part of router_mpath_nh_lib selftest.
Signed-off-by: Petr Machata
---
tools/testing/selftests/net/forwarding/lib.sh | 14 ++
.../net/forwarding/router_mpath_nh_lib.sh | 12 +---
2 files
When run on a slow machine, the scheduler traffic tests can be expected to
fail, and should be reported as XFAIL in that case. Therefore run these
tests through the perf_sensitive wrapper.
Signed-off-by: Petr Machata
---
.../selftests/net/forwarding/sch_ets_tests.sh | 19
Waldekranz
Cc: Danielle Ratson
Cc: Davide Caratti
Cc: Johannes Nixdorf
Suggested-by: Jakub Kicinski
Signed-off-by: Petr Machata
---
.../testing/selftests/drivers/net/hw/Makefile | 25 +++
.../net/hw}/devlink_port_split.py | 0
.../forwarding => drivers/net
Since the selftests that are not supposed to run on veth pairs are now in
their own dedicated directory, the skip_on_veth logic can go away. Drop it
from the selftests, and from lib.sh.
Cc: Danielle Ratson
Signed-off-by: Petr Machata
---
.../testing/selftests/drivers/net/hw/ethtool.sh | 2
. Note that it will be fixed using a
more reusable way in a following patch.
For the two resource_scale selftests, the log should simply not be written,
because there is no problem.
Cc: Tobias Waldekranz
Signed-off-by: Petr Machata
---
tools/testing/selftests/drivers/net/hw/ethtool_rmon.sh
different, and we want to reuse the same logic.
Use the new helper when setting RET in check_err().
Re-express check_fail() in terms of check_err() to avoid duplication.
Signed-off-by: Petr Machata
---
tools/testing/selftests/net/forwarding/lib.sh | 21 -
tools/testing/selftests/net/lib.sh
cases where devlink_lib is, the inclusion is not
visible in the file itself, and relying on it would be confusing.
Cc: Davide Caratti
Signed-off-by: Petr Machata
---
tools/testing/selftests/net/forwarding/tc_tunnel_key.sh | 2 --
tools/testing/selftests/net/lib.sh | 6 +-
2
This library is always sourced in the context where lib.sh has already been
sourced as well. Therefore drop the explicit sourcing and expect the client
to already have done it. This will simplify moving some of the clients to a
different directory.
Signed-off-by: Petr Machata
---
tools/testing
That any sort of customization is possible at all, let alone how it should
be done, is currently not at all clear. Document the whats and hows in
README.
Signed-off-by: Petr Machata
Reviewed-by: Benjamin Poirier
---
tools/testing/selftests/net/forwarding/README | 33 +++
1 file
selftest that checks this
functionality in lib.sh.
Petr Machata (14):
selftests: net: libs: Change variable fallback syntax
selftests: forwarding.config.sample: Move overrides to lib.sh
selftests: forwarding: README: Document customization
selftests: forwarding: ipip_lib: Do not impor
once
more is meaningless.
So avoid the outer X=... bit, and instead express the same idea though the
do-nothing ":" built-in as : "${X:=Y}". This also cleans up the block
nicely and makes it more readable.
Signed-off-by: Petr Machata
Reviewed-by: Benjamin Poirier
---
tools/te
-by: Petr Machata
Reviewed-by: Benjamin Poirier
---
.../net/forwarding/forwarding.config.sample | 53 --
tools/testing/selftests/net/forwarding/lib.sh | 69 ---
2 files changed, 74 insertions(+), 48 deletions(-)
diff --git a/tools/testing/selftests/net/forwarding
Jakub Kicinski writes:
> On Tue, 23 Jan 2024 18:04:19 +0100 Petr Machata wrote:
>> > Unless I'm doing it wrong and the sub-directories are supposed to
>> > inherit the parent directory's config? So net/forwarding/ should
>> > be built with net/'s config? I c
Jakub Kicinski writes:
> On Tue, 23 Jan 2024 10:55:09 +0100 Petr Machata wrote:
>> > If you authored any net or drivers/net selftests, please look around
>> > and see if they are passing. If not - send patches or LMK what I need
>> > to do to make them pass on th
a PFC test")
Signed-off-by: Amit Cohen
Reviewed-by: Ido Schimmel
Signed-off-by: Petr Machata
---
.../selftests/drivers/net/mlxsw/qos_pfc.sh | 18 +-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_pfc.sh
b/too
f-by: Amit Cohen
Reviewed-by: Ido Schimmel
Signed-off-by: Petr Machata
---
tools/testing/selftests/drivers/net/mlxsw/qos_pfc.sh | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_pfc.sh
b/tools/testing/selftests/drivers/net/mlxsw/qos_pfc.sh
index 42
Paolo Abeni writes:
> On Wed, 2023-12-06 at 13:32 +0100, Petr Machata wrote:
>> Paolo Abeni writes:
>>
>> > Side note for a possible follow-up: if you maintain $ns_list as global
>> > variable, and remove from such list the ns deleted by cleanup_ns, you
&
Paolo Abeni writes:
> Side note for a possible follow-up: if you maintain $ns_list as global
> variable, and remove from such list the ns deleted by cleanup_ns, you
> could remove the cleanup trap from the individual test with something
> alike:
>
> final_cleanup_ns()
> {
> cleanup_ns
ique namespaces with given
> prefix name.
>
> Signed-off-by: Hangbin Liu
LGTM. I took it for a spin with a couple tests that we use for mlxsw,
mainly to make sure the "source ../lib.sh" bit works when invoking tests
from other directories. All seems fine.
Reviewed-by: Petr Machata
Hangbin Liu writes:
> On Fri, Nov 24, 2023 at 03:35:51PM +0100, Petr Machata wrote:
>>
>> Hangbin Liu writes:
>>
>> > + fi
>> > + done
>> > +
>> > + [ $errexit -eq 1 ] && set -e
>> > + return 0
>> &g
Hangbin Liu writes:
> On Fri, Nov 24, 2023 at 03:05:18PM +0100, Petr Machata wrote:
>>
>> Hangbin Liu writes:
>>
>> > +# Helpers
>> > +busywait()
>> > +{
>> > + local timeout=$1; shift
>> > +
>> > + local start_t
Petr Machata writes:
> Hangbin Liu writes:
>
>> +# By default, remove all netns before EXIT.
>> +cleanup_all_ns()
>> +{
>> +cleanup_ns $NS_LIST
>> +}
>> +trap cleanup_all_ns EXIT
>
> Hmm, OK, this is a showstopper for inclusion from
Hangbin Liu writes:
> +cleanup_ns()
> +{
> + local ns=""
> + local errexit=0
> +
> + # disable errexit temporary
> + if [[ $- =~ "e" ]]; then
> + errexit=1
> + set +e
> + fi
> +
> + for ns in "$@"; do
> + ip netns delete "${ns}" &>
Hangbin Liu writes:
> Add a lib.sh for net selftests. This file can be used to define commonly
> used variables and functions.
>
> Add function setup_ns() for user to create unique namespaces with given
> prefix name.
>
> Signed-off-by: Hangbin Liu
> ---
>
84 matches
Mail list logo