[PATCH net-next mlxsw 0/2] Add wrappers to automate sysctl bookkeeping

Petr Machata petrm at mellanox.com
Thu May 3 02:11:36 AEST 2018


Some selftests need to adjust sysctl settings. In order to be neutral to
the system that the test is run on, it is a good practice to change back
to the original setting after the test ends. That involves some
boilerplate that can be abstracted away.

In patch #1, introduce two functions, sysctl_set() and sysctl_restore().
The former stores the current value of a given setting, and sets a new
value. The latter restores the setting to the previously-stored value.

In patch #2, use these wrappers in a number of tests.

Petr Machata (2):
  selftests: forwarding: lib: Add sysctl_set(), sysctl_restore()
  selftests: forwarding: Use sysctl_set(), sysctl_restore()

 tools/testing/selftests/net/forwarding/lib.sh      | 28 ++++++++++++++++------
 .../selftests/net/forwarding/mirror_gre_changes.sh |  7 ++----
 .../selftests/net/forwarding/mirror_gre_nh.sh      | 10 ++++----
 .../selftests/net/forwarding/router_multipath.sh   | 12 ++++------
 4 files changed, 31 insertions(+), 26 deletions(-)

-- 
2.4.11



More information about the Linux-mlxsw mailing list