[RFC PATCH net-next 0/5] selftests: forwarding: Introduce deferred commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


As a personal remark. More than once was I bit by stop_traffic not getting
invoked because I C-c'd a traffic scheduler selftest at the wrong time.
This would leave behind a running mausezahn that would break follow-up runs
of the script that I was just debugging, making me question my sanity.
("How did this one extra debug print break the full script? And when I
remove it again, _why is it still broken_?") This is an attempt at
squashing this whole class of problems.


Patch #1 has more details about the primitives being introduced.

Patches #2 to #5 the convert several selftests to give an idea of how it
looks in practice.

Petr Machata (5):
  selftests: forwarding: Introduce deferred commands
  selftests: mlxsw: sch_red_core: Use defer for test cleanup
  selftests: mlxsw: sch_red_core: Use defer for stopping traffic
  selftests: mlxsw: sch_red_*: Use defer for qdisc management
  selftests: sch_tbf_core: Use defer for stopping traffic

 .../drivers/net/mlxsw/sch_red_core.sh         | 131 +++++++-----------
 .../drivers/net/mlxsw/sch_red_ets.sh          |  32 ++---
 .../drivers/net/mlxsw/sch_red_root.sh         |  24 +++-
 tools/testing/selftests/net/forwarding/lib.sh |  83 +++++++++++
 .../selftests/net/forwarding/sch_tbf_core.sh  |   3 +-
 5 files changed, 170 insertions(+), 103 deletions(-)

-- 
2.45.0





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux