Proper fix of vxlan03.sh tests.
cover Proper fix of vxlan03.sh tests.
Hi Alexey, Cyril,
Alexey, can you please review this fix?
Cyril, I'd like to merge this fix before release.
Kind regards,
Petr
Petr Vorel (2):
Revert "network/vxlan03: Fix getopts parameters passed to virt_lib.sh" network/vxlan: Fix getopts parameters passed from vxlan03 to
virt_lib.sh
testcases/network/virt/geneve01.sh | 2 -- testcases/network/virt/gre01.sh | 3 --- testcases/network/virt/ipvlan01.sh | 2 -- testcases/network/virt/macvlan01.sh | 2 -- testcases/network/virt/macvtap01.sh | 2 -- testcases/network/virt/virt_lib.sh | 3 +-- testcases/network/virt/vlan01.sh | 2 -- testcases/network/virt/vlan02.sh | 2 -- testcases/network/virt/vlan03.sh | 2 -- testcases/network/virt/vxlan01.sh | 2 -- testcases/network/virt/vxlan02.sh | 2 -- testcases/network/virt/vxlan03.sh | 3 --- 12 files changed, 1 insertion(+), 26 deletions(-)
Signature · 1 line
2.16.3
PATCH 1/2 Revert "network/vxlan03: Fix getopts parameters passed to virt_lib.sh"
This reverts commit 06ee2b0273bd79a423b88b4488c71aebef0bb2ea.
With this patch vxlan03 ignores the '-6' option.
And tst_net.sh sourced two times there, in virt_lib.sh and in vxlan03.sh.
--- testcases/network/virt/virt_lib.sh | 29 ++++++++++++----------------- testcases/network/virt/vxlan03.sh | 3 +-- 2 files changed, 13 insertions(+), 19 deletions(-)
testcases/network/virt/virt_lib.sh +12 -17
@@ -28,6 +28,18 @@ # them in cleanup function. See "start_vni" variable which can # solve it. +ip_local=$(tst_ipaddr) +ip_virt_local="$(TST_IPV6= tst_ipaddr_un)" +ip6_virt_local="$(TST_IPV6=6 tst_ipaddr_un)" + +ip_remote=$(tst_ipaddr rhost) +ip_virt_remote="$(TST_IPV6= tst_ipaddr_un rhost)" +ip6_virt_remote="$(TST_IPV6=6 tst_ipaddr_un rhost)" + +# Max performance loss (%) for virtual devices during network load +VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-80} +vxlan_dstport=0 + while getopts :hi:d:6 opt; do case "$opt" in h)
@@ -48,23 +60,6 @@ while getopts :hi:d:6 opt; do esac done -shift $(($OPTIND - 1)) - -TST_USE_LEGACY_API=1 -. tst_net.sh - -ip_local=$(tst_ipaddr) -ip_virt_local="$(TST_IPV6= tst_ipaddr_un)" -ip6_virt_local="$(TST_IPV6=6 tst_ipaddr_un)" - -ip_remote=$(tst_ipaddr rhost) -ip_virt_remote="$(TST_IPV6= tst_ipaddr_un rhost)" -ip6_virt_remote="$(TST_IPV6=6 tst_ipaddr_un rhost)" - -# Max performance loss (%) for virtual devices during network load -VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-80} -vxlan_dstport=0 - cleanup_vifaces() { tst_resm TINFO "cleanup virtual interfaces..."
testcases/network/virt/vxlan03.sh +1 -2
@@ -33,10 +33,9 @@ start_id=16700000 # Destination address, can be unicast or multicast address vxlan_dst_addr="uni" -. virt_lib.sh - TST_USE_LEGACY_API=1 . tst_net.sh +. virt_lib.sh # In average cases (with small packets less then 150 bytes) VxLAN slower # by 10-30%. If hosts are too close to each other, e.g. connected to the same
Signature · 1 line
2.16.3
PATCH 2/2 network/vxlan: Fix getopts parameters passed from vxlan03 to virt_lib.sh
In reply to Petr Vorel* shift parameters and add getopts handling of -6 parameter in vxlan03.sh
* move loading tst_net.sh from vxlan03.sh and other virt_lib.sh users to virt_lib.sh itself
vxlan03.sh pass getopts parameter to virt_lib.sh (other than -6 which is handled by tst_net.sh), which causes getopts error:
vxlan03.sh -d uni/opt/ltp/testcases/bin/vxlan03.sh: illegal option -- d /opt/ltp/testcases/bin/tst_net.sh: line 37: ?: command not found
These parameters must be processed and shifted before loading tst_net.sh. Move loading tst_net.sh from vxlan03.sh and other virt_lib.sh users to virt_lib.sh itself solve it. -6 parameter must be handled the same way as in tst_net.sh (which leads to duplicity but it cannot be avoided atm) The approach of handling tst_net.sh is now the same as in ipsec_lib.sh.
--- testcases/network/virt/geneve01.sh | 2 -- testcases/network/virt/gre01.sh | 3 --- testcases/network/virt/ipvlan01.sh | 2 -- testcases/network/virt/macvlan01.sh | 2 -- testcases/network/virt/macvtap01.sh | 2 -- testcases/network/virt/virt_lib.sh | 32 ++++++++++++++++++-------------- testcases/network/virt/vlan01.sh | 2 -- testcases/network/virt/vlan02.sh | 2 -- testcases/network/virt/vlan03.sh | 2 -- testcases/network/virt/vxlan01.sh | 2 -- testcases/network/virt/vxlan02.sh | 2 -- testcases/network/virt/vxlan03.sh | 2 -- 12 files changed, 18 insertions(+), 37 deletions(-)
testcases/network/virt/geneve01.sh +0 -2
@@ -27,8 +27,6 @@ start_id=16700000 # that is why using here 'vxlan_*' library functions. vxlan_dst_addr="uni" -TST_USE_LEGACY_API=1 -. tst_net.sh . virt_lib.sh VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-160}
testcases/network/virt/gre01.sh +0 -3
@@ -24,9 +24,6 @@ TCID=gre01 TST_TOTAL=1 TST_NEEDS_TMPDIR=1 -TST_USE_LEGACY_API=1 -. tst_net.sh - virt_type="gre" [ "$TST_IPV6" ] && virt_type="ip6gre"
testcases/network/virt/ipvlan01.sh +0 -2
@@ -24,8 +24,6 @@ TST_TOTAL=2 virt_type="ipvlan" -TST_USE_LEGACY_API=1 -. tst_net.sh . virt_lib.sh options="mode l2,mode l3"
testcases/network/virt/macvlan01.sh +0 -2
@@ -24,8 +24,6 @@ TST_TOTAL=4 virt_type="macvlan" -TST_USE_LEGACY_API=1 -. tst_net.sh . virt_lib.sh options="mode private,mode vepa,mode bridge,mode passthru"
testcases/network/virt/macvtap01.sh +0 -2
@@ -24,8 +24,6 @@ TST_TOTAL=4 virt_type="macvtap" -TST_USE_LEGACY_API=1 -. tst_net.sh . virt_lib.sh options="mode private,mode vepa,mode bridge,mode passthru"
testcases/network/virt/virt_lib.sh +18 -14
@@ -28,18 +28,6 @@ # them in cleanup function. See "start_vni" variable which can # solve it. -ip_local=$(tst_ipaddr) -ip_virt_local="$(TST_IPV6= tst_ipaddr_un)" -ip6_virt_local="$(TST_IPV6=6 tst_ipaddr_un)" - -ip_remote=$(tst_ipaddr rhost) -ip_virt_remote="$(TST_IPV6= tst_ipaddr_un rhost)" -ip6_virt_remote="$(TST_IPV6=6 tst_ipaddr_un rhost)" - -# Max performance loss (%) for virtual devices during network load -VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-80} -vxlan_dstport=0 - while getopts :hi:d:6 opt; do case "$opt" in h)
@@ -52,14 +40,30 @@ while getopts :hi:d:6 opt; do ;; i) start_id=$OPTARG ;; d) vxlan_dst_addr=$OPTARG ;; - 6) # skip, test_net library already processed it - ;; + 6) TST_IPV6=6 ;; *) tst_brkm TBROK "unknown option: $opt" ;; esac done +shift $(($OPTIND - 1)) + +TST_USE_LEGACY_API=1 +. tst_net.sh + +ip_local=$(tst_ipaddr) +ip_virt_local="$(TST_IPV6= tst_ipaddr_un)" +ip6_virt_local="$(TST_IPV6=6 tst_ipaddr_un)" + +ip_remote=$(tst_ipaddr rhost) +ip_virt_remote="$(TST_IPV6= tst_ipaddr_un rhost)" +ip6_virt_remote="$(TST_IPV6=6 tst_ipaddr_un rhost)" + +# Max performance loss (%) for virtual devices during network load +VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-80} +vxlan_dstport=0 + cleanup_vifaces() { tst_resm TINFO "cleanup virtual interfaces..."
testcases/network/virt/vlan01.sh +0 -2
@@ -24,8 +24,6 @@ TST_TOTAL=9 virt_type="vlan" -TST_USE_LEGACY_API=1 -. tst_net.sh . virt_lib.sh p0="protocol 802.1Q"
testcases/network/virt/vlan02.sh +0 -2
@@ -25,8 +25,6 @@ TST_TOTAL=1 virt_type="vlan" -TST_USE_LEGACY_API=1 -. tst_net.sh . virt_lib.sh virt_add_delete_test "id 4094"
testcases/network/virt/vlan03.sh +0 -2
@@ -29,8 +29,6 @@ TST_NEEDS_TMPDIR=1 virt_type="vlan" -TST_USE_LEGACY_API=1 -. tst_net.sh . virt_lib.sh TST_CLEANUP="virt_cleanup"
testcases/network/virt/vxlan01.sh +0 -2
@@ -25,8 +25,6 @@ TST_TOTAL=5 virt_type="vxlan" start_id=16700000 -TST_USE_LEGACY_API=1 -. tst_net.sh . virt_lib.sh options="l2miss l3miss,norsc nolearning noproxy,\
testcases/network/virt/vxlan02.sh +0 -2
@@ -26,8 +26,6 @@ TST_TOTAL=1 virt_type="vxlan" start_id=16700000 -TST_USE_LEGACY_API=1 -. tst_net.sh . virt_lib.sh [ "$TST_IPV6" ] && mult_addr="ff02::abc" || mult_addr="239.1.1.1"
testcases/network/virt/vxlan03.sh +0 -2
@@ -33,8 +33,6 @@ start_id=16700000 # Destination address, can be unicast or multicast address vxlan_dst_addr="uni" -TST_USE_LEGACY_API=1 -. tst_net.sh . virt_lib.sh # In average cases (with small packets less then 150 bytes) VxLAN slower
Signature · 1 line
2.16.3
PATCH 2/2 network/vxlan: Fix getopts parameters passed from vxlan03 to virt_lib.sh
Quoted 18 lines · Petr Vorel
* shift parameters and add getopts handling of -6 parameter in
vxlan03.sh
* move loadingtst_net.shfromvxlan03.shand othervirt_lib.shusers tovirt_lib.shitself
vxlan03.shpass getopts parameter tovirt_lib.sh(other than -6 which is handled bytst_net.sh), which causes getopts error:
vxlan03.sh-d uni/opt/ltp/testcases/bin/vxlan03.sh: illegal option -- d/opt/ltp/testcases/bin/tst_net.sh: line 37: ?: command not foundThese parameters must be processed and shifted before loading
tst_net.sh. Move loadingtst_net.shfromvxlan03.shand othervirt_lib.shusers tovirt_lib.shitself solve it. -6 parameter must be handled the same way as intst_net.sh(which leads to duplicity but it cannot be avoided atm) The approach of handlingtst_net.shis now the same as inipsec_lib.sh.
Quoted 5 lines
Fixes ba53eb04e tst_net.sh: Support both new and legacy APIs + renameSigned-off-by Petr Vorel <[email protected]>Reported-by Alexey Kodanev <[email protected]>---
Hi Petr,
...
Quoted 29 lines
options="mode private,mode vepa,mode bridge,mode passthru"
testcases/network/virt/virt_lib.sh +0
-13@@ -28,18 +28,6 @@ # them in cleanup function. See "start_vni" variable which can # solve it. -ip_local=$(tst_ipaddr) -ip_virt_local="$(TST_IPV6= tst_ipaddr_un)" -ip6_virt_local="$(TST_IPV6=6 tst_ipaddr_un)" - -ip_remote=$(tst_ipaddr rhost) -ip_virt_remote="$(TST_IPV6= tst_ipaddr_un rhost)" -ip6_virt_remote="$(TST_IPV6=6 tst_ipaddr_un rhost)" - -# Max performance loss (%) for virtual devices during network load -VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-80} -vxlan_dstport=0 - while getopts :hi:d:6 opt; do case "$opt" in h)@@ -52,14 +40,30 @@ while getopts :hi:d:6 opt; do ;; i) start_id=$OPTARG ;; d) vxlan_dst_addr=$OPTARG ;; - 6) # skip, test_net library already processed it
testcases/network/virt/virt_lib.sh while getopts :hi:d:6 opt; do · line 51
Quoted 10 lines
testcases/network/virt/virt_lib.sh +3
-1- ;; + 6) TST_IPV6=6 ;; *) tst_brkm TBROK "unknown option: $opt" ;; esac done +shift $(($OPTIND - 1)) +
What about using TST_OPTS and TST_PARSE_ARGS here, instead of 'while getopts...' and 'shift'?
virt_parse_args()
{
case "$1" in
h)
...
;;
i) start_id=$OPTARG ;;
d) vxlan_dst_addr=$OPTARG ;;
esac
}TST_OPTS="hi:d:"
TST_PARSE_ARGS=virt_parse_args
PATCH 2/2 network/vxlan: Fix getopts parameters passed from vxlan03 to virt_lib.sh
Hi Alexey,
Quoted 17 lines
Hi Petr,
What about using
TST_OPTSandTST_PARSE_ARGShere, instead of 'while getopts...' and 'shift'?
virt_parse_args(){ case "$1" in h) ... ;; i) start_id=$OPTARG ;; d) vxlan_dst_addr=$OPTARG ;; esac }
Quoted 2 lines
TST_OPTS="hi:d:"
TST_PARSE_ARGS=virt_parse_args
Sure :). Thanks for reminding me my own code :).
I've sent v2 with it, can you have a quick look?
Kind regards,
Petr