netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 00/10] selftests: net: Introduce deferred commands
@ 2024-10-09 12:06 Petr Machata
  2024-10-09 12:06 ` [PATCH net-next 01/10] selftests: net: lib: " Petr Machata
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Petr Machata @ 2024-10-09 12:06 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev
  Cc: linux-kselftest, Shuah Khan, Benjamin Poirier, Hangbin Liu,
	Vladimir Oltean, Ido Schimmel, Przemek Kitszel, Petr Machata,
	mlxsw

Recently, a defer helper was added to Python selftests. The idea is to keep
cleanup commands close to their dirtying counterparts, thereby making it
more transparent what is cleaning up what, making it harder to miss a
cleanup, and make the whole cleanup business exception safe. All these
benefits are applicable to bash as well, exception safety can be
interpreted in terms of safety vs. a SIGINT.

This patchset therefore introduces a framework of several helpers that
serve to schedule cleanups in bash selftests.

- Patch #1 has more details about the primitives being introduced.
  Patch #2 adds a fallback cleanup() function to lib.sh, because ideally
  selftests wouldn't need to introduce a dedicated cleanup function at all.

- Patch #3 adds a parameter to stop_traffic(), which makes it possible to
  start other background processes after the traffic is started without
  confusing the cleanup.

- Patches #4 to #10 convert a number of selftests.

  The goal was to convert all tests that use start_traffic / stop_traffic
  to the defer framework. Leftover traffic generators are a particularly
  painful sort of a missed cleanup. Normal unfinished cleanups can usually
  be cleaned up simply by rerunning the test and interrupting it early to
  let the cleanups run again / in full. This does not work with
  stop_traffic, because it is only issued at the end of the test case that
  starts the traffic. At the same time, leftover traffic generators
  influence follow-up test runs, and are hard to notice.

  The tests were however converted whole-sale, not just their traffic bits.
  Thus they form a proof of concept of the defer framework.

v1 (from the RFC):
- Patch #1:
    - Added the priority defer track
    - Dropped defer_scoped_fn, added in_defer_scope
    - Extracted to a separate independent module
- Patch #2:
    - Moved this bit to a separate patch
- Patch #3:
    - New patch
- Patch #4 (RED):
    - Squashed the individual RED-related patches into one
    - Converted the SW datapath RED selftest as well
- Patch #5 (TBF):
    - Fully converted the selftest, not just stop_traffic
- Patches #6, #7, #8, #9, #10:
    - New patch

Petr Machata (10):
  selftests: net: lib: Introduce deferred commands
  selftests: forwarding: Add a fallback cleanup()
  selftests: forwarding: lib: Allow passing PID to stop_traffic()
  selftests: RED: Use defer for test cleanup
  selftests: TBF: Use defer for test cleanup
  selftests: ETS: Use defer for test cleanup
  selftests: mlxsw: qos_mc_aware: Use defer for test cleanup
  selftests: mlxsw: qos_ets_strict: Use defer for test cleanup
  selftests: mlxsw: qos_max_descriptors: Use defer for test cleanup
  selftests: mlxsw: devlink_trap_police: Use defer for test cleanup

 .../drivers/net/mlxsw/devlink_trap_policer.sh |  85 ++++-----
 .../drivers/net/mlxsw/qos_ets_strict.sh       | 167 ++++++++---------
 .../drivers/net/mlxsw/qos_max_descriptors.sh  | 118 +++++-------
 .../drivers/net/mlxsw/qos_mc_aware.sh         | 146 +++++++--------
 .../selftests/drivers/net/mlxsw/sch_ets.sh    |  26 ++-
 .../drivers/net/mlxsw/sch_red_core.sh         | 171 +++++++++---------
 .../drivers/net/mlxsw/sch_red_ets.sh          |  24 +--
 .../drivers/net/mlxsw/sch_red_root.sh         |  18 +-
 tools/testing/selftests/net/forwarding/lib.sh |  13 +-
 .../selftests/net/forwarding/sch_ets.sh       |   7 +-
 .../selftests/net/forwarding/sch_ets_core.sh  |  81 +++------
 .../selftests/net/forwarding/sch_ets_tests.sh |  14 +-
 .../selftests/net/forwarding/sch_red.sh       | 103 ++++-------
 .../selftests/net/forwarding/sch_tbf_core.sh  |  91 +++-------
 .../net/forwarding/sch_tbf_etsprio.sh         |   7 +-
 .../selftests/net/forwarding/sch_tbf_root.sh  |   3 +-
 tools/testing/selftests/net/lib.sh            |   3 +
 tools/testing/selftests/net/lib/Makefile      |   2 +-
 tools/testing/selftests/net/lib/sh/defer.sh   | 115 ++++++++++++
 19 files changed, 587 insertions(+), 607 deletions(-)
 create mode 100644 tools/testing/selftests/net/lib/sh/defer.sh

-- 
2.45.0


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

end of thread, other threads:[~2024-10-15  9:28 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 12:06 [PATCH net-next 00/10] selftests: net: Introduce deferred commands Petr Machata
2024-10-09 12:06 ` [PATCH net-next 01/10] selftests: net: lib: " Petr Machata
2024-10-15  8:22   ` Paolo Abeni
2024-10-15  9:06     ` Petr Machata
2024-10-09 12:06 ` [PATCH net-next 02/10] selftests: forwarding: Add a fallback cleanup() Petr Machata
2024-10-09 12:06 ` [PATCH net-next 03/10] selftests: forwarding: lib: Allow passing PID to stop_traffic() Petr Machata
2024-10-09 12:06 ` [PATCH net-next 04/10] selftests: RED: Use defer for test cleanup Petr Machata
2024-10-15  8:14   ` Paolo Abeni
2024-10-15  9:03     ` Petr Machata
2024-10-09 12:06 ` [PATCH net-next 05/10] selftests: TBF: " Petr Machata
2024-10-09 12:06 ` [PATCH net-next 06/10] selftests: ETS: " Petr Machata
2024-10-09 12:06 ` [PATCH net-next 07/10] selftests: mlxsw: qos_mc_aware: " Petr Machata
2024-10-09 12:06 ` [PATCH net-next 08/10] selftests: mlxsw: qos_ets_strict: " Petr Machata
2024-10-09 12:06 ` [PATCH net-next 09/10] selftests: mlxsw: qos_max_descriptors: " Petr Machata
2024-10-09 12:06 ` [PATCH net-next 10/10] selftests: mlxsw: devlink_trap_police: " Petr Machata

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).