Message ID | 1525663451-32016-2-git-send-email-yangx.jy@cn.fujitsu.com |
---|---|
State | Accepted |
Delegated to: | Petr Vorel |
Headers | show |
Series | [1/3] lib/tst_net.sh: Append 6 to the end of $TST_OPTS | expand |
Hi, > 1) Process getopts parameters by TST_OPTS and TST_PARSE_ARGS > 2) Pass $OPTARG as $2 to TST_PARSE_ARGS functions > Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> > --- > testcases/network/tcp_fastopen/tcp_fastopen_run.sh | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > diff --git a/testcases/network/tcp_fastopen/tcp_fastopen_run.sh b/testcases/network/tcp_fastopen/tcp_fastopen_run.sh > index 5cc9804..865b3d4 100755 > --- a/testcases/network/tcp_fastopen/tcp_fastopen_run.sh > +++ b/testcases/network/tcp_fastopen/tcp_fastopen_run.sh > @@ -20,8 +20,9 @@ > TST_NETLOAD_MAX_SRV_REPLIES=3 > -while getopts :hr:n:R:6 opt; do > - case "$opt" in > +tcp_fastopen_parse_args() > +{ > + case "$1" in > h) > echo "Usage:" > echo "h help" > @@ -29,17 +30,18 @@ while getopts :hr:n:R:6 opt; do > echo "6 run over IPv6" > exit 0 > ;; > - R) TST_NETLOAD_MAX_SRV_REPLIES=$OPTARG ;; > - 6) TST_IPV6=6 ;; > - *) tst_brkm TBROK "unknown option: $opt" ;; > + R) TST_NETLOAD_MAX_SRV_REPLIES=$2 ;; > + *) tst_brkm TBROK "unknown option: $1" ;; > esac > -done > -shift $(($OPTIND - 1)) > +} > TST_TOTAL=1 > TCID="tcp_fastopen" > TST_NEEDS_TMPDIR=1 > +TST_OPTS=":hr:n:R:" > +TST_PARSE_ARGS=tcp_fastopen_parse_args > + > TST_USE_LEGACY_API=1 > . tst_net.sh Acked-by: Petr Vorel <pvorel@suse.cz> NOTE: I propose to merge this patch-set after release (as it's not a bugfix, we should respect git freeze). Kind regards, Petr
On 2018/05/07 14:44, Petr Vorel wrote: > Hi, > >> 1) Process getopts parameters by TST_OPTS and TST_PARSE_ARGS >> 2) Pass $OPTARG as $2 to TST_PARSE_ARGS functions >> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com> >> --- >> testcases/network/tcp_fastopen/tcp_fastopen_run.sh | 16 +++++++++------- >> 1 file changed, 9 insertions(+), 7 deletions(-) >> diff --git a/testcases/network/tcp_fastopen/tcp_fastopen_run.sh b/testcases/network/tcp_fastopen/tcp_fastopen_run.sh >> index 5cc9804..865b3d4 100755 >> --- a/testcases/network/tcp_fastopen/tcp_fastopen_run.sh >> +++ b/testcases/network/tcp_fastopen/tcp_fastopen_run.sh >> @@ -20,8 +20,9 @@ >> TST_NETLOAD_MAX_SRV_REPLIES=3 >> -while getopts :hr:n:R:6 opt; do >> - case "$opt" in >> +tcp_fastopen_parse_args() >> +{ >> + case "$1" in >> h) >> echo "Usage:" >> echo "h help" >> @@ -29,17 +30,18 @@ while getopts :hr:n:R:6 opt; do >> echo "6 run over IPv6" >> exit 0 >> ;; >> - R) TST_NETLOAD_MAX_SRV_REPLIES=$OPTARG ;; >> - 6) TST_IPV6=6 ;; >> - *) tst_brkm TBROK "unknown option: $opt" ;; >> + R) TST_NETLOAD_MAX_SRV_REPLIES=$2 ;; >> + *) tst_brkm TBROK "unknown option: $1" ;; >> esac >> -done >> -shift $(($OPTIND - 1)) >> +} >> TST_TOTAL=1 >> TCID="tcp_fastopen" >> TST_NEEDS_TMPDIR=1 >> +TST_OPTS=":hr:n:R:" >> +TST_PARSE_ARGS=tcp_fastopen_parse_args >> + >> TST_USE_LEGACY_API=1 >> . tst_net.sh > Acked-by: Petr Vorel<pvorel@suse.cz> > > NOTE: I propose to merge this patch-set after release (as it's not a bugfix, we should respect git freeze). Hi Petr, Agreed, we could megre it after release. :-) Thanks, Xiao Yang > > Kind regards, > Petr > > > . >
Hi Xiao, > 1) Process getopts parameters by TST_OPTS and TST_PARSE_ARGS > 2) Pass $OPTARG as $2 to TST_PARSE_ARGS functions > Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> > --- Pushed, with minor change removing ':' (will be added in tst_net.sh as Alexey suggested). Kind regards, Petr +++ testcases/network/tcp_fastopen/tcp_fastopen_run.sh @@ -39,7 +39,7 @@ TST_TOTAL=1 TCID="tcp_fastopen" TST_NEEDS_TMPDIR=1 -TST_OPTS=":hr:n:R:" +TST_OPTS="hr:n:R:" TST_PARSE_ARGS=tcp_fastopen_parse_args TST_USE_LEGACY_API=1
diff --git a/testcases/network/tcp_fastopen/tcp_fastopen_run.sh b/testcases/network/tcp_fastopen/tcp_fastopen_run.sh index 5cc9804..865b3d4 100755 --- a/testcases/network/tcp_fastopen/tcp_fastopen_run.sh +++ b/testcases/network/tcp_fastopen/tcp_fastopen_run.sh @@ -20,8 +20,9 @@ TST_NETLOAD_MAX_SRV_REPLIES=3 -while getopts :hr:n:R:6 opt; do - case "$opt" in +tcp_fastopen_parse_args() +{ + case "$1" in h) echo "Usage:" echo "h help" @@ -29,17 +30,18 @@ while getopts :hr:n:R:6 opt; do echo "6 run over IPv6" exit 0 ;; - R) TST_NETLOAD_MAX_SRV_REPLIES=$OPTARG ;; - 6) TST_IPV6=6 ;; - *) tst_brkm TBROK "unknown option: $opt" ;; + R) TST_NETLOAD_MAX_SRV_REPLIES=$2 ;; + *) tst_brkm TBROK "unknown option: $1" ;; esac -done -shift $(($OPTIND - 1)) +} TST_TOTAL=1 TCID="tcp_fastopen" TST_NEEDS_TMPDIR=1 +TST_OPTS=":hr:n:R:" +TST_PARSE_ARGS=tcp_fastopen_parse_args + TST_USE_LEGACY_API=1 . tst_net.sh
1) Process getopts parameters by TST_OPTS and TST_PARSE_ARGS 2) Pass $OPTARG as $2 to TST_PARSE_ARGS functions Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> --- testcases/network/tcp_fastopen/tcp_fastopen_run.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)