[LTP] [PATCH v3] sysctl/sysctl02: Add new regression test for overflow file-max

Yang Xu xuyang2018.jy@cn.fujitsu.com
Thu Jul 4 03:40:41 CEST 2019


> Hi Yang,
>
>> Hi Petr
>>   I use 2 strings because sysctl uses "fs.file-max" but cat uses "fs/file-max" file.
>>   Your big changes look good to me.  Thanks for your changes.
> I pushed tiny changes to sysctl02.sh as 8e2d73a88 ("sysctl/sysctl02: Improve log messages").
> See the diff below.
Hi Petr

     Your change makes this case more clear for user. It looks good to me.

Thanks
Yang Xu

> Kind regards,
> Petr
>
> diff --git a/testcases/commands/sysctl/sysctl02.sh b/testcases/commands/sysctl/sysctl02.sh
> index 8a434183e..3964a9829 100755
> --- a/testcases/commands/sysctl/sysctl02.sh
> +++ b/testcases/commands/sysctl/sysctl02.sh
> @@ -44,14 +44,17 @@ do_test()
>
>   sysctl_test_overflow()
>   {
> +	local test_value="$1"
>   	local old_value="$(cat $sys_file)"
> -	sysctl -w -q $sys_name=$1 2>/dev/null
> -	local test_value="$(cat $sys_file)"
>
> -	if echo $test_value | grep -q $old_value; then
> -		tst_res TPASS "$sys_file overflows, reject it and keep old value"
> +	tst_res TINFO "trying to set $sys_name=$test_value"
> +	sysctl -w -q $sys_name=$test_value 2>/dev/null
> +	local new_value="$(cat $sys_file)"
> +
> +	if [ "$new_value" = "$old_value" ]; then
> +		tst_res TPASS "$sys_file keeps old value ($old_value)"
>   	else
> -		tst_res TFAIL "$sys_file overflows and set to $test_value"
> +		tst_res TFAIL "$sys_file overflows and is set to $new_value"
>   	fi
>   	cleanup
>   }
>
>
> .
>





More information about the ltp mailing list