[LTP] [RFC PATCH v3 1/5] tst_net.sh: Support both old and new shell APIs + rename it

Alexey Kodanev alexey.kodanev@oracle.com
Wed Apr 4 15:37:17 CEST 2018


On 03.04.2018 18:47, Petr Vorel wrote:
> The new name states that library supports new API.
> 
> This is temporary solution, after migrating all tests to new SHELL API
> the compatibility layer and old SHELL API support should be removed.
...
> -[ -z "$TST_LIB_LOADED" ] && . test.sh
> +TST_OPTS=":6"
> +TST_PARSE_ARGS=parse_args
> +TST_USAGE=usage
> +
> +# Blank for an IPV4 test; 6 for an IPV6 test.
> +TST_IPV6=
> +
> +parse_args()
> +{
> +	case $1 in
> +	6) TST_IPV6=6;;
> +	esac
> +}
> +
> +tst_read_opts()
> +{
> +	local OPTIND
> +	while getopts "$TST_OPTS" opt; do
> +		$TST_PARSE_ARGS "$opt"
> +	done
> +}
> +
> +usage()
> +{
> +	cat << EOF
> +usage: $0 [-6]
> +
> +OPTIONS
> +-6     Use IPv6
> +EOF
> +}

Could we rename it to tst_net_usage() or similar (for parse_arg()
as well) since it is a library, and use the indent with echo, that
way it would be more readable.

Otherwise the patch looks good!


More information about the ltp mailing list