Skip to content

selftests: Mark auto-deferring functions clearly

Petr Machata linux-kselftest netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 13 repliesApplied 13/13

Patches in v1 All 13 applied

#Subject and filesSizeRepliesApplied
1/13selftests: net: lib: Rename ip_link_add() to adf_*tools/testing/selftests/net/fdb_notify.sh tools/testing/selftests/net/forwarding/bridge_activity_notify.sh tools/testing/selftests/net/forwarding/bridge_fdb_local_vlan_0.sh +5 more+38 -381 replyApplied
2/13selftests: net: lib: Rename ip_link_set_master() to adf_*tools/testing/selftests/net/fdb_notify.sh tools/testing/selftests/net/forwarding/bridge_activity_notify.sh tools/testing/selftests/net/forwarding/bridge_fdb_local_vlan_0.sh +4 more+19 -191 replyApplied
3/13selftests: net: lib: Rename ip_link_set_addr() to adf_*tools/testing/selftests/net/forwarding/bridge_fdb_local_vlan_0.sh tools/testing/selftests/net/forwarding/vxlan_bridge_1q_mc_ul.sh tools/testing/selftests/net/forwarding/vxlan_reserved.sh +1 more+6 -61 replyApplied
4/13selftests: net: lib: Rename ip_link_set_up() to adf_*tools/testing/selftests/net/forwarding/bridge_activity_notify.sh tools/testing/selftests/net/forwarding/bridge_fdb_local_vlan_0.sh tools/testing/selftests/net/forwarding/vxlan_bridge_1q_mc_ul.sh +4 more+32 -321 replyApplied
5/13selftests: net: lib: Rename ip_link_set_down() to adf_*tools/testing/selftests/net/lib.sh tools/testing/selftests/net/vlan_bridge_binding.sh+2 -21 replyApplied
6/13selftests: net: lib: Rename ip_addr_add() to adf_*tools/testing/selftests/net/forwarding/bridge_fdb_local_vlan_0.sh tools/testing/selftests/net/forwarding/vxlan_bridge_1q_mc_ul.sh tools/testing/selftests/net/forwarding/vxlan_reserved.sh +1 more+22 -221 replyApplied
7/13selftests: net: lib: Rename ip_route_add() to adf_*tools/testing/selftests/net/forwarding/bridge_fdb_local_vlan_0.sh tools/testing/selftests/net/forwarding/vxlan_reserved.sh tools/testing/selftests/net/lib.sh+6 -61 replyApplied
8/13selftests: net: lib: Rename bridge_vlan_add() to adf_*tools/testing/selftests/net/forwarding/bridge_fdb_local_vlan_0.sh tools/testing/selftests/net/forwarding/vxlan_bridge_1q_mc_ul.sh tools/testing/selftests/net/lib.sh +1 more+23 -231 replyApplied
9/13selftests: net: vlan_bridge_binding: Rename dfr_set_binding_*() to adf_*tools/testing/selftests/net/vlan_bridge_binding.sh+4 -41 replyApplied
10/13selftests: forwarding: lib: Add an autodefer variant of vrf_prepare()tools/testing/selftests/drivers/net/mlxsw/devlink_trap_policer.sh tools/testing/selftests/drivers/net/mlxsw/qos_ets_strict.sh tools/testing/selftests/drivers/net/mlxsw/qos_max_descriptors.sh +10 more+18 -241 replyApplied
11/13selftests: forwarding: lib: Add an autodefer variant of simple_if_init()tools/testing/selftests/drivers/net/mlxsw/devlink_trap_policer.sh tools/testing/selftests/drivers/net/mlxsw/qos_ets_strict.sh tools/testing/selftests/drivers/net/mlxsw/qos_max_descriptors.sh +10 more+31 -521 replyApplied
12/13selftests: forwarding: lib: Add an autodefer variant of forwarding_enable()tools/testing/selftests/net/forwarding/bridge_fdb_local_vlan_0.sh tools/testing/selftests/net/forwarding/lib.sh tools/testing/selftests/net/forwarding/vxlan_bridge_1q_mc_ul.sh +1 more+9 -91 replyApplied
13/13selftests: forwarding: README: Mention defer, adf_tools/testing/selftests/net/forwarding/README+15 -01 replyApplied

Reviews trailers per patch

All 13 patches have a Reviewed-by or Acked-by.

PatchSimon Horman
1/13R-b
2/13R-b
3/13R-b
4/13R-b
5/13R-b
6/13R-b
7/13R-b
8/13R-b
9/13R-b
10/13R-b
11/13R-b
12/13R-b
13/13R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH net-next 00/13] selftests: Mark auto-deferring functions clearly

selftests/net/lib.sh contains a suite of iproute2 wrappers that automatically schedule the corresponding cleanup through defer. The fact they do so is however not immediately obvious, one needs to know which functions are handling the deferral behind the scenes, and which expect the caller to handle cleanups themselves.

A convention for these auto-deferring functions would help both writing and patch review. This patchset does so by marking these functions with an adf_ prefix. We already have a few such functions: forwarding/lib.sh has adf_mcd_start() and a few selftests add private helpers that conform to this convention.

Patches #1 to #8 gradually convert individual functions, one per patch.

Patch #9 renames an auto-deferring private helpers named dfr_* to adf_*. The plan is not to retro-rename all private helpers, but I happened to know about this one.

Patches #10 to #12 introduce several autodefer helpers for commonly used forwarding/lib.sh functions, and opportunistically convert straightforward instances of 'action; defer counteraction' to the new helpers.

Patch #13 adds some README verbiage to pitch defer and the adf_* convention.

Petr Machata (13):
selftests: net: lib: Rename ip_link_add() to adf_*
selftests: net: lib: Rename ip_link_set_master() to adf_*
selftests: net: lib: Rename ip_link_set_addr() to adf_*
selftests: net: lib: Rename ip_link_set_up() to adf_*
selftests: net: lib: Rename ip_link_set_down() to adf_*
selftests: net: lib: Rename ip_addr_add() to adf_*
selftests: net: lib: Rename ip_route_add() to adf_*
selftests: net: lib: Rename bridge_vlan_add() to adf_*
selftests: net: vlan_bridge_binding: Rename dfr_set_binding_*() to

    adf_*

selftests: forwarding: lib: Add an autodefer variant of vrf_prepare()
selftests: forwarding: lib: Add an autodefer variant of
simple_if_init()
selftests: forwarding: lib: Add an autodefer variant of
forwarding_enable()
selftests: forwarding: README: Mention defer, adf_

 .../drivers/net/mlxsw/devlink_trap_policer.sh |   9 +-
 .../drivers/net/mlxsw/qos_ets_strict.sh       |  12 +-
 .../drivers/net/mlxsw/qos_max_descriptors.sh  |   9 +-
 .../drivers/net/mlxsw/qos_mc_aware.sh         |  12 +-
 .../drivers/net/mlxsw/sch_red_core.sh         |   6 +-
 tools/testing/selftests/net/fdb_notify.sh     |  26 ++--
 tools/testing/selftests/net/forwarding/README |  15 ++
 .../net/forwarding/bridge_activity_notify.sh  |  21 ++-
 .../net/forwarding/bridge_fdb_local_vlan_0.sh |  65 ++++----
 tools/testing/selftests/net/forwarding/lib.sh |  18 +++
 .../selftests/net/forwarding/sch_ets_core.sh  |   9 +-
 .../selftests/net/forwarding/sch_red.sh       |  12 +-
 .../selftests/net/forwarding/sch_tbf_core.sh  |   6 +-
 .../net/forwarding/vxlan_bridge_1q_mc_ul.sh   | 141 +++++++++---------
 .../net/forwarding/vxlan_reserved.sh          |  33 ++--
 tools/testing/selftests/net/lib.sh            |  16 +-
 .../net/test_vxlan_fdb_changelink.sh          |   8 +-
 .../selftests/net/vlan_bridge_binding.sh      |  44 +++---
 18 files changed, 225 insertions(+), 237 deletions(-)
Signature · 1 line
2.49.0