diff mbox series

lib/tst_net.sh: Detect quoted parameters correctly

Message ID 1525749141-29004-1-git-send-email-yangx.jy@cn.fujitsu.com
State Accepted
Delegated to: Petr Vorel
Headers show
Series lib/tst_net.sh: Detect quoted parameters correctly | expand

Commit Message

Xiao Yang May 8, 2018, 3:12 a.m. UTC
If we pass $* to tst_net_read_opts, we cannot detect quoted parameters
correctly, which process only first number from quoted parameters.
For example, running sctp_ipsec.sh -s "100 1000 65535":
------------------------------------------------------
...
sctp_ipsec 1 TINFO: run server 'netstress -T sctp -S 10.167.220.185 -R 500000 -B /tmp/sctp_ipsec.8MpnrPPXkq'
sctp_ipsec 1 TINFO: run client 'netstress -l -T sctp -H 10.167.220.185 -n 100 -N 100 -S 10.167.220.179 -a 2 -r 500 -d tst_netload.res -g 50802'
sctp_ipsec 1 TPASS: netstress passed, time spent '397' ms
------------------------------------------------------

We solve this issue by passing "$@" to tst_net_read_opts.
For example, running sctp_ipsec.sh -s "100 1000 65535":
------------------------------------------------------
...
sctp_ipsec 1 TINFO: run server 'netstress -T sctp -S 10.167.220.185 -R 500000 -B /tmp/sctp_ipsec.93mw7qy2BW'
sctp_ipsec 1 TINFO: run client 'netstress -l -T sctp -H 10.167.220.185 -n 100 -N 100 -S 10.167.220.179 -a 2 -r 500 -d tst_netload.res -g 36311'
sctp_ipsec 1 TPASS: netstress passed, time spent '254' ms
sctp_ipsec 2 TINFO: run server 'netstress -T sctp -S 10.167.220.185 -R 500000 -B /tmp/sctp_ipsec.93mw7qy2BW'
sctp_ipsec 2 TINFO: run client 'netstress -l -T sctp -H 10.167.220.185 -n 1000 -N 1000 -S 10.167.220.179 -a 2 -r 500 -d tst_netload.res -g 45078'
sctp_ipsec 2 TPASS: netstress passed, time spent '276' ms
sctp_ipsec 3 TINFO: run server 'netstress -T sctp -S 10.167.220.185 -R 500000 -B /tmp/sctp_ipsec.93mw7qy2BW'
sctp_ipsec 3 TINFO: run client 'netstress -l -T sctp -H 10.167.220.185 -n 65535 -N 65535 -S 10.167.220.179 -a 2 -r 500 -d tst_netload.res -g 36871'
sctp_ipsec 3 TPASS: netstress passed, time spent '1288' ms
------------------------------------------------------

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 testcases/lib/tst_net.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Petr Vorel May 8, 2018, 8:05 a.m. UTC | #1
Hi,

> If we pass $* to tst_net_read_opts, we cannot detect quoted parameters
> correctly, which process only first number from quoted parameters.
> For example, running sctp_ipsec.sh -s "100 1000 65535":
...
>  if [ -n "$TST_USE_LEGACY_API" ]; then
> -	tst_net_read_opts $*
> +	tst_net_read_opts "$@"
>  	ipver=${TST_IPV6:-4}
>  fi

Acked-by: Petr Vorel <pvorel@suse.cz>

Expect to merge it on Wednesday (if nobody objects), instead of my fix with a note of
missing quotes as a root cause [1].


Kind regards,
Petr

[1] https://lists.linux.it/pipermail/ltp/2018-May/008042.html
Petr Vorel May 9, 2018, 3:27 p.m. UTC | #2
Hi,

> If we pass $* to tst_net_read_opts, we cannot detect quoted parameters
> correctly, which process only first number from quoted parameters.
> For example, running sctp_ipsec.sh -s "100 1000 65535":
...
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  testcases/lib/tst_net.sh | 2 +-
...
>  if [ -n "$TST_USE_LEGACY_API" ]; then
> -	tst_net_read_opts $*
> +	tst_net_read_opts "$@"

Thanks Xiao for  fix, patch applied (with additional explanation and Fixes: in commit
message).

Network tests are no longer blocking the release.

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 32b4f09..df850a0 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -78,7 +78,7 @@  if [ -z "$TST_LIB_LOADED" ]; then
 fi
 
 if [ -n "$TST_USE_LEGACY_API" ]; then
-	tst_net_read_opts $*
+	tst_net_read_opts "$@"
 	ipver=${TST_IPV6:-4}
 fi