[LTP] [PATCH 1/2] test_net.sh: add tst_set_sysctl()

Alexey Kodanev alexey.kodanev@oracle.com
Tue Jan 31 14:38:30 CET 2017


On 01/31/2017 03:41 PM, Cyril Hrubis wrote:
> Hi!
>>>> +# tst_set_sysctl NAME VALUE [safe]
>>>> +# It can handle netns case when sysctl not namespaceified.
>>>> +tst_set_sysctl()
>>>> +{
>>>> +	local name="$1"
>>>> +	local value="$2"
>>>> +	local safe=
>>>> +	[ "$3" = "safe" ] && safe="-s" || safe=""
>>> Uh, this syntax is confusing, besides isn't safe set to empty string
>>> anyway?
>> What if we set TST_NO_CLEANUP just before calling cleanup()
>> or unset TST_CLEANUP... then we can use ROD, etc. in cleanup?
> You lost me here. How is this connected to the code I've commented?

In the 2nd patch, 'safe' option is used like this:

do_cleanup()
{
    tst_set_sysctl net.ipv4.tcp_cong...
}

do_test()
{
    tst_set_sysctl net.ipv4.tcp_cong... safe
}

So, the main reason for splitting the code with 'safe' option is to be
able to call this function inside cleanup. But if we handle cleanup
recursion inside the shell library, we can get rid of 'safe' option
and simplify tst_set_sysctls().

Thanks,
Alexey


More information about the ltp mailing list