netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 00/14] selftests: mptcp: skip tests not supported by old kernels (part 2)
@ 2023-06-08 16:38 Matthieu Baerts
  2023-06-08 16:38 ` [PATCH net 01/14] selftests: mptcp: lib: skip if missing symbol Matthieu Baerts
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Matthieu Baerts @ 2023-06-08 16:38 UTC (permalink / raw)
  To: mptcp, Mat Martineau, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Shuah Khan, Davide Caratti,
	Dmytro Shytyi, Menglong Dong, Geliang Tang, Kishen Maloor
  Cc: Florian Westphal, netdev, linux-kselftest, linux-kernel,
	Matthieu Baerts, stable

After a few years of increasing test coverage in the MPTCP selftests, we
realised [1] the last version of the selftests is supposed to run on old
kernels without issues.

Supporting older versions is not that easy for this MPTCP case: these
selftests are often validating the internals by checking packets that
are exchanged, when some MIB counters are incremented after some
actions, how connections are getting opened and closed in some cases,
etc. In other words, it is not limited to the socket interface between
the userspace and the kernelspace.

In addition to that, the current MPTCP selftests run a lot of different
sub-tests but the TAP13 protocol used in the selftests don't support
sub-tests: one failure in sub-tests implies that the whole selftest is
seen as failed at the end because sub-tests are not tracked. It is then
important to skip sub-tests not supported by old kernels.

To minimise the modifications and reduce the complexity to support old
versions, the idea is to look at external signs and skip the whole
selftests or just some sub-tests before starting them. This cannot be
applied in all cases.

This second part focuses on marking different sub-tests as skipped if
some MPTCP features are not supported. A few techniques are used here:

- Before starting some tests:

  - Check if a file (sysctl knob) is present: that's what patch 13/14 is
    doing for the userspace PM feature.

  - Check if a symbol is present in /proc/kallsyms: patch 1/14 adds some
    helpers in mptcp_lib.sh to ease its use. Then these helpers are used
    in patches 2, 3, 4, 10, 11 and 14/14.

  - Set a flag and get the status to check if a feature is supported:
    patch 8/14 is doing that with the 'fullmesh' flag.

- After having launched the tests:

  - Retrieve the counters after a test and check if they are different
    than 0. Similar to the check with the flag, that's not ideal but in
    this case, the counters were already present before the introduction
    of MPTCP but they have been supported by MPTCP sockets only later.
    Patches 5 and 6/14 are using this technique.

Before skipping tests, SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES env var
value is checked: if it is set to 1, the test is marked as "failed"
instead of "skipped". MPTCP public CI expects to have all features
supported and it sets this env var to 1 to catch regressions in these
new checks.

Patches 7/14 and 9/14 are a bit different because they don't skip tests:

- Patch 7/14 retrieves the default values instead of using hardcoded
  ones because these default values have been modified at some points.
  Then the comparisons are done with the default values.

- patch 9/14 relaxes the expected returned size from MPTCP's getsockopt
  because the different structures gathering various info can get new
  fields and get bigger over time. We cannot expect that the userspace
  is using the same structure as the kernel.

Patch 12/14 marks the test as "skipped" instead of "failed" if the "ip"
tool is not available.

In this second part, the "mptcp_join" selftest is not modified yet. This
will come soon after in the third part with quite a few patches.

Link: https://lore.kernel.org/stable/CA+G9fYtDGpgT4dckXD-y-N92nqUxuvue_7AtDdBcHrbOMsDZLg@mail.gmail.com/ [1]
Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
Matthieu Baerts (14):
      selftests: mptcp: lib: skip if missing symbol
      selftests: mptcp: connect: skip transp tests if not supported
      selftests: mptcp: connect: skip disconnect tests if not supported
      selftests: mptcp: connect: skip TFO tests if not supported
      selftests: mptcp: diag: skip listen tests if not supported
      selftests: mptcp: diag: skip inuse tests if not supported
      selftests: mptcp: pm nl: remove hardcoded default limits
      selftests: mptcp: pm nl: skip fullmesh flag checks if not supported
      selftests: mptcp: sockopt: relax expected returned size
      selftests: mptcp: sockopt: skip getsockopt checks if not supported
      selftests: mptcp: sockopt: skip TCP_INQ checks if not supported
      selftests: mptcp: userspace pm: skip if 'ip' tool is unavailable
      selftests: mptcp: userspace pm: skip if not supported
      selftests: mptcp: userspace pm: skip PM listener events tests if unavailable

 tools/testing/selftests/net/mptcp/config           |  1 +
 tools/testing/selftests/net/mptcp/diag.sh          | 42 +++++++++-------------
 tools/testing/selftests/net/mptcp/mptcp_connect.sh | 20 +++++++++++
 tools/testing/selftests/net/mptcp/mptcp_lib.sh     | 38 ++++++++++++++++++++
 tools/testing/selftests/net/mptcp/mptcp_sockopt.c  | 18 ++++++----
 tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 20 +++++++++--
 tools/testing/selftests/net/mptcp/pm_netlink.sh    | 27 ++++++++------
 tools/testing/selftests/net/mptcp/userspace_pm.sh  | 13 ++++++-
 8 files changed, 135 insertions(+), 44 deletions(-)
---
base-commit: 6c0ec7ab5aaff3706657dd4946798aed483b9471
change-id: 20230608-upstream-net-20230608-mptcp-selftests-support-old-kernels-part-2-6e337e1f047d

Best regards,
-- 
Matthieu Baerts <matthieu.baerts@tessares.net>


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-06-10  7:12 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08 16:38 [PATCH net 00/14] selftests: mptcp: skip tests not supported by old kernels (part 2) Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 01/14] selftests: mptcp: lib: skip if missing symbol Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 02/14] selftests: mptcp: connect: skip transp tests if not supported Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 03/14] selftests: mptcp: connect: skip disconnect " Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 04/14] selftests: mptcp: connect: skip TFO " Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 05/14] selftests: mptcp: diag: skip listen " Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 06/14] selftests: mptcp: diag: skip inuse " Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 07/14] selftests: mptcp: pm nl: remove hardcoded default limits Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 08/14] selftests: mptcp: pm nl: skip fullmesh flag checks if not supported Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 09/14] selftests: mptcp: sockopt: relax expected returned size Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 10/14] selftests: mptcp: sockopt: skip getsockopt checks if not supported Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 11/14] selftests: mptcp: sockopt: skip TCP_INQ " Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 12/14] selftests: mptcp: userspace pm: skip if 'ip' tool is unavailable Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 13/14] selftests: mptcp: userspace pm: skip if not supported Matthieu Baerts
2023-06-08 16:38 ` [PATCH net 14/14] selftests: mptcp: userspace pm: skip PM listener events tests if unavailable Matthieu Baerts
2023-06-10  7:12 ` [PATCH net 00/14] selftests: mptcp: skip tests not supported by old kernels (part 2) patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).