Skip to contentSkip to conversation

Migrate tests using virt_lib.sh and ipsec_lib.sh to new API

PATCH Superseded Petr Vorel 3 participants 10 messages Jun 18, 2018 – Jun 22, 2018

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

cover Migrate tests using virt_lib.sh and ipsec_lib.sh to new API

Hi,

this is a big patch rewriting virt_lib.sh and ipsec_lib.sh libraries + 23 tests depending on it. It was needed to migrate it all in once, as macsec0{1,2}.sh tests are using both libraries.
I tried to use TST_TEST_DATA as much as I could, but still there are tests which needs to use for loop and thus have the same TST_CNT number for many iterations.

Comments are welcome.
Testing is even more welcome. It took me some time to fix all bugs, but there might be still some.

Kind regards,
Petr

Petr Vorel (6):
net/ipsec: Improve log info messages
tst_test.sh: Introduce TST_LIB_LOADED
tst_net.sh: Harden against multiple loading
net/ipsec: Use ':' as array separator for -s parameter net/{stress,virt}: Use SPDX-License-Identifier GPL-2.0-or-later net/{stress,virt}: Migrate tests using virt_lib.sh and ipsec_lib.sh

 runtest/net_stress.ipsec_dccp                 | 212 +++++++++---------
 runtest/net_stress.ipsec_icmp                 | 168 +++++++-------
 runtest/net_stress.ipsec_sctp                 | 212 +++++++++---------
 runtest/net_stress.ipsec_tcp                  | 212 +++++++++---------
 runtest/net_stress.ipsec_udp                  | 208 ++++++++---------
 testcases/lib/tst_net.sh                      |  59 +++--
 testcases/lib/tst_test.sh                     |   1 +
 testcases/network/stress/dccp/dccp_ipsec.sh   |  34 +--
 .../network/stress/dccp/dccp_ipsec_vti.sh     |  34 +--
 .../network/stress/icmp/icmp-uni-basic.sh     |  54 ++---
 testcases/network/stress/icmp/icmp-uni-vti.sh |  39 ++--
 testcases/network/stress/ipsec/ipsec_lib.sh   | 155 ++++++-------
 testcases/network/stress/sctp/sctp_ipsec.sh   |  35 +--
 .../network/stress/sctp/sctp_ipsec_vti.sh     |  35 +--
 testcases/network/stress/tcp/tcp_ipsec.sh     |  37 +--
 testcases/network/stress/tcp/tcp_ipsec_vti.sh |  36 +--
 testcases/network/stress/udp/udp_ipsec.sh     |  39 +---
 testcases/network/stress/udp/udp_ipsec_vti.sh |  39 +---
 testcases/network/virt/geneve01.sh            |  57 ++---
 testcases/network/virt/gre01.sh               |  49 ++--
 testcases/network/virt/ipvlan01.sh            |  27 +--
 testcases/network/virt/macsec01.sh            |  45 ++--
 testcases/network/virt/macsec02.sh            |  47 ++--
 testcases/network/virt/macvlan01.sh           |  32 +--
 testcases/network/virt/macvtap01.sh           |  32 +--
 testcases/network/virt/virt_lib.sh            | 170 ++++++--------
 testcases/network/virt/vlan01.sh              |  35 +--
 testcases/network/virt/vlan02.sh              |  28 +--
 testcases/network/virt/vlan03.sh              |  65 +++---
 testcases/network/virt/vxlan01.sh             |  31 +--
 testcases/network/virt/vxlan02.sh             |  31 +--
 testcases/network/virt/vxlan03.sh             |  52 ++---
 32 files changed, 965 insertions(+), 1345 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/6 net/ipsec: Improve log info messages

* Log all IPsec tst_ipsec_setup calls.
* Remove redundant log output from icmp-uni-basic.sh to make it similar to icmp-uni-vti.sh.

---
 testcases/network/stress/icmp/icmp-uni-basic.sh | 14 +-------------
 testcases/network/stress/icmp/icmp-uni-vti.sh   |  2 +-
 testcases/network/stress/ipsec/ipsec_lib.sh     |  1 +
 3 files changed, 3 insertions(+), 14 deletions(-)
testcases/network/stress/icmp/icmp-uni-basic.sh +1 -13
index fc84899dd..3099b6caa 100755
@@ -25,23 +25,11 @@ TST_CLEANUP="tst_ipsec_cleanup"
 
 . ipsec_lib.sh
 
-# Test description
-tst_resm TINFO "Sending ICMP messages with the following conditions"
-tst_resm TINFO "- Version of IP is IPv${TST_IPV6:-4}"
-tst_resm TINFO "- Size of packets are ( $IPSEC_SIZE_ARRAY )"
-
-if [ -n "$IPSEC_MODE" -a -n "$IPSEC_PROTO" ]; then
-	case $IPSEC_PROTO in
-	ah)	tst_resm TINFO "- IPsec [ AH / $IPSEC_MODE ]" ;;
-	esp)	tst_resm TINFO "- IPsec [ ESP / $IPSEC_MODE ]" ;;
-	comp)	tst_resm TINFO "- IPcomp [ $IPSEC_MODE ]" ;;
-	esac
-fi
-
 tst_ipsec_setup
 
 PING_MAX="$IPSEC_REQUESTS"
 
+tst_resm TINFO "Sending ICMP messages"
 tst_ping $(tst_iface) $(tst_ipaddr rhost) $IPSEC_SIZE_ARRAY
 
 tst_exit
testcases/network/stress/icmp/icmp-uni-vti.sh +1 -1
index 7fa211d7f..ea8b5c828 100755
@@ -26,7 +26,7 @@ do_test()
 {
 	PING_MAX="$IPSEC_REQUESTS"
 
-	tst_resm TINFO "Sending ICMP messages..."
+	tst_resm TINFO "Sending ICMP messages"
 	tst_ping $tst_vti $ip_rmt_tun $IPSEC_SIZE_ARRAY
 }
 
testcases/network/stress/ipsec/ipsec_lib.sh +1 -0
index 2e001c718..9c293ca3e 100644
@@ -115,6 +115,7 @@ tst_ipsec_setup()
 {
 	# Configure SAD/SPD
 	if [ -n "$IPSEC_MODE" -a -n "$IPSEC_PROTO" ]; then
+		tst_resm TINFO "IPsec[$IPSEC_PROTO/$IPSEC_MODE]"
 		tst_ipsec lhost $(tst_ipaddr) $(tst_ipaddr rhost)
 		tst_ipsec rhost $(tst_ipaddr rhost) $(tst_ipaddr)
 	fi
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/6 tst_test.sh: Introduce TST_LIB_LOADED

In reply to Petr Vorel

This allows to detect whether library was loaded more than once. This is used by tst_net.sh (which is loaded more than once itself by tests macsec0{1,2}.sh)

---
 testcases/lib/tst_test.sh | 1 +
 1 file changed, 1 insertion(+)
testcases/lib/tst_test.sh +1 -0
index d27b4afd6..c0ffc3316 100644
@@ -29,6 +29,7 @@ export TST_CONF=0
 export TST_COUNT=1
 export TST_ITERATIONS=1
 export TST_TMPDIR_RHOST=0
+export TST_LIB_LOADED=1
 
 . tst_ansi_color.sh
 
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH 3/6 tst_net.sh: Harden against multiple loading

In reply to Petr Vorel

Some tests (macsec0{1,2}.sh) load tst_net.sh twice via loading from ipsec_lib.sh and virt_lib.sh.
That brings duplicity in some variables (TST_OPTS) and create infinite loop, as tst_net_setup calls itself.

---
 testcases/lib/tst_net.sh | 42 +++++++++++++++++++++++++---------------
 1 file changed, 26 insertions(+), 16 deletions(-)
testcases/lib/tst_net.sh +26 -16
index aad701952..ac61dfab8 100644
@@ -19,14 +19,6 @@
 # Author: Alexey Kodanev <[email protected]>
 #
 
-TST_OPTS="6$TST_OPTS"
-TST_PARSE_ARGS_CALLER="$TST_PARSE_ARGS"
-TST_PARSE_ARGS="tst_net_parse_args"
-TST_USAGE_CALLER="$TST_USAGE"
-TST_USAGE="tst_net_usage"
-TST_SETUP_CALLER="$TST_SETUP"
-TST_SETUP="tst_net_setup"
-
 # Blank for an IPV4 test; 6 for an IPV6 test.
 TST_IPV6=${TST_IPV6:-}
 TST_IPVER=${TST_IPV6:-4}
@@ -73,14 +65,6 @@ tst_net_setup()
 	[ -n "$TST_SETUP_CALLER" ] && $TST_SETUP_CALLER
 }
 
-if [ -z "$TST_LIB_LOADED" ]; then
-	[ -n "$TST_USE_LEGACY_API" ] && . test.sh || . tst_test.sh
-fi
-
-if [ -n "$TST_USE_LEGACY_API" ]; then
-	tst_net_read_opts "$@"
-fi
-
 # old vs. new API compatibility layer
 tst_res_()
 {
@@ -659,6 +643,32 @@ tst_cleanup_rhost()
 	tst_rhost_run -c "rm -rf $TST_TMPDIR"
 }
 
+if [ -z "$TST_LIB_LOADED" ]; then
+	TST_OPTS="6$TST_OPTS"
+	TST_PARSE_ARGS_CALLER="$TST_PARSE_ARGS"
+	TST_PARSE_ARGS="tst_net_parse_args"
+	TST_USAGE_CALLER="$TST_USAGE"
+	TST_USAGE="tst_net_usage"
+	TST_SETUP_CALLER="$TST_SETUP"
+	TST_SETUP="tst_net_setup"
+
+	if [ "$TST_PARSE_ARGS_CALLER" = "$TST_PARSE_ARGS" ]; then
+		unset TST_PARSE_ARGS_CALLER
+	fi
+	if [ "$TST_USAGE_CALLER" = "$TST_USAGE" ]; then
+		unset TST_USAGE_CALLER
+	fi
+	if [ "$TST_PARSE_ARGS_CALLER" = "$TST_PARSE_ARGS" ]; then
+		unset TST_PARSE_ARGS_CALLER
+	fi
+
+	[ -n "$TST_USE_LEGACY_API" ] && . test.sh || . tst_test.sh
+fi
+
+if [ -n "$TST_USE_LEGACY_API" ]; then
+	tst_net_read_opts "$@"
+fi
+
 # Management Link
 [ -z "$RHOST" ] && TST_USE_NETNS="yes"
 export RHOST="$RHOST"
Signature · 1 line
2.17.1
#4 lore raw

PATCH 3/6 tst_net.sh: Harden against multiple loading

Hi!

testcases/lib/tst_net.sh line 20

Quoted 12 lines
---
 testcases/lib/tst_net.sh | 42 +++++++++++++++++++++++++---------------
 1 file changed, 26 insertions(+), 16 deletions(-)
testcases/lib/tst_net.sh +0 -0
index aad701952..ac61dfab8 100644
@@ -19,14 +19,6 @@
 # Author: Alexey Kodanev <[email protected]>
 #

Can't we just add some kind of guards to the library script?

If we add something like this:

[ "$TST_LIB_LOADED" ] && return 0
TST_LIB_LOADED=1

The library will be sourced exactly once.

Quoted 62 lines
testcases/lib/tst_net.sh +26 -16
-TST_OPTS="6$TST_OPTS"
-TST_PARSE_ARGS_CALLER="$TST_PARSE_ARGS"
-TST_PARSE_ARGS="tst_net_parse_args"
-TST_USAGE_CALLER="$TST_USAGE"
-TST_USAGE="tst_net_usage"
-TST_SETUP_CALLER="$TST_SETUP"
-TST_SETUP="tst_net_setup"
-
 # Blank for an IPV4 test; 6 for an IPV6 test.
 TST_IPV6=${TST_IPV6:-}
 TST_IPVER=${TST_IPV6:-4}
@@ -73,14 +65,6 @@ tst_net_setup()
 	[ -n "$TST_SETUP_CALLER" ] && $TST_SETUP_CALLER
 }
 
-if [ -z "$TST_LIB_LOADED" ]; then
-	[ -n "$TST_USE_LEGACY_API" ] && . test.sh || . tst_test.sh
-fi
-
-if [ -n "$TST_USE_LEGACY_API" ]; then
-	tst_net_read_opts "$@"
-fi
-
 # old vs. new API compatibility layer
 tst_res_()
 {
@@ -659,6 +643,32 @@ tst_cleanup_rhost()
 	tst_rhost_run -c "rm -rf $TST_TMPDIR"
 }
 
+if [ -z "$TST_LIB_LOADED" ]; then
+	TST_OPTS="6$TST_OPTS"
+	TST_PARSE_ARGS_CALLER="$TST_PARSE_ARGS"
+	TST_PARSE_ARGS="tst_net_parse_args"
+	TST_USAGE_CALLER="$TST_USAGE"
+	TST_USAGE="tst_net_usage"
+	TST_SETUP_CALLER="$TST_SETUP"
+	TST_SETUP="tst_net_setup"
+
+	if [ "$TST_PARSE_ARGS_CALLER" = "$TST_PARSE_ARGS" ]; then
+		unset TST_PARSE_ARGS_CALLER
+	fi
+	if [ "$TST_USAGE_CALLER" = "$TST_USAGE" ]; then
+		unset TST_USAGE_CALLER
+	fi
+	if [ "$TST_PARSE_ARGS_CALLER" = "$TST_PARSE_ARGS" ]; then
+		unset TST_PARSE_ARGS_CALLER
+	fi
+
+	[ -n "$TST_USE_LEGACY_API" ] && . test.sh || . tst_test.sh
+fi
+
+if [ -n "$TST_USE_LEGACY_API" ]; then
+	tst_net_read_opts "$@"
+fi
+
 # Management Link
 [ -z "$RHOST" ] && TST_USE_NETNS="yes"
 export RHOST="$RHOST"
Signature · 1 line
2.17.1
Signature · 2 lines
Cyril Hrubis
[email protected]
author
#5 lore raw

PATCH 4/6 net/ipsec: Use ':' as array separator for -s parameter

In reply to Petr Vorel

This is a preparation for new API, which is not able to handle quoted parameters (problematic is TST_ARGS="$@").
-s parameter, used for $IPSEC_SIZE_ARRAY use space as array separator. Use ':' instead, so parameter doesn't have to be quoted.

Fixes 89a83d8a0 ("net/ipsec_lib.sh: Process getopts parameters with

TST_OPTS and TST_PARSE_ARGS")

---
 runtest/net_stress.ipsec_dccp               | 212 ++++++++++----------
 runtest/net_stress.ipsec_icmp               | 168 ++++++++--------
 runtest/net_stress.ipsec_sctp               | 212 ++++++++++----------
 runtest/net_stress.ipsec_tcp                | 212 ++++++++++----------
 runtest/net_stress.ipsec_udp                | 208 +++++++++----------
 testcases/network/stress/ipsec/ipsec_lib.sh |  12 +-
 6 files changed, 516 insertions(+), 508 deletions(-)
runtest/net_stress.ipsec_dccp +106 -106
index d867ab533..cdd10da26 100644
@@ -1,109 +1,109 @@
-dccp4_ipsec01 dccp_ipsec.sh -s "100 500 1000"
-dccp4_ipsec02 dccp_ipsec.sh -p ah -m transport -s "100 500 1000"
-dccp4_ipsec03 dccp_ipsec.sh -p ah -m tunnel -s "100 500 1000"
-dccp4_ipsec04 dccp_ipsec.sh -p esp -m transport -s "100 500 1000"
-dccp4_ipsec05 dccp_ipsec.sh -p esp -m tunnel -s "100 500 1000"
-dccp4_ipsec06 dccp_ipsec.sh -p comp -m transport -s "100 500 1000"
-dccp4_ipsec07 dccp_ipsec.sh -p comp -m tunnel -s "100 500 1000"
-dccp4_ipsec08 dccp_ipsec.sh -A rfc4106_128 -p esp_aead -m transport -s "100 500 1000"
-dccp4_ipsec09 dccp_ipsec.sh -A rfc4106_128 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec10 dccp_ipsec.sh -A rfc4106_192 -p esp_aead -m transport -s "100 500 1000"
-dccp4_ipsec11 dccp_ipsec.sh -A rfc4106_192 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec12 dccp_ipsec.sh -A rfc4106_256 -p esp_aead -m transport -s "100 500 1000"
-dccp4_ipsec13 dccp_ipsec.sh -A rfc4106_256 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec14 dccp_ipsec.sh -A rfc4309_128 -p esp_aead -m transport -s "100 500 1000"
-dccp4_ipsec15 dccp_ipsec.sh -A rfc4309_128 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec16 dccp_ipsec.sh -A rfc4309_192 -p esp_aead -m transport -s "100 500 1000"
-dccp4_ipsec17 dccp_ipsec.sh -A rfc4309_192 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec18 dccp_ipsec.sh -A rfc4309_256 -p esp_aead -m transport -s "100 500 1000"
-dccp4_ipsec19 dccp_ipsec.sh -A rfc4309_256 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec20 dccp_ipsec.sh -A rfc4543_128 -p esp_aead -m transport -s "100 500 1000"
-dccp4_ipsec21 dccp_ipsec.sh -A rfc4543_128 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec22 dccp_ipsec.sh -A rfc4543_192 -p esp_aead -m transport -s "100 500 1000"
-dccp4_ipsec23 dccp_ipsec.sh -A rfc4543_192 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec24 dccp_ipsec.sh -A rfc4543_256 -p esp_aead -m transport -s "100 500 1000"
-dccp4_ipsec25 dccp_ipsec.sh -A rfc4543_256 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec26 dccp_ipsec.sh -p esp -a sha1 -e cast5 -m transport -s "100 500 1000"
-dccp4_ipsec27 dccp_ipsec.sh -p esp -a sha1 -e cast5 -m tunnel -s "100 500 1000"
-dccp4_ipsec28 dccp_ipsec.sh -p esp -a sha256 -e blowfish -m transport -s "100 500 1000"
-dccp4_ipsec29 dccp_ipsec.sh -p esp -a sha256 -e blowfish -m tunnel -s "100 500 1000"
-dccp4_ipsec30 dccp_ipsec.sh -p esp -a sha384 -e twofish -m transport -s "100 500 1000"
-dccp4_ipsec31 dccp_ipsec.sh -p esp -a sha384 -e twofish -m tunnel -s "100 500 1000"
-dccp4_ipsec32 dccp_ipsec.sh -p esp -a sha512 -e camellia -m transport -s "100 500 1000"
-dccp4_ipsec33 dccp_ipsec.sh -p esp -a sha512 -e camellia -m tunnel -s "100 500 1000"
-dccp4_ipsec34 dccp_ipsec.sh -p esp -a rmd160 -e serpent -m transport -s "100 500 1000"
-dccp4_ipsec35 dccp_ipsec.sh -p esp -a rmd160 -e serpent -m tunnel -s "100 500 1000"
-dccp4_ipsec36 dccp_ipsec.sh -p esp -m beet -s "100 500 1000"
+dccp4_ipsec01 dccp_ipsec.sh -s 100:500:1000
+dccp4_ipsec02 dccp_ipsec.sh -p ah -m transport -s 100:500:1000
+dccp4_ipsec03 dccp_ipsec.sh -p ah -m tunnel -s 100:500:1000
+dccp4_ipsec04 dccp_ipsec.sh -p esp -m transport -s 100:500:1000
+dccp4_ipsec05 dccp_ipsec.sh -p esp -m tunnel -s 100:500:1000
+dccp4_ipsec06 dccp_ipsec.sh -p comp -m transport -s 100:500:1000
+dccp4_ipsec07 dccp_ipsec.sh -p comp -m tunnel -s 100:500:1000
+dccp4_ipsec08 dccp_ipsec.sh -A rfc4106_128 -p esp_aead -m transport -s 100:500:1000
+dccp4_ipsec09 dccp_ipsec.sh -A rfc4106_128 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec10 dccp_ipsec.sh -A rfc4106_192 -p esp_aead -m transport -s 100:500:1000
+dccp4_ipsec11 dccp_ipsec.sh -A rfc4106_192 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec12 dccp_ipsec.sh -A rfc4106_256 -p esp_aead -m transport -s 100:500:1000
+dccp4_ipsec13 dccp_ipsec.sh -A rfc4106_256 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec14 dccp_ipsec.sh -A rfc4309_128 -p esp_aead -m transport -s 100:500:1000
+dccp4_ipsec15 dccp_ipsec.sh -A rfc4309_128 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec16 dccp_ipsec.sh -A rfc4309_192 -p esp_aead -m transport -s 100:500:1000
+dccp4_ipsec17 dccp_ipsec.sh -A rfc4309_192 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec18 dccp_ipsec.sh -A rfc4309_256 -p esp_aead -m transport -s 100:500:1000
+dccp4_ipsec19 dccp_ipsec.sh -A rfc4309_256 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec20 dccp_ipsec.sh -A rfc4543_128 -p esp_aead -m transport -s 100:500:1000
+dccp4_ipsec21 dccp_ipsec.sh -A rfc4543_128 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec22 dccp_ipsec.sh -A rfc4543_192 -p esp_aead -m transport -s 100:500:1000
+dccp4_ipsec23 dccp_ipsec.sh -A rfc4543_192 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec24 dccp_ipsec.sh -A rfc4543_256 -p esp_aead -m transport -s 100:500:1000
+dccp4_ipsec25 dccp_ipsec.sh -A rfc4543_256 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec26 dccp_ipsec.sh -p esp -a sha1 -e cast5 -m transport -s 100:500:1000
+dccp4_ipsec27 dccp_ipsec.sh -p esp -a sha1 -e cast5 -m tunnel -s 100:500:1000
+dccp4_ipsec28 dccp_ipsec.sh -p esp -a sha256 -e blowfish -m transport -s 100:500:1000
+dccp4_ipsec29 dccp_ipsec.sh -p esp -a sha256 -e blowfish -m tunnel -s 100:500:1000
+dccp4_ipsec30 dccp_ipsec.sh -p esp -a sha384 -e twofish -m transport -s 100:500:1000
+dccp4_ipsec31 dccp_ipsec.sh -p esp -a sha384 -e twofish -m tunnel -s 100:500:1000
+dccp4_ipsec32 dccp_ipsec.sh -p esp -a sha512 -e camellia -m transport -s 100:500:1000
+dccp4_ipsec33 dccp_ipsec.sh -p esp -a sha512 -e camellia -m tunnel -s 100:500:1000
+dccp4_ipsec34 dccp_ipsec.sh -p esp -a rmd160 -e serpent -m transport -s 100:500:1000
+dccp4_ipsec35 dccp_ipsec.sh -p esp -a rmd160 -e serpent -m tunnel -s 100:500:1000
+dccp4_ipsec36 dccp_ipsec.sh -p esp -m beet -s 100:500:1000
 
-dccp6_ipsec01 dccp_ipsec.sh -6 -s "100 500 1000"
-dccp6_ipsec02 dccp_ipsec.sh -6 -p ah -m transport -s "100 500 1000"
-dccp6_ipsec03 dccp_ipsec.sh -6 -p ah -m tunnel -s "100 500 1000"
-dccp6_ipsec04 dccp_ipsec.sh -6 -p esp -m transport -s "100 500 1000"
-dccp6_ipsec05 dccp_ipsec.sh -6 -p esp -m tunnel -s "100 500 1000"
-dccp6_ipsec06 dccp_ipsec.sh -6 -p comp -m transport -s "100 500 1000"
-dccp6_ipsec07 dccp_ipsec.sh -6 -p comp -m tunnel -s "100 500 1000"
-dccp6_ipsec08 dccp_ipsec.sh -6 -A rfc4106_128 -p esp_aead -m transport -s "100 500 1000"
-dccp6_ipsec09 dccp_ipsec.sh -6 -A rfc4106_128 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec10 dccp_ipsec.sh -6 -A rfc4106_192 -p esp_aead -m transport -s "100 500 1000"
-dccp6_ipsec11 dccp_ipsec.sh -6 -A rfc4106_192 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec12 dccp_ipsec.sh -6 -A rfc4106_256 -p esp_aead -m transport -s "100 500 1000"
-dccp6_ipsec13 dccp_ipsec.sh -6 -A rfc4106_256 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec14 dccp_ipsec.sh -6 -A rfc4309_128 -p esp_aead -m transport -s "100 500 1000"
-dccp6_ipsec15 dccp_ipsec.sh -6 -A rfc4309_128 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec16 dccp_ipsec.sh -6 -A rfc4309_192 -p esp_aead -m transport -s "100 500 1000"
-dccp6_ipsec17 dccp_ipsec.sh -6 -A rfc4309_192 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec18 dccp_ipsec.sh -6 -A rfc4309_256 -p esp_aead -m transport -s "100 500 1000"
-dccp6_ipsec19 dccp_ipsec.sh -6 -A rfc4309_256 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec20 dccp_ipsec.sh -6 -A rfc4543_128 -p esp_aead -m transport -s "100 500 1000"
-dccp6_ipsec21 dccp_ipsec.sh -6 -A rfc4543_128 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec22 dccp_ipsec.sh -6 -A rfc4543_192 -p esp_aead -m transport -s "100 500 1000"
-dccp6_ipsec23 dccp_ipsec.sh -6 -A rfc4543_192 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec24 dccp_ipsec.sh -6 -A rfc4543_256 -p esp_aead -m transport -s "100 500 1000"
-dccp6_ipsec25 dccp_ipsec.sh -6 -A rfc4543_256 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec26 dccp_ipsec.sh -6 -p esp -a sha1 -e cast5 -m transport -s "100 500 1000"
-dccp6_ipsec27 dccp_ipsec.sh -6 -p esp -a sha1 -e cast5 -m tunnel -s "100 500 1000"
-dccp6_ipsec28 dccp_ipsec.sh -6 -p esp -a sha256 -e blowfish -m transport -s "100 500 1000"
-dccp6_ipsec29 dccp_ipsec.sh -6 -p esp -a sha256 -e blowfish -m tunnel -s "100 500 1000"
-dccp6_ipsec30 dccp_ipsec.sh -6 -p esp -a sha384 -e twofish -m transport -s "100 500 1000"
-dccp6_ipsec31 dccp_ipsec.sh -6 -p esp -a sha384 -e twofish -m tunnel -s "100 500 1000"
-dccp6_ipsec32 dccp_ipsec.sh -6 -p esp -a sha512 -e camellia -m transport -s "100 500 1000"
-dccp6_ipsec33 dccp_ipsec.sh -6 -p esp -a sha512 -e camellia -m tunnel -s "100 500 1000"
-dccp6_ipsec34 dccp_ipsec.sh -6 -p esp -a rmd160 -e serpent -m transport -s "100 500 1000"
-dccp6_ipsec35 dccp_ipsec.sh -6 -p esp -a rmd160 -e serpent -m tunnel -s "100 500 1000"
-dccp6_ipsec36 dccp_ipsec.sh -6 -p esp -m beet -s "100 500 1000"
+dccp6_ipsec01 dccp_ipsec.sh -6 -s 100:500:1000
+dccp6_ipsec02 dccp_ipsec.sh -6 -p ah -m transport -s 100:500:1000
+dccp6_ipsec03 dccp_ipsec.sh -6 -p ah -m tunnel -s 100:500:1000
+dccp6_ipsec04 dccp_ipsec.sh -6 -p esp -m transport -s 100:500:1000
+dccp6_ipsec05 dccp_ipsec.sh -6 -p esp -m tunnel -s 100:500:1000
+dccp6_ipsec06 dccp_ipsec.sh -6 -p comp -m transport -s 100:500:1000
+dccp6_ipsec07 dccp_ipsec.sh -6 -p comp -m tunnel -s 100:500:1000
+dccp6_ipsec08 dccp_ipsec.sh -6 -A rfc4106_128 -p esp_aead -m transport -s 100:500:1000
+dccp6_ipsec09 dccp_ipsec.sh -6 -A rfc4106_128 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec10 dccp_ipsec.sh -6 -A rfc4106_192 -p esp_aead -m transport -s 100:500:1000
+dccp6_ipsec11 dccp_ipsec.sh -6 -A rfc4106_192 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec12 dccp_ipsec.sh -6 -A rfc4106_256 -p esp_aead -m transport -s 100:500:1000
+dccp6_ipsec13 dccp_ipsec.sh -6 -A rfc4106_256 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec14 dccp_ipsec.sh -6 -A rfc4309_128 -p esp_aead -m transport -s 100:500:1000
+dccp6_ipsec15 dccp_ipsec.sh -6 -A rfc4309_128 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec16 dccp_ipsec.sh -6 -A rfc4309_192 -p esp_aead -m transport -s 100:500:1000
+dccp6_ipsec17 dccp_ipsec.sh -6 -A rfc4309_192 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec18 dccp_ipsec.sh -6 -A rfc4309_256 -p esp_aead -m transport -s 100:500:1000
+dccp6_ipsec19 dccp_ipsec.sh -6 -A rfc4309_256 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec20 dccp_ipsec.sh -6 -A rfc4543_128 -p esp_aead -m transport -s 100:500:1000
+dccp6_ipsec21 dccp_ipsec.sh -6 -A rfc4543_128 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec22 dccp_ipsec.sh -6 -A rfc4543_192 -p esp_aead -m transport -s 100:500:1000
+dccp6_ipsec23 dccp_ipsec.sh -6 -A rfc4543_192 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec24 dccp_ipsec.sh -6 -A rfc4543_256 -p esp_aead -m transport -s 100:500:1000
+dccp6_ipsec25 dccp_ipsec.sh -6 -A rfc4543_256 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec26 dccp_ipsec.sh -6 -p esp -a sha1 -e cast5 -m transport -s 100:500:1000
+dccp6_ipsec27 dccp_ipsec.sh -6 -p esp -a sha1 -e cast5 -m tunnel -s 100:500:1000
+dccp6_ipsec28 dccp_ipsec.sh -6 -p esp -a sha256 -e blowfish -m transport -s 100:500:1000
+dccp6_ipsec29 dccp_ipsec.sh -6 -p esp -a sha256 -e blowfish -m tunnel -s 100:500:1000
+dccp6_ipsec30 dccp_ipsec.sh -6 -p esp -a sha384 -e twofish -m transport -s 100:500:1000
+dccp6_ipsec31 dccp_ipsec.sh -6 -p esp -a sha384 -e twofish -m tunnel -s 100:500:1000
+dccp6_ipsec32 dccp_ipsec.sh -6 -p esp -a sha512 -e camellia -m transport -s 100:500:1000
+dccp6_ipsec33 dccp_ipsec.sh -6 -p esp -a sha512 -e camellia -m tunnel -s 100:500:1000
+dccp6_ipsec34 dccp_ipsec.sh -6 -p esp -a rmd160 -e serpent -m transport -s 100:500:1000
+dccp6_ipsec35 dccp_ipsec.sh -6 -p esp -a rmd160 -e serpent -m tunnel -s 100:500:1000
+dccp6_ipsec36 dccp_ipsec.sh -6 -p esp -m beet -s 100:500:1000
 
-dccp4_ipsec_vti01 dccp_ipsec_vti.sh -p ah -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti02 dccp_ipsec_vti.sh -p esp -m tunnel -s "100 500 1000"
-# dccp4_ipsec_vti03 dccp_ipsec_vti.sh -p comp -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti04 dccp_ipsec_vti.sh -A rfc4106_128 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti05 dccp_ipsec_vti.sh -A rfc4106_192 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti06 dccp_ipsec_vti.sh -A rfc4106_256 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti07 dccp_ipsec_vti.sh -A rfc4309_128 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti08 dccp_ipsec_vti.sh -A rfc4309_192 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti09 dccp_ipsec_vti.sh -A rfc4309_256 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti10 dccp_ipsec_vti.sh -A rfc4543_128 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti11 dccp_ipsec_vti.sh -A rfc4543_192 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti12 dccp_ipsec_vti.sh -A rfc4543_256 -p esp_aead -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti13 dccp_ipsec_vti.sh -p esp -a sha1 -e cast5 -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti14 dccp_ipsec_vti.sh -p esp -a sha256 -e blowfish -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti15 dccp_ipsec_vti.sh -p esp -a sha384 -e twofish -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti16 dccp_ipsec_vti.sh -p esp -a sha512 -e camellia -m tunnel -s "100 500 1000"
-dccp4_ipsec_vti17 dccp_ipsec_vti.sh -p esp -a rmd160 -e serpent -m tunnel -s "100 500 1000"
+dccp4_ipsec_vti01 dccp_ipsec_vti.sh -p ah -m tunnel -s 100:500:1000
+dccp4_ipsec_vti02 dccp_ipsec_vti.sh -p esp -m tunnel -s 100:500:1000
+# dccp4_ipsec_vti03 dccp_ipsec_vti.sh -p comp -m tunnel -s 100:500:1000
+dccp4_ipsec_vti04 dccp_ipsec_vti.sh -A rfc4106_128 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec_vti05 dccp_ipsec_vti.sh -A rfc4106_192 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec_vti06 dccp_ipsec_vti.sh -A rfc4106_256 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec_vti07 dccp_ipsec_vti.sh -A rfc4309_128 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec_vti08 dccp_ipsec_vti.sh -A rfc4309_192 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec_vti09 dccp_ipsec_vti.sh -A rfc4309_256 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec_vti10 dccp_ipsec_vti.sh -A rfc4543_128 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec_vti11 dccp_ipsec_vti.sh -A rfc4543_192 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec_vti12 dccp_ipsec_vti.sh -A rfc4543_256 -p esp_aead -m tunnel -s 100:500:1000
+dccp4_ipsec_vti13 dccp_ipsec_vti.sh -p esp -a sha1 -e cast5 -m tunnel -s 100:500:1000
+dccp4_ipsec_vti14 dccp_ipsec_vti.sh -p esp -a sha256 -e blowfish -m tunnel -s 100:500:1000
+dccp4_ipsec_vti15 dccp_ipsec_vti.sh -p esp -a sha384 -e twofish -m tunnel -s 100:500:1000
+dccp4_ipsec_vti16 dccp_ipsec_vti.sh -p esp -a sha512 -e camellia -m tunnel -s 100:500:1000
+dccp4_ipsec_vti17 dccp_ipsec_vti.sh -p esp -a rmd160 -e serpent -m tunnel -s 100:500:1000
 
-dccp6_ipsec_vti01 dccp_ipsec_vti.sh -6 -p ah -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti02 dccp_ipsec_vti.sh -6 -p esp -m tunnel -s "100 500 1000"
-# dccp6_ipsec_vti03 dccp_ipsec_vti.sh -6 -p comp -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti04 dccp_ipsec_vti.sh -6 -A rfc4106_128 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti05 dccp_ipsec_vti.sh -6 -A rfc4106_192 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti06 dccp_ipsec_vti.sh -6 -A rfc4106_256 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti07 dccp_ipsec_vti.sh -6 -A rfc4309_128 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti08 dccp_ipsec_vti.sh -6 -A rfc4309_192 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti09 dccp_ipsec_vti.sh -6 -A rfc4309_256 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti10 dccp_ipsec_vti.sh -6 -A rfc4543_128 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti11 dccp_ipsec_vti.sh -6 -A rfc4543_192 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti12 dccp_ipsec_vti.sh -6 -A rfc4543_256 -p esp_aead -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti13 dccp_ipsec_vti.sh -6 -p esp -a sha1 -e cast5 -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti14 dccp_ipsec_vti.sh -6 -p esp -a sha256 -e blowfish -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti15 dccp_ipsec_vti.sh -6 -p esp -a sha384 -e twofish -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti16 dccp_ipsec_vti.sh -6 -p esp -a sha512 -e camellia -m tunnel -s "100 500 1000"
-dccp6_ipsec_vti17 dccp_ipsec_vti.sh -6 -p esp -a rmd160 -e serpent -m tunnel -s "100 500 1000"
+dccp6_ipsec_vti01 dccp_ipsec_vti.sh -6 -p ah -m tunnel -s 100:500:1000
+dccp6_ipsec_vti02 dccp_ipsec_vti.sh -6 -p esp -m tunnel -s 100:500:1000
+# dccp6_ipsec_vti03 dccp_ipsec_vti.sh -6 -p comp -m tunnel -s 100:500:1000
+dccp6_ipsec_vti04 dccp_ipsec_vti.sh -6 -A rfc4106_128 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec_vti05 dccp_ipsec_vti.sh -6 -A rfc4106_192 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec_vti06 dccp_ipsec_vti.sh -6 -A rfc4106_256 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec_vti07 dccp_ipsec_vti.sh -6 -A rfc4309_128 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec_vti08 dccp_ipsec_vti.sh -6 -A rfc4309_192 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec_vti09 dccp_ipsec_vti.sh -6 -A rfc4309_256 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec_vti10 dccp_ipsec_vti.sh -6 -A rfc4543_128 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec_vti11 dccp_ipsec_vti.sh -6 -A rfc4543_192 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec_vti12 dccp_ipsec_vti.sh -6 -A rfc4543_256 -p esp_aead -m tunnel -s 100:500:1000
+dccp6_ipsec_vti13 dccp_ipsec_vti.sh -6 -p esp -a sha1 -e cast5 -m tunnel -s 100:500:1000
+dccp6_ipsec_vti14 dccp_ipsec_vti.sh -6 -p esp -a sha256 -e blowfish -m tunnel -s 100:500:1000
+dccp6_ipsec_vti15 dccp_ipsec_vti.sh -6 -p esp -a sha384 -e twofish -m tunnel -s 100:500:1000
+dccp6_ipsec_vti16 dccp_ipsec_vti.sh -6 -p esp -a sha512 -e camellia -m tunnel -s 100:500:1000
+dccp6_ipsec_vti17 dccp_ipsec_vti.sh -6 -p esp -a rmd160 -e serpent -m tunnel -s 100:500:1000
runtest/net_stress.ipsec_icmp +84 -84

177 lines not on this page · raw message

runtest/net_stress.ipsec_sctp +106 -106

215 lines not on this page · raw message

runtest/net_stress.ipsec_tcp +106 -106

215 lines not on this page · raw message

runtest/net_stress.ipsec_udp +104 -104

213 lines not on this page · raw message

testcases/network/stress/ipsec/ipsec_lib.sh +10 -2
index 9c293ca3e..afa7c7c75 100644
@@ -30,7 +30,7 @@ AALGO="sha1"
 CALGO="deflate"
 
 IPSEC_REQUESTS="500"
-IPSEC_SIZE_ARRAY="${IPSEC_SIZE_ARRAY:-10 100 1000 2000 10000 65000}"
+IPSEC_SIZE_ARRAY="${IPSEC_SIZE_ARRAY:-10:100:1000:2000:10000:65000}"
 
 ipsec_lib_parse_args()
 {
@@ -41,7 +41,7 @@ ipsec_lib_parse_args()
 		echo "l n      n is the number of test link when tests run"
 		echo "m x      x is ipsec mode, could be transport / tunnel"
 		echo "p x      x is ipsec protocol, could be ah / esp / comp"
-		echo "s x      x is icmp message size array"
+		echo "s x      x is icmp message size array (items separated by ':')"
 		echo "S n      n is IPsec SPI value"
 		echo "k x      key for vti interface"
 		echo "A x      Authenticated encryption with associated data algorithm"
@@ -65,6 +65,14 @@ ipsec_lib_parse_args()
 	r) IPSEC_REQUESTS="$2" ;;
 	*) tst_brkm TBROK "unknown option: $1" ;;
 	esac
+
+	local IFS=":"
+	local tmp="$IPSEC_SIZE_ARRAY"
+	local p
+	for p in $IPSEC_SIZE_ARRAY; do
+		tmp="$p "
+	done
+	IPSEC_SIZE_ARRAY="$tmp"
 }
 
 TST_OPTS="hl:m:p:s:S:k:A:e:a:c:r:"
Signature · 1 line
2.17.1
author
#6 lore raw

PATCH 5/6 net/{stress, virt}: Use SPDX-License-Identifier GPL-2.0-or-later

In reply to Petr Vorel

to save space
+ add author in few cases.

---
 testcases/lib/tst_net.sh                      | 17 +----------------
 testcases/network/stress/dccp/dccp_ipsec.sh   | 15 +--------------
 .../network/stress/dccp/dccp_ipsec_vti.sh     | 15 +--------------
 .../network/stress/icmp/icmp-uni-basic.sh     | 18 ++----------------
 testcases/network/stress/icmp/icmp-uni-vti.sh | 15 +--------------
 testcases/network/stress/ipsec/ipsec_lib.sh   | 19 ++-----------------
 testcases/network/stress/sctp/sctp_ipsec.sh   | 15 +--------------
 .../network/stress/sctp/sctp_ipsec_vti.sh     | 15 +--------------
 testcases/network/stress/tcp/tcp_ipsec.sh     | 15 +--------------
 testcases/network/stress/tcp/tcp_ipsec_vti.sh | 15 +--------------
 testcases/network/stress/udp/udp_ipsec.sh     | 15 +--------------
 testcases/network/stress/udp/udp_ipsec_vti.sh | 15 +--------------
 testcases/network/virt/geneve01.sh            | 15 +--------------
 testcases/network/virt/gre01.sh               | 15 +--------------
 testcases/network/virt/ipvlan01.sh            | 15 +--------------
 testcases/network/virt/macsec01.sh            | 15 ++-------------
 testcases/network/virt/macsec02.sh            | 15 ++-------------
 testcases/network/virt/macvlan01.sh           | 15 +--------------
 testcases/network/virt/macvtap01.sh           | 15 +--------------
 testcases/network/virt/virt_lib.sh            | 16 +---------------
 testcases/network/virt/vlan01.sh              | 16 +---------------
 testcases/network/virt/vlan02.sh              | 16 +---------------
 testcases/network/virt/vlan03.sh              | 15 +--------------
 testcases/network/virt/vxlan01.sh             | 16 +---------------
 testcases/network/virt/vxlan02.sh             | 16 +---------------
 testcases/network/virt/vxlan03.sh             | 15 +--------------
 26 files changed, 30 insertions(+), 374 deletions(-)
testcases/lib/tst_net.sh +1 -16
index ac61dfab8..bfa43e5b0 100644
@@ -1,23 +1,8 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
 # Copyright (c) 2016-2018 Petr Vorel <[email protected]>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write the Free Software Foundation,
-# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
 # Author: Alexey Kodanev <[email protected]>
-#
 
 # Blank for an IPV4 test; 6 for an IPV6 test.
 TST_IPV6=${TST_IPV6:-}
testcases/network/stress/dccp/dccp_ipsec.sh +1 -14
index 624f8e0af..d1afd4569 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 
 TCID=dccp_ipsec
testcases/network/stress/dccp/dccp_ipsec_vti.sh +1 -14
index 878f88ccf..f5ff1029d 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 
 TCID=dccp_ipsec_vti
testcases/network/stress/icmp/icmp-uni-basic.sh +2 -16
index 3099b6caa..b168a821c 100755
@@ -1,23 +1,9 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2016 Red Hat Inc.,  All Rights Reserved.
 # Copyright (c) International Business Machines  Corp., 2005
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Hangbin Liu <[email protected]>
-#
-################################################################################
+
 TCID=${TCID:-icmp-uni-basic}
 TST_TOTAL=1
 TST_COUNT=1
testcases/network/stress/icmp/icmp-uni-vti.sh +1 -14
index ea8b5c828..9a7fba59f 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 
 TCID=icmp-uni-vti
testcases/network/stress/ipsec/ipsec_lib.sh +2 -17
index afa7c7c75..e851d46e4 100644
@@ -1,24 +1,9 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2016 Red Hat Inc.,  All Rights Reserved.
 # Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) 2018 Petr Vorel <[email protected]>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Hangbin Liu <[email protected]>
-#
-#######################################################################
 
 # Authenticated encryption with associated data
 AEALGO="rfc4106_128"
testcases/network/stress/sctp/sctp_ipsec.sh +1 -14
index 5f99bc7df..ee9018f01 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 
 TCID=sctp_ipsec
testcases/network/stress/sctp/sctp_ipsec_vti.sh +1 -14
index 3fa3a738b..ed851475a 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 
 TCID=sctp_ipsec_vti
testcases/network/stress/tcp/tcp_ipsec.sh +1 -14
index 86f455532..0f875948c 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 
 TCID=tcp_ipsec
testcases/network/stress/tcp/tcp_ipsec_vti.sh +1 -14
index a793ef63c..13a67d3bb 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 
 TCID=tcp_ipsec_vti
testcases/network/stress/udp/udp_ipsec.sh +1 -14
index 9b5ac07b2..9c46fc6c0 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 
 TCID=udp_ipsec
testcases/network/stress/udp/udp_ipsec_vti.sh +1 -14
index 36a50bb3d..1b138afb6 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 
 TCID=udp_ipsec_vti
testcases/network/virt/geneve01.sh +1 -14
index 1385604d3..91d03883d 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2016-2017 Oracle and/or its affiliates.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 
 TCID=geneve01
testcases/network/virt/gre01.sh +1 -14
index 4da396986..efb78a940 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015-2017 Oracle and/or its affiliates.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 #
 # It requires remote host. Test will setup IPv4 and IPv6 virtual
testcases/network/virt/ipvlan01.sh +1 -14
index 36b07f027..426b2cb6b 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create and then delete ipvlan
testcases/network/virt/macsec01.sh +2 -13
index 52d6f071a..cf038e7ca 100755
@@ -1,18 +1,7 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Author: Alexey Kodanev <[email protected]>
 #
 # Test-case: setup two MACsec drivers and run TCP traffic over them
 # with default MACsec configuration, compare performance with similar
testcases/network/virt/macsec02.sh +2 -13
index 617860d41..63c035e44 100755
@@ -1,18 +1,7 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Author: Alexey Kodanev <[email protected]>
 #
 # Test-case: setup two MACsec drivers and run TCP traffic over them
 # with enabled frame encryption and replay protection, compare
testcases/network/virt/macvlan01.sh +1 -14
index cafca75e2..f37851f50 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create and then delete macvlan
testcases/network/virt/macvtap01.sh +1 -14
index 7b90213a1..21fd96777 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create and then delete macvtap
testcases/network/virt/virt_lib.sh +1 -15
index 7579907ff..eaec33d8f 100644
@@ -1,20 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) 2018 Petr Vorel <[email protected]>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 #
 # VxLAN
testcases/network/virt/vlan01.sh +1 -15
index 5ac412b32..4dceae82f 100755
@@ -1,23 +1,9 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create multiple VLAN interfaces.
-#
 
 TCID=vlan01
 TST_TOTAL=9
testcases/network/virt/vlan02.sh +1 -15
index 748f9c44c..2b84a7cd0 100755
@@ -1,24 +1,10 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create and then delete VLAN
 # interface 4095 times.
-#
 
 TCID=vlan02
 TST_TOTAL=1
testcases/network/virt/vlan03.sh +1 -14
index 7a8f74295..33bfaf84c 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015-2017 Oracle and/or its affiliates.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 #
 # Test-case 1: It requires remote host. Test will setup IPv4 and IPv6 virtual
testcases/network/virt/vxlan01.sh +1 -15
index 6195b00b3..49bcb942a 100755
@@ -1,23 +1,9 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2014-2015 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create multiple VXLAN interfaces.
-#
 
 TCID=vxlan01
 TST_TOTAL=5
testcases/network/virt/vxlan02.sh +1 -15
index a93e7802d..dde1dabc8 100755
@@ -1,24 +1,10 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2014-2015 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create and then delete VXLAN
 # interface 5000 times.
-#
 
 TCID=vxlan02
 TST_TOTAL=1
testcases/network/virt/vxlan03.sh +1 -14
index 37a172e4c..d8c533cb3 100755
@@ -1,19 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2014-2017 Oracle and/or its affiliates.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <[email protected]>
 #
 # Test-case 1: It requires remote host. Test will setup IPv4 and IPv6 virtual
Signature · 1 line
2.17.1
author
#7 lore raw

PATCH 6/6 net/{stress, virt}: Migrate tests using virt_lib.sh and ipsec_lib.sh

In reply to Petr Vorel

+ these libraries itself.

It was needed to migrate it all in once, as macsec0{1,2}.sh tests are using both libraries.

This includes:
* Create setup, getopts and helper function for both libraries.
* Using TST_TEST_DATA and TST_TEST_DATA_IFS in many test cases (simplify tests and allow to have more TST_CNT to keep readability of output + required by udp_ipsec.sh and udp_ipsec_vti.sh otherwise it'd need to use getopts to determine type of udp, as passing parameter to tst_run is not not recommended to new API).
* Put code into TST_TESTFUNC functions.
* Move anything based on TST_IPV6 to TST_SETUP setup functions (as TST_IPV6 is not set until setup)

Other changes:
* udp_ipsec{,_vti}.sh: were calling do_test() twice, with parameter. Now they use correctly TST_CNT and no params.
Order of running tests changed. Before first were run udp tests for all items in $IPSEC_SIZE_ARRAY, then all udp_lite tests. Now for each item in $IPSEC_SIZE_ARRAY both udp and udp_lite tests are run.
* gre01.sh: Move back device type setting (changed in 57738337a "network/gre01: fix device type setting").

---
 testcases/network/stress/dccp/dccp_ipsec.sh   |  19 +--
 .../network/stress/dccp/dccp_ipsec_vti.sh     |  19 +--
 .../network/stress/icmp/icmp-uni-basic.sh     |  26 +--
 testcases/network/stress/icmp/icmp-uni-vti.sh |  24 +--
 testcases/network/stress/ipsec/ipsec_lib.sh   | 141 ++++++++--------
 testcases/network/stress/sctp/sctp_ipsec.sh   |  20 +--
 .../network/stress/sctp/sctp_ipsec_vti.sh     |  20 +--
 testcases/network/stress/tcp/tcp_ipsec.sh     |  22 +--
 testcases/network/stress/tcp/tcp_ipsec_vti.sh |  21 +--
 testcases/network/stress/udp/udp_ipsec.sh     |  24 ++-
 testcases/network/stress/udp/udp_ipsec_vti.sh |  24 ++-
 testcases/network/virt/geneve01.sh            |  42 ++---
 testcases/network/virt/gre01.sh               |  34 ++--
 testcases/network/virt/ipvlan01.sh            |  12 +-
 testcases/network/virt/macsec01.sh            |  30 ++--
 testcases/network/virt/macsec02.sh            |  32 ++--
 testcases/network/virt/macvlan01.sh           |  17 +-
 testcases/network/virt/macvtap01.sh           |  17 +-
 testcases/network/virt/virt_lib.sh            | 154 +++++++-----------
 testcases/network/virt/vlan01.sh              |  19 +--
 testcases/network/virt/vlan02.sh              |  12 +-
 testcases/network/virt/vlan03.sh              |  50 +++---
 testcases/network/virt/vxlan01.sh             |  15 +-
 testcases/network/virt/vxlan02.sh             |  15 +-
 testcases/network/virt/vxlan03.sh             |  37 +++--
 25 files changed, 401 insertions(+), 445 deletions(-)
testcases/network/stress/dccp/dccp_ipsec.sh +6 -13
index d1afd4569..ef80bf979 100755
@@ -1,25 +1,18 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=dccp_ipsec
-TST_TOTAL=3
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_SETUP=tst_ipsec_setup
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $(tst_ipaddr rhost) -T dccp -n $p -N $p \
-			-r $IPSEC_REQUESTS
-	done
+	tst_netload -H $(tst_ipaddr rhost) -T dccp -n $2 -N $2 -r $IPSEC_REQUESTS
 }
 
-tst_ipsec_setup
-
-do_test
-
-tst_exit
+tst_run
testcases/network/stress/dccp/dccp_ipsec_vti.sh +6 -13
index f5ff1029d..ee2b0d4ca 100755
@@ -1,25 +1,18 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=dccp_ipsec_vti
-TST_TOTAL=3
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_SETUP=tst_ipsec_setup_vti
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $ip_rmt_tun -T dccp -n $p -N $p \
-			-r $IPSEC_REQUESTS
-	done
+	tst_netload -H $ip_rmt_tun -T dccp -n $2 -N $2 -r $IPSEC_REQUESTS
 }
 
-tst_ipsec_setup_vti
-
-do_test
-
-tst_exit
+tst_run
testcases/network/stress/icmp/icmp-uni-basic.sh +15 -11
index b168a821c..5980b81e5 100755
@@ -1,21 +1,25 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2016 Red Hat Inc.,  All Rights Reserved.
 # Copyright (c) International Business Machines  Corp., 2005
 # Author: Hangbin Liu <[email protected]>
 
-TCID=${TCID:-icmp-uni-basic}
-TST_TOTAL=1
-TST_COUNT=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_SETUP=do_setup
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
-tst_ipsec_setup
-
-PING_MAX="$IPSEC_REQUESTS"
+do_setup()
+{
+	tst_ipsec_setup
+	PING_MAX="$IPSEC_REQUESTS"
+	tst_res TINFO "Sending ICMP messages"
+}
 
-tst_resm TINFO "Sending ICMP messages"
-tst_ping $(tst_iface) $(tst_ipaddr rhost) $IPSEC_SIZE_ARRAY
+do_test()
+{
+	tst_ping $(tst_iface) $(tst_ipaddr rhost) $2
+}
 
-tst_exit
+tst_run
testcases/network/stress/icmp/icmp-uni-vti.sh +12 -12
index 9a7fba59f..24eca177c 100755
@@ -1,24 +1,24 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=icmp-uni-vti
-TST_TOTAL=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_SETUP=do_setup
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
-do_test()
+do_setup()
 {
+	tst_ipsec_setup_vti
 	PING_MAX="$IPSEC_REQUESTS"
-
-	tst_resm TINFO "Sending ICMP messages"
-	tst_ping $tst_vti $ip_rmt_tun $IPSEC_SIZE_ARRAY
+	tst_res TINFO "Sending ICMP messages"
 }
 
-tst_ipsec_setup_vti
-
-do_test
+do_test()
+{
+	tst_ping $tst_vti $ip_rmt_tun $2
+}
 
-tst_exit
+tst_run
testcases/network/stress/ipsec/ipsec_lib.sh +70 -71

227 lines not on this page · raw message

testcases/network/stress/sctp/sctp_ipsec.sh +7 -13
index ee9018f01..8a7b885d9 100755
@@ -1,25 +1,19 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=sctp_ipsec
-TST_TOTAL=3
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_SETUP=tst_ipsec_setup
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $(tst_ipaddr rhost) -T sctp -n $p -N $p \
-			-r $IPSEC_REQUESTS -S $(tst_ipaddr)
-	done
+	tst_netload -H $(tst_ipaddr rhost) -T sctp -n $2 -N $2 \
+		-r $IPSEC_REQUESTS -S $(tst_ipaddr)
 }
 
-tst_ipsec_setup
-
-do_test
-
-tst_exit
+tst_run
testcases/network/stress/sctp/sctp_ipsec_vti.sh +7 -13
index ed851475a..d0f24c727 100755
@@ -1,25 +1,19 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=sctp_ipsec_vti
-TST_TOTAL=3
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_SETUP=tst_ipsec_setup_vti
+TST_CLEANUP=tst_ipsec_cleanup
+TST_TESTFUNC=do_test
 . ipsec_lib.sh
 
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $ip_rmt_tun -T sctp -n $p -N $p \
-			-r $IPSEC_REQUESTS -S $ip_loc_tun
-	done
+	tst_netload -H $ip_rmt_tun -T sctp -n $2 -N $2 -r $IPSEC_REQUESTS \
+		-S $ip_loc_tun
 }
 
-tst_ipsec_setup_vti
-
-do_test
-
-tst_exit
+tst_run
testcases/network/stress/tcp/tcp_ipsec.sh +8 -14
index 0f875948c..d62272db0 100755
@@ -1,27 +1,21 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=tcp_ipsec
-TST_TOTAL=3
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
+TST_TESTFUNC=do_test
+TST_SETUP=tst_ipsec_setup
+TST_CLEANUP=tst_ipsec_cleanup
+. ipsec_lib.sh
 
 max_requests=10
 
-. ipsec_lib.sh
-
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $(tst_ipaddr rhost) -n $p -N $p \
-			-r $IPSEC_REQUESTS -R $max_requests
-	done
+	tst_netload -H $(tst_ipaddr rhost) -n $2 -N $2 -r $IPSEC_REQUESTS \
+		-R $max_requests
 }
 
-tst_ipsec_setup
-
-do_test
-
-tst_exit
+tst_run
testcases/network/stress/tcp/tcp_ipsec_vti.sh +7 -14
index 13a67d3bb..f7bbbc6e9 100755
@@ -1,27 +1,20 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=tcp_ipsec_vti
-TST_TOTAL=3
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
+TST_TESTFUNC=do_test
+TST_SETUP=tst_ipsec_setup_vti
+TST_CLEANUP=tst_ipsec_cleanup
+. ipsec_lib.sh
 
 max_requests=10
 
-. ipsec_lib.sh
-
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $ip_rmt_tun -n $p -N $p \
-			-r $IPSEC_REQUESTS -R $max_requests
-	done
+	tst_netload -H $ip_rmt_tun -n $2 -N $2 -r $IPSEC_REQUESTS -R $max_requests
 }
 
-tst_ipsec_setup_vti
-
-do_test
-
-tst_exit
+tst_run
testcases/network/stress/udp/udp_ipsec.sh +10 -14
index 9c46fc6c0..b59070ebe 100755
@@ -1,26 +1,22 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=udp_ipsec
-TST_TOTAL=6
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_SETUP=tst_ipsec_setup
+TST_CNT=2
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $(tst_ipaddr rhost) -T $1 -n $p -N $p \
-			-r $IPSEC_REQUESTS
-	done
-}
+	local type="udp"
+	[ $1 -eq 2 ] && type="udp_lite"
 
-tst_ipsec_setup
-
-do_test udp
-do_test udp_lite
+	tst_netload -H $(tst_ipaddr rhost) -T $type -n $2 -N $2 -r $IPSEC_REQUESTS
+}
 
-tst_exit
+tst_run
testcases/network/stress/udp/udp_ipsec_vti.sh +10 -14
index 1b138afb6..65b48eaa4 100755
@@ -1,26 +1,22 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=udp_ipsec_vti
-TST_TOTAL=6
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_CNT=2
+TST_SETUP=tst_ipsec_setup_vti
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $ip_rmt_tun -T $1 -n $p -N $p \
-			-r $IPSEC_REQUESTS
-	done
-}
+	local type="udp"
+	[ $1 -eq 2 ] && type="udp_lite"
 
-tst_ipsec_setup_vti
-
-do_test udp
-do_test udp_lite
+	tst_netload -H $ip_rmt_tun -T $type -n $2 -N $2 -r $IPSEC_REQUESTS
+}
 
-tst_exit
+tst_run
testcases/network/virt/geneve01.sh +22 -20

58 lines not on this page · raw message

testcases/network/virt/gre01.sh +21 -13
index efb78a940..3173d1b7c 100755
@@ -1,5 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2015-2017 Oracle and/or its affiliates.
 # Author: Alexey Kodanev <[email protected]>
 #
@@ -7,23 +8,30 @@
 # tunnel between two hosts, then will compare TCP performance
 # with and without GRE using ping or netstress test.
 
-TCID=gre01
-TST_TOTAL=1
 TST_NEEDS_TMPDIR=1
-
-virt_type="gre"
+TST_TESTFUNC=do_test
+TST_SETUP=do_setup
+TST_CLEANUP=virt_cleanup
 . virt_lib.sh
 
-TST_CLEANUP="virt_cleanup"
+do_setup()
+{
+	virt_type="gre"
+	[ "$TST_IPV6" ] && virt_type="ip6gre"
+	virt_lib_setup
+}
 
-if [ -z $ip_local -o -z $ip_remote ]; then
-	tst_brkm TBROK "you must specify IP address"
-fi
+do_test()
+{
+	if [ -z $ip_local -o -z $ip_remote ]; then
+		tst_brk TBROK "you must specify IP address"
+	fi
 
-tst_resm TINFO "test $virt_type"
-virt_setup "local $(tst_ipaddr) remote $(tst_ipaddr rhost) dev $(tst_iface)" \
-"local $(tst_ipaddr rhost) remote $(tst_ipaddr) dev $(tst_iface rhost)"
+	tst_res TINFO "test $virt_type"
+	virt_setup "local $(tst_ipaddr) remote $(tst_ipaddr rhost) dev $(tst_iface)" \
+	"local $(tst_ipaddr rhost) remote $(tst_ipaddr) dev $(tst_iface rhost)"
 
-virt_netperf_msg_sizes
+	virt_netperf_msg_sizes
+}
 
-tst_exit
+tst_run
testcases/network/virt/ipvlan01.sh +5 -7
index 426b2cb6b..f49b5ed75 100755
@@ -1,20 +1,18 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create and then delete ipvlan
 # interface multiple times.
 
-TCID=ipvlan01
-TST_TOTAL=2
+TST_TEST_DATA="mode l2,mode l3"
+TST_TEST_DATA_IFS=","
+TST_TESTFUNC=virt_test_02
 
 virt_type="ipvlan"
 
 . virt_lib.sh
 
-options="mode l2,mode l3"
-
-virt_test_02 "$options"
-
-tst_exit
+tst_run
testcases/network/virt/macsec01.sh +17 -13
index cf038e7ca..3d8815b27 100755
@@ -1,5 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
@@ -7,13 +8,16 @@
 # with default MACsec configuration, compare performance with similar
 # IPsec configuration on master interface.
 
-TCID=macsec01
-TST_TOTAL=16
-TST_NEEDS_TMPDIR=1
-
 virt_type="macsec"
 VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-100}
+IPSEC_MODE="transport"
+IPSEC_PROTO="ah"
 
+TST_NEEDS_TMPDIR=1
+TST_TESTFUNC=do_test
+TST_SETUP=ipsec_lib_setup
+IPSEC_LIB_IGNORE_IPSEC_SIZE_ARRAY=1
+TST_CLEANUP=cleanup
 . ipsec_lib.sh
 . virt_lib.sh
 
@@ -22,15 +26,15 @@ cleanup()
 	virt_cleanup
 	tst_ipsec_cleanup
 }
-TST_CLEANUP="cleanup"
 
-IPSEC_MODE=transport
-IPSEC_PROTO=ah
-tst_resm TINFO "setup IPsec $IPSEC_MODE/$IPSEC_PROTO $EALGO"
-tst_ipsec lhost $(tst_ipaddr) $(tst_ipaddr rhost)
-tst_ipsec rhost $(tst_ipaddr rhost) $(tst_ipaddr)
+do_test()
+{
+	tst_res TINFO "setup IPsec $IPSEC_MODE/$IPSEC_PROTO $EALGO"
+	tst_ipsec lhost $(tst_ipaddr) $(tst_ipaddr rhost)
+	tst_ipsec rhost $(tst_ipaddr rhost) $(tst_ipaddr)
 
-virt_macsec_setup
-virt_netperf_msg_sizes
+	virt_macsec_setup
+	virt_netperf_msg_sizes
+}
 
-tst_exit
+tst_run
testcases/network/virt/macsec02.sh +18 -14
index 63c035e44..ba8c38654 100755
@@ -1,5 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
@@ -7,13 +8,17 @@
 # with enabled frame encryption and replay protection, compare
 # performance with similar IPsec configuration on master interface.
 
-TCID=macsec02
-TST_TOTAL=16
-TST_NEEDS_TMPDIR=1
-
 virt_type="macsec"
 VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-100}
+IPSEC_MODE="transport"
+IPSEC_PROTO="esp_aead"
+EALGO="aes"
 
+TST_NEEDS_TMPDIR=1
+TST_TESTFUNC=do_test
+TST_SETUP=ipsec_lib_setup
+IPSEC_LIB_IGNORE_IPSEC_SIZE_ARRAY=1
+TST_CLEANUP=cleanup
 . ipsec_lib.sh
 . virt_lib.sh
 
@@ -22,16 +27,15 @@ cleanup()
 	virt_cleanup
 	tst_ipsec_cleanup
 }
-TST_CLEANUP="cleanup"
 
-IPSEC_MODE=transport
-IPSEC_PROTO=esp_aead
-EALGO=aes
-tst_resm TINFO "setup IPsec $IPSEC_MODE/$IPSEC_PROTO $EALGO"
-tst_ipsec lhost $(tst_ipaddr) $(tst_ipaddr rhost)
-tst_ipsec rhost $(tst_ipaddr rhost) $(tst_ipaddr)
+do_test()
+{
+	tst_res TINFO "setup IPsec $IPSEC_MODE/$IPSEC_PROTO $EALGO"
+	tst_ipsec lhost $(tst_ipaddr) $(tst_ipaddr rhost)
+	tst_ipsec rhost $(tst_ipaddr rhost) $(tst_ipaddr)
 
-virt_macsec_setup "replay on window 300 encrypt on protect on"
-virt_netperf_msg_sizes
+	virt_macsec_setup "replay on window 300 encrypt on protect on"
+	virt_netperf_msg_sizes
+}
 
-tst_exit
+tst_run
testcases/network/virt/macvlan01.sh +9 -8
index f37851f50..e739fae97 100755
@@ -1,20 +1,21 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create and then delete macvlan
 # interface multiple times.
 
-TCID=macvlan01
-TST_TOTAL=4
-
 virt_type="macvlan"
-
-. virt_lib.sh
-
 options="mode private,mode vepa,mode bridge,mode passthru"
+TST_CNT=4
+TST_TESTFUNC=do_test
+. virt_lib.sh
 
-virt_test_02 "$options"
+do_test()
+{
+	virt_test_02 "$options"
+}
 
-tst_exit
+tst_run
testcases/network/virt/macvtap01.sh +9 -8
index 21fd96777..654cf30bd 100755
@@ -1,20 +1,21 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create and then delete macvtap
 # interface multiple times.
 
-TCID=macvtap01
-TST_TOTAL=4
-
 virt_type="macvtap"
-
-. virt_lib.sh
-
 options="mode private,mode vepa,mode bridge,mode passthru"
+TST_CNT=4
+TST_TESTFUNC=do_test
+. virt_lib.sh
 
-virt_test_02 "$options"
+do_test()
+{
+	virt_test_02 "$options"
+}
 
-tst_exit
+tst_run
testcases/network/virt/virt_lib.sh +62 -92

278 lines not on this page · raw message

testcases/network/virt/vlan01.sh +8 -11
index 4dceae82f..69d2564cb 100755
@@ -1,17 +1,11 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create multiple VLAN interfaces.
 
-TCID=vlan01
-TST_TOTAL=9
-
-virt_type="vlan"
-
-. virt_lib.sh
-
 p0="protocol 802.1Q"
 p1="protocol 802.1ad"
 lb0="loose_binding off"
@@ -19,9 +13,12 @@ lb1="loose_binding on"
 rh0="reorder_hdr off"
 rh1="reorder_hdr on"
 
-options=" ,$p0 $lb0 $rh0,$p0 $lb0 $rh1,$p0 $lb1 $rh0,$p0 $lb1 $rh1,\
-$p1 $lb0 $rh0,$p1 $lb0 $rh1,$p1 $lb1 $rh0,$p1 $lb1 $rh1,"
+virt_type="vlan"
 
-virt_test_01 "$options"
+TST_TEST_DATA=",$p0 $lb0 $rh0,$p0 $lb0 $rh1,$p0 $lb1 $rh0,$p0 $lb1 $rh1,\
+$p1 $lb0 $rh0,$p1 $lb0 $rh1,$p1 $lb1 $rh0,$p1 $lb1 $rh1"
+TST_TEST_DATA_IFS=","
+TST_TESTFUNC=virt_test_01
+. virt_lib.sh
 
-tst_exit
+tst_run
testcases/network/virt/vlan02.sh +7 -5
index 2b84a7cd0..04a8a5c60 100755
@@ -1,18 +1,20 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create and then delete VLAN
 # interface 4095 times.
 
-TCID=vlan02
-TST_TOTAL=1
-
 virt_type="vlan"
 
+TST_TESTFUNC=do_test
 . virt_lib.sh
 
-virt_add_delete_test "id 4094"
+do_test()
+{
+	virt_add_delete_test "id 4094"
+}
 
-tst_exit
+tst_run
testcases/network/virt/vlan03.sh +26 -24

74 lines not on this page · raw message

testcases/network/virt/vxlan01.sh +10 -5
index 49bcb942a..027fc6f45 100755
@@ -1,23 +1,28 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2014-2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create multiple VXLAN interfaces.
 
 TCID=vxlan01
-TST_TOTAL=5
 TST_OPTS="hi:d:"
 TST_PARSE_ARGS=virt_lib_parse_args
+TST_USAGE=virt_lib_usage
 
 virt_type="vxlan"
 start_id=16700000
 
-. virt_lib.sh
-
 options="l2miss l3miss,norsc nolearning noproxy,\
 ttl 0x01 tos 0x01,ttl 0xff tos 0xff,gbp"
+TST_CNT=5
+TST_TESTFUNC=do_test
+. virt_lib.sh
 
-virt_test_01 "$options"
+do_test()
+{
+	virt_test_01 "$options"
+}
 
-tst_exit
+tst_run
testcases/network/virt/vxlan02.sh +10 -5
index dde1dabc8..24e5c4dfb 100755
@@ -1,5 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2014-2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
@@ -7,18 +8,22 @@
 # interface 5000 times.
 
 TCID=vxlan02
-TST_TOTAL=1
 TST_OPTS="hi:d:"
 TST_PARSE_ARGS=virt_lib_parse_args
+TST_USAGE=virt_lib_usage
 
 virt_type="vxlan"
 start_id=16700000
 
+TST_TESTFUNC=do_test
 . virt_lib.sh
 
-[ "$TST_IPV6" ] && mult_addr="ff02::abc" || mult_addr="239.1.1.1"
-opt="group $mult_addr"
+do_test()
+{
+	local mult_addr="239.1.1.1"
+	[ "$TST_IPV6" ] && mult_addr="ff02::abc"
 
-virt_add_delete_test "id $start_id $opt"
+	virt_add_delete_test "id $start_id group $mult_addr"
+}
 
-tst_exit
+tst_run
testcases/network/virt/vxlan03.sh +19 -18
index d8c533cb3..521953f73 100755
@@ -1,5 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2014-2017 Oracle and/or its affiliates.
 # Author: Alexey Kodanev <[email protected]>
 #
@@ -11,10 +12,10 @@
 #              to communicate only within the same VXLAN segment.
 
 TCID=vxlan03
-TST_TOTAL=4
 TST_NEEDS_TMPDIR=1
 TST_OPTS="hi:d:"
 TST_PARSE_ARGS=virt_lib_parse_args
+TST_USAGE=virt_lib_usage
 
 virt_type="vxlan"
 start_id=16700000
@@ -22,6 +23,11 @@ start_id=16700000
 # Destination address, can be unicast or multicast address
 vxlan_dst_addr="uni"
 
+TST_TEST_DATA=",gbp"
+TST_TEST_DATA_IFS=","
+TST_NEEDS_TMPDIR=1
+TST_TESTFUNC=do_test
+TST_CLEANUP=virt_cleanup
 . virt_lib.sh
 
 # In average cases (with small packets less then 150 bytes) VxLAN slower
@@ -31,30 +37,25 @@ vxlan_dst_addr="uni"
 VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-160}
 [ "$VIRT_PERF_THRESHOLD" -lt 160 ] && VIRT_PERF_THRESHOLD=160
 
-TST_CLEANUP="virt_cleanup"
-
-if [ -z $ip_local -o -z $ip_remote ]; then
-	tst_brkm TBROK "you must specify IP address"
-fi
-
-opts=" ,gbp"
-
-for n in $(seq 1 2); do
-	p="$(echo $opts | cut -d',' -f$n)"
+do_test()
+{
+	if [ -z $ip_local -o -z $ip_remote ]; then
+		tst_brk TBROK "you must specify IP address"
+	fi
 
-	virt_check_cmd virt_add ltp_v0 id 0 $p || continue
+	virt_check_cmd virt_add ltp_v0 id 0 $2 || continue
 
-	tst_resm TINFO "the same VNI must work"
+	tst_res TINFO "the same VNI must work"
 	# VNI is 24 bits long, so max value, which is not reserved, is 0xFFFFFE
-	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $p" "id 0xFFFFFE $p"
+	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $2" "id 0xFFFFFE $2"
 	virt_netperf_msg_sizes
 	virt_cleanup_rmt
 
-	tst_resm TINFO "different VNI shall not work together"
-	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $p" "id 0xFFFFFD $p"
+	tst_res TINFO "different VNI shall not work together"
+	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $2" "id 0xFFFFFD $2"
 	virt_minimize_timeout
 	virt_compare_netperf "fail"
 	virt_cleanup_rmt
-done
+}
 
-tst_exit
+tst_run
Signature · 1 line
2.17.1
#8 lore raw

PATCH 6/6 net/{stress, virt}: Migrate tests using virt_lib.sh and ipsec_lib.sh

Quoted 16 lines · Petr Vorel

+ these libraries itself.

It was needed to migrate it all in once, as macsec0{1,2}.sh tests are using both libraries.

This includes:
* Create setup, getopts and helper function for both libraries.
* Using TST_TEST_DATA and TST_TEST_DATA_IFS in many test cases (simplify tests and allow to have more TST_CNT to keep readability of output + required by udp_ipsec.sh and udp_ipsec_vti.sh otherwise it'd need to use getopts to determine type of udp, as passing parameter to tst_run is not not recommended to new API).
* Put code into TST_TESTFUNC functions.
* Move anything based on TST_IPV6 to TST_SETUP setup functions (as TST_IPV6 is not set until setup)

Quoted 9 lines

Other changes:
* udp_ipsec{,_vti}.sh: were calling do_test() twice, with parameter. Now they use correctly TST_CNT and no params.
Order of running tests changed. Before first were run udp tests for all items in $IPSEC_SIZE_ARRAY, then all udp_lite tests. Now for each item in $IPSEC_SIZE_ARRAY both udp and udp_lite tests are run.
* gre01.sh: Move back device type setting (changed in 57738337a "network/gre01: fix device type setting").

Hi Petr,

Thanks for the patches, good work! Some comments below.

Quoted 272 lines
---
 testcases/network/stress/dccp/dccp_ipsec.sh   |  19 +--
 .../network/stress/dccp/dccp_ipsec_vti.sh     |  19 +--
 .../network/stress/icmp/icmp-uni-basic.sh     |  26 +--
 testcases/network/stress/icmp/icmp-uni-vti.sh |  24 +--
 testcases/network/stress/ipsec/ipsec_lib.sh   | 141 ++++++++--------
 testcases/network/stress/sctp/sctp_ipsec.sh   |  20 +--
 .../network/stress/sctp/sctp_ipsec_vti.sh     |  20 +--
 testcases/network/stress/tcp/tcp_ipsec.sh     |  22 +--
 testcases/network/stress/tcp/tcp_ipsec_vti.sh |  21 +--
 testcases/network/stress/udp/udp_ipsec.sh     |  24 ++-
 testcases/network/stress/udp/udp_ipsec_vti.sh |  24 ++-
 testcases/network/virt/geneve01.sh            |  42 ++---
 testcases/network/virt/gre01.sh               |  34 ++--
 testcases/network/virt/ipvlan01.sh            |  12 +-
 testcases/network/virt/macsec01.sh            |  30 ++--
 testcases/network/virt/macsec02.sh            |  32 ++--
 testcases/network/virt/macvlan01.sh           |  17 +-
 testcases/network/virt/macvtap01.sh           |  17 +-
 testcases/network/virt/virt_lib.sh            | 154 +++++++-----------
 testcases/network/virt/vlan01.sh              |  19 +--
 testcases/network/virt/vlan02.sh              |  12 +-
 testcases/network/virt/vlan03.sh              |  50 +++---
 testcases/network/virt/vxlan01.sh             |  15 +-
 testcases/network/virt/vxlan02.sh             |  15 +-
 testcases/network/virt/vxlan03.sh             |  37 +++--
 25 files changed, 401 insertions(+), 445 deletions(-)
testcases/network/stress/dccp/dccp_ipsec.sh +6 -13
index d1afd4569..ef80bf979 100755
@@ -1,25 +1,18 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=dccp_ipsec
-TST_TOTAL=3
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_SETUP=tst_ipsec_setup
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $(tst_ipaddr rhost) -T dccp -n $p -N $p \
-			-r $IPSEC_REQUESTS
-	done
+	tst_netload -H $(tst_ipaddr rhost) -T dccp -n $2 -N $2 -r $IPSEC_REQUESTS
 }
 
-tst_ipsec_setup
-
-do_test
-
-tst_exit
+tst_run
testcases/network/stress/dccp/dccp_ipsec_vti.sh +6 -13
index f5ff1029d..ee2b0d4ca 100755
@@ -1,25 +1,18 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=dccp_ipsec_vti
-TST_TOTAL=3
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_SETUP=tst_ipsec_setup_vti
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $ip_rmt_tun -T dccp -n $p -N $p \
-			-r $IPSEC_REQUESTS
-	done
+	tst_netload -H $ip_rmt_tun -T dccp -n $2 -N $2 -r $IPSEC_REQUESTS
 }
 
-tst_ipsec_setup_vti
-
-do_test
-
-tst_exit
+tst_run
testcases/network/stress/icmp/icmp-uni-basic.sh +15 -11
index b168a821c..5980b81e5 100755
@@ -1,21 +1,25 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2016 Red Hat Inc.,  All Rights Reserved.
 # Copyright (c) International Business Machines  Corp., 2005
 # Author: Hangbin Liu <[email protected]>
 
-TCID=${TCID:-icmp-uni-basic}
-TST_TOTAL=1
-TST_COUNT=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_SETUP=do_setup
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
-tst_ipsec_setup
-
-PING_MAX="$IPSEC_REQUESTS"
+do_setup()
+{
+	tst_ipsec_setup
+	PING_MAX="$IPSEC_REQUESTS"
+	tst_res TINFO "Sending ICMP messages"
+}
 
-tst_resm TINFO "Sending ICMP messages"
-tst_ping $(tst_iface) $(tst_ipaddr rhost) $IPSEC_SIZE_ARRAY
+do_test()
+{
+	tst_ping $(tst_iface) $(tst_ipaddr rhost) $2
+}
 
-tst_exit
+tst_run
testcases/network/stress/icmp/icmp-uni-vti.sh +12 -12
index 9a7fba59f..24eca177c 100755
@@ -1,24 +1,24 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=icmp-uni-vti
-TST_TOTAL=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_SETUP=do_setup
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
-do_test()
+do_setup()
 {
+	tst_ipsec_setup_vti
 	PING_MAX="$IPSEC_REQUESTS"
-
-	tst_resm TINFO "Sending ICMP messages"
-	tst_ping $tst_vti $ip_rmt_tun $IPSEC_SIZE_ARRAY
+	tst_res TINFO "Sending ICMP messages"
 }
 
-tst_ipsec_setup_vti
-
-do_test
+do_test()
+{
+	tst_ping $tst_vti $ip_rmt_tun $2
+}
 
-tst_exit
+tst_run
testcases/network/stress/ipsec/ipsec_lib.sh +50 -19
index e851d46e4..6112862ae 100644
@@ -17,26 +17,24 @@ CALGO="deflate"
 IPSEC_REQUESTS="500"
 IPSEC_SIZE_ARRAY="${IPSEC_SIZE_ARRAY:-10:100:1000:2000:10000:65000}"
 
+ipsec_lib_usage()
+{
+	echo "l n     n is the number of test link when tests run"
+	echo "m x     x is ipsec mode, could be transport / tunnel"
+	echo "p x     x is ipsec protocol, could be ah / esp / comp"
+	echo "s x     x is icmp message size array"
+	echo "S n     n is IPsec SPI value"
+	echo "k x     key for vti interface"
+	echo "A x     Authenticated encryption with associated data algorithm"
+	echo "e x     Encryption algorithm"
+	echo "a x     Authentication algorithm"
+	echo "c x     Compression algorithm"
+	echo "r x     Num of requests, PING_MAX or netstress' '-r' opt"
+}
+
 ipsec_lib_parse_args()
 {
 	case "$1" in
-	h)
-		echo "Usage:"
-		echo "h        help"
-		echo "l n      n is the number of test link when tests run"
-		echo "m x      x is ipsec mode, could be transport / tunnel"
-		echo "p x      x is ipsec protocol, could be ah / esp / comp"
-		echo "s x      x is icmp message size array (items separated by ':')"
-		echo "S n      n is IPsec SPI value"
-		echo "k x      key for vti interface"
-		echo "A x      Authenticated encryption with associated data algorithm"
-		echo "e x      Encryption algorithm"
-		echo "a x      Authentication algorithm"
-		echo "c x      Compression algorithm"
-		echo "r x      Num of requests, PING_MAX or netstress' '-r' opt"
-		echo "6        run over IPv6"
-		exit 0
-	;;
 	l) LINK_NUM=$2 ;;
 	m) IPSEC_MODE=$2 ;;
 	p) IPSEC_PROTO=$2 ;;
@@ -48,21 +46,53 @@ ipsec_lib_parse_args()
 	a) AALGO=$2 ;;
 	c) CALGO=$2 ;;
 	r) IPSEC_REQUESTS="$2" ;;
-	*) tst_brkm TBROK "unknown option: $1" ;;
 	esac
+}
+
+ipsec_lib_setup()
+{
+	case $AEALGO in
+	rfc4106_128|rfc4543_128) AEALGO_KEY=$(get_key 160) ;;
+	rfc4106_192|rfc4543_192) AEALGO_KEY=$(get_key 224) ;;
+	rfc4106_256|rfc4543_256) AEALGO_KEY=$(get_key 288) ;;
+	rfc4309_128) AEALGO_KEY=$(get_key 152) ;;
+	rfc4309_192) AEALGO_KEY=$(get_key 216) ;;
+	rfc4309_256) AEALGO_KEY=$(get_key 280) ;;
+	esac
+
+	case $EALGO in
+	des) EALGO_KEY=$(get_key 64) ;;
+	des3_ede) EALGO_KEY=$(get_key 192) ;;
+	cast5) EALGO_KEY=$(get_key 128) ;;
+	blowfish) EALGO_KEY=$(get_key 448) ;;
+	aes|twofish|camellia|serpent) EALGO_KEY=$(get_key 256) ;;
+	*) tst_brk TBROK "unknown enc alg: $EALGO" ;;
+	esac
+
+	case $AALGO in
+	sha1|rmd160) AALGO_KEY=$(get_key 160) ;;
+	sha256) AALGO_KEY=$(get_key 256) ;;
+	sha384) AALGO_KEY=$(get_key 384) ;;
+	sha512) AALGO_KEY=$(get_key 512) ;;
+	*) tst_brk TBROK "unknown auth alg: $AALGO" ;;
+	esac
+
+	SPI=${SPI:-1000}
+	VTI_KEY=${VTI_KEY:-10}
+	cleanup_vti=
+	ALG=
+	ALGR=
 
-	local IFS=":"

testcases/network/stress/ipsec/ipsec_lib.sh ipsec_lib_parse_args() · line 89

Quoted 10 lines
testcases/network/stress/ipsec/ipsec_lib.sh +4 -6
-	local tmp="$IPSEC_SIZE_ARRAY"
-	local p
-	for p in $IPSEC_SIZE_ARRAY; do
-		tmp="$p "
-	done
-	IPSEC_SIZE_ARRAY="$tmp"
+	if [ -z "$IPSEC_LIB_IGNORE_IPSEC_SIZE_ARRAY" ]; then
+		TST_TEST_DATA_IFS=":"
+		TST_TEST_DATA="$IPSEC_SIZE_ARRAY"
+	fi

Could we pass "-s" parameters to TST_TEST_DATA directly? So that we don't need the workaround with "IPSEC_LIB_IGNORE_IPSEC_SIZE_ARRAY"... it seems "-s" is always set for IPsec tests.

Quoted 482 lines
testcases/network/stress/ipsec/ipsec_lib.sh +16 -46
 }
 
-TST_OPTS="hl:m:p:s:S:k:A:e:a:c:r:"
+TST_OPTS="l:m:p:s:S:k:A:e:a:c:r:"
 TST_PARSE_ARGS=ipsec_lib_parse_args
-TST_USE_LEGACY_API=1
+TST_SETUP=${TST_SETUP:-ipsec_lib_setup}
+TST_USAGE=ipsec_lib_usage
 . tst_net.sh
 
 get_key()
@@ -72,43 +102,12 @@ get_key()
 	echo "0x$(hexdump -vn $bytes -e '1/1 "%02x"' /dev/urandom)"
 }
 
-case $AEALGO in
-rfc4106_128|rfc4543_128) AEALGO_KEY=$(get_key 160) ;;
-rfc4106_192|rfc4543_192) AEALGO_KEY=$(get_key 224) ;;
-rfc4106_256|rfc4543_256) AEALGO_KEY=$(get_key 288) ;;
-rfc4309_128) AEALGO_KEY=$(get_key 152) ;;
-rfc4309_192) AEALGO_KEY=$(get_key 216) ;;
-rfc4309_256) AEALGO_KEY=$(get_key 280) ;;
-esac
-
-case $EALGO in
-des) EALGO_KEY=$(get_key 64) ;;
-des3_ede) EALGO_KEY=$(get_key 192) ;;
-cast5) EALGO_KEY=$(get_key 128) ;;
-blowfish) EALGO_KEY=$(get_key 448) ;;
-aes|twofish|camellia|serpent) EALGO_KEY=$(get_key 256) ;;
-*) tst_brkm TBROK "unknown enc alg: $EALGO" ;;
-esac
-
-case $AALGO in
-sha1|rmd160) AALGO_KEY=$(get_key 160) ;;
-sha256) AALGO_KEY=$(get_key 256) ;;
-sha384) AALGO_KEY=$(get_key 384) ;;
-sha512) AALGO_KEY=$(get_key 512) ;;
-*) tst_brkm TBROK "unknown auth alg: $AALGO" ;;
-esac
-
-SPI=${SPI:-1000}
-VTI_KEY=${VTI_KEY:-10}
-cleanup_vti=
-ALG=
-ALGR=
-
 tst_ipsec_setup()
 {
+	ipsec_lib_setup
 	# Configure SAD/SPD
 	if [ -n "$IPSEC_MODE" -a -n "$IPSEC_PROTO" ]; then
-		tst_resm TINFO "IPsec[$IPSEC_PROTO/$IPSEC_MODE]"
+		tst_res TINFO "IPsec[$IPSEC_PROTO/$IPSEC_MODE]"
 		tst_ipsec lhost $(tst_ipaddr) $(tst_ipaddr rhost)
 		tst_ipsec rhost $(tst_ipaddr rhost) $(tst_ipaddr)
 	fi
@@ -125,8 +124,6 @@ tst_ipsec_cleanup()
 		ip li del $cleanup_vti 2>/dev/null
 		tst_rhost_run -c "ip li del $cleanup_vti 2>/dev/null"
 	fi
-
-	[ "$TST_NEEDS_TMPDIR" = 1 ] && tst_rmdir
 }
 
 ipsec_set_algoline()
@@ -161,7 +158,7 @@ ipsec_set_algoline()
 		ALGR=$ALG
 		;;
 	*)
-		tst_brkm TCONF "tst_ipsec protocol mismatch"
+		tst_brk TCONF "tst_ipsec protocol mismatch"
 		;;
 	esac
 }
@@ -173,11 +170,11 @@ ipsec_try()
 	if echo "$output" | grep -q "TERR"; then
 		echo "$output" | grep -q \
 			'RTNETLINK answers: Function not implemented' && \
-			tst_brkm TCONF "'$@': not implemented"
+			tst_brk TCONF "'$@': not implemented"
 		echo "$output" | grep -q \
 			'RTNETLINK answers: Operation not supported' && \
-			tst_brkm TCONF "'$@': not supported (maybe missing 'ip${TST_IPV6}_vti' kernel module)"
-		tst_brkm TBROK "$@ failed: $output"
+			tst_brk TCONF "'$@': not supported (maybe missing 'ip${TST_IPV6}_vti' kernel module)"
+		tst_brk TBROK "$@ failed: $output"
 	fi
 }
 
@@ -189,7 +186,7 @@ ipsec_try()
 tst_ipsec()
 {
 	if [ $# -ne 3 ]; then
-		tst_brkm TCONF "tst_ipsec parameter mismatch"
+		tst_brk TCONF "tst_ipsec parameter mismatch"
 	fi
 
 	local target=$1
@@ -237,7 +234,7 @@ tst_ipsec()
 tst_ipsec_vti()
 {
 	if [ $# -ne 4 ]; then
-		tst_brkm TCONF "tst_ipsec_vti parameter mismatch"
+		tst_brk TCONF "tst_ipsec_vti parameter mismatch"
 	fi
 
 	local target=$1
@@ -255,7 +252,7 @@ tst_ipsec_vti()
 	local rd="dev $(tst_iface rhost)"
 
 	ip li add type vti help 2>&1 | grep -q vti || \
-		tst_brkm TCONF "iproute doesn't support 'vti'"
+		tst_brk TCONF "iproute doesn't support 'vti'"
 
 	ipsec_set_algoline
 
@@ -296,6 +293,8 @@ tst_ipsec_vti()
 #  * ip_rmt_tun - remote IP address
 tst_ipsec_setup_vti()
 {
+	ipsec_lib_setup
+
 	if_loc=$(tst_iface)
 	if_rmt=$(tst_iface rhost)
 
@@ -304,7 +303,7 @@ tst_ipsec_setup_vti()
 
 	tst_vti="ltp_vti0"
 
-	tst_resm TINFO "Test vti$TST_IPV6 + IPsec[$IPSEC_PROTO/$IPSEC_MODE]"
+	tst_res TINFO "Test vti$TST_IPV6 + IPsec[$IPSEC_PROTO/$IPSEC_MODE]"
 
 	tst_ipsec_vti lhost $ip_loc $ip_rmt $tst_vti
 	tst_ipsec_vti rhost $ip_rmt $ip_loc $tst_vti
@@ -322,7 +321,7 @@ tst_ipsec_setup_vti()
 		ROD ip route add ${IPV4_NET16_UNUSED}.1.0/$mask dev $tst_vti
 	fi
 
-	tst_resm TINFO "Add IPs to vti tunnel, " \
+	tst_res TINFO "Add IPs to vti tunnel, " \
 		       "loc: $ip_loc_tun/$mask, rmt: $ip_rmt_tun/$mask"
 
 	ROD ip a add $ip_loc_tun/$mask dev $tst_vti nodad
testcases/network/stress/sctp/sctp_ipsec.sh +7 -13
index ee9018f01..8a7b885d9 100755
@@ -1,25 +1,19 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=sctp_ipsec
-TST_TOTAL=3
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_SETUP=tst_ipsec_setup
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $(tst_ipaddr rhost) -T sctp -n $p -N $p \
-			-r $IPSEC_REQUESTS -S $(tst_ipaddr)
-	done
+	tst_netload -H $(tst_ipaddr rhost) -T sctp -n $2 -N $2 \
+		-r $IPSEC_REQUESTS -S $(tst_ipaddr)
 }
 
-tst_ipsec_setup
-
-do_test
-
-tst_exit
+tst_run
testcases/network/stress/sctp/sctp_ipsec_vti.sh +7 -13
index ed851475a..d0f24c727 100755
@@ -1,25 +1,19 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=sctp_ipsec_vti
-TST_TOTAL=3
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_SETUP=tst_ipsec_setup_vti
+TST_CLEANUP=tst_ipsec_cleanup
+TST_TESTFUNC=do_test
 . ipsec_lib.sh
 
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $ip_rmt_tun -T sctp -n $p -N $p \
-			-r $IPSEC_REQUESTS -S $ip_loc_tun
-	done
+	tst_netload -H $ip_rmt_tun -T sctp -n $2 -N $2 -r $IPSEC_REQUESTS \
+		-S $ip_loc_tun
 }
 
-tst_ipsec_setup_vti
-
-do_test
-
-tst_exit
+tst_run
testcases/network/stress/tcp/tcp_ipsec.sh +8 -14
index 0f875948c..d62272db0 100755
@@ -1,27 +1,21 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=tcp_ipsec
-TST_TOTAL=3
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
+TST_TESTFUNC=do_test
+TST_SETUP=tst_ipsec_setup
+TST_CLEANUP=tst_ipsec_cleanup
+. ipsec_lib.sh
 
 max_requests=10
 
-. ipsec_lib.sh
-
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $(tst_ipaddr rhost) -n $p -N $p \
-			-r $IPSEC_REQUESTS -R $max_requests
-	done
+	tst_netload -H $(tst_ipaddr rhost) -n $2 -N $2 -r $IPSEC_REQUESTS \
+		-R $max_requests
 }
 
-tst_ipsec_setup
-
-do_test
-
-tst_exit
+tst_run
testcases/network/stress/tcp/tcp_ipsec_vti.sh +7 -14
index 13a67d3bb..f7bbbc6e9 100755
@@ -1,27 +1,20 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=tcp_ipsec_vti
-TST_TOTAL=3
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
+TST_TESTFUNC=do_test
+TST_SETUP=tst_ipsec_setup_vti
+TST_CLEANUP=tst_ipsec_cleanup
+. ipsec_lib.sh
 
 max_requests=10
 
-. ipsec_lib.sh
-
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $ip_rmt_tun -n $p -N $p \
-			-r $IPSEC_REQUESTS -R $max_requests
-	done
+	tst_netload -H $ip_rmt_tun -n $2 -N $2 -r $IPSEC_REQUESTS -R $max_requests
 }
 
-tst_ipsec_setup_vti
-
-do_test
-
-tst_exit
+tst_run
testcases/network/stress/udp/udp_ipsec.sh +10 -14
index 9c46fc6c0..b59070ebe 100755
@@ -1,26 +1,22 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=udp_ipsec
-TST_TOTAL=6
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_SETUP=tst_ipsec_setup
+TST_CNT=2
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $(tst_ipaddr rhost) -T $1 -n $p -N $p \
-			-r $IPSEC_REQUESTS
-	done
-}
+	local type="udp"
+	[ $1 -eq 2 ] && type="udp_lite"
 
-tst_ipsec_setup
-
-do_test udp
-do_test udp_lite
+	tst_netload -H $(tst_ipaddr rhost) -T $type -n $2 -N $2 -r $IPSEC_REQUESTS
+}
 
-tst_exit
+tst_run
testcases/network/stress/udp/udp_ipsec_vti.sh +10 -14
index 1b138afb6..65b48eaa4 100755
@@ -1,26 +1,22 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=udp_ipsec_vti
-TST_TOTAL=6
 TST_NEEDS_TMPDIR=1
-TST_CLEANUP="tst_ipsec_cleanup"
-
+TST_TESTFUNC=do_test
+TST_CNT=2
+TST_SETUP=tst_ipsec_setup_vti
+TST_CLEANUP=tst_ipsec_cleanup
 . ipsec_lib.sh
 
 do_test()
 {
-	for p in $IPSEC_SIZE_ARRAY; do
-		tst_netload -H $ip_rmt_tun -T $1 -n $p -N $p \
-			-r $IPSEC_REQUESTS
-	done
-}
+	local type="udp"
+	[ $1 -eq 2 ] && type="udp_lite"
 
-tst_ipsec_setup_vti
-
-do_test udp
-do_test udp_lite
+	tst_netload -H $ip_rmt_tun -T $type -n $2 -N $2 -r $IPSEC_REQUESTS
+}
 
-tst_exit
+tst_run
testcases/network/virt/geneve01.sh +22 -20
index 91d03883d..8ddb97258 100755
@@ -1,10 +1,9 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2016-2017 Oracle and/or its affiliates.
 # Author: Alexey Kodanev <[email protected]>
 
-TCID=geneve01
-TST_TOTAL=1
 TST_NEEDS_TMPDIR=1
 TST_OPTS="hi:d:"
 TST_PARSE_ARGS=virt_lib_parse_args
@@ -16,26 +15,29 @@ start_id=16700000
 # that is why using here 'vxlan_*' library functions.
 vxlan_dst_addr="uni"
 
+TST_TESTFUNC=do_test
+TST_CLEANUP=virt_cleanup
 . virt_lib.sh
 
 VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-160}
 [ "$VIRT_PERF_THRESHOLD" -lt 160 ] && VIRT_PERF_THRESHOLD=160
 
-TST_CLEANUP="virt_cleanup"
-
-if [ -z $ip_local -o -z $ip_remote ]; then
-	tst_brkm TBROK "you must specify IP address"
-fi
-
-tst_resm TINFO "the same VNI must work"
-# VNI is 24 bits long, so max value, which is not reserved, is 0xFFFFFE
-vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE" "id 0xFFFFFE"
-virt_netperf_msg_sizes
-virt_cleanup_rmt
-
-tst_resm TINFO "different VNI shall not work together"
-vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE" "id 0xFFFFFD"
-virt_minimize_timeout
-virt_compare_netperf "fail"
-
-tst_exit
+do_test()
+{
+	if [ -z $ip_local -o -z $ip_remote ]; then
+		tst_brk TBROK "you must specify IP address"
+	fi
+
+	tst_res TINFO "the same VNI must work"
+	# VNI is 24 bits long, so max value, which is not reserved, is 0xFFFFFE
+	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE" "id 0xFFFFFE"
+	virt_netperf_msg_sizes
+	virt_cleanup_rmt
+
+	tst_res TINFO "different VNI shall not work together"
+	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE" "id 0xFFFFFD"
+	virt_minimize_timeout
+	virt_compare_netperf "fail"
+}
+
+tst_run
testcases/network/virt/gre01.sh +13 -8
index efb78a940..3173d1b7c 100755
@@ -1,5 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2015-2017 Oracle and/or its affiliates.
 # Author: Alexey Kodanev <[email protected]>
 #
@@ -7,23 +8,30 @@
 # tunnel between two hosts, then will compare TCP performance
 # with and without GRE using ping or netstress test.
 
-TCID=gre01
-TST_TOTAL=1
 TST_NEEDS_TMPDIR=1
-
-virt_type="gre"
+TST_TESTFUNC=do_test
+TST_SETUP=do_setup
+TST_CLEANUP=virt_cleanup
 . virt_lib.sh
 
-TST_CLEANUP="virt_cleanup"
+do_setup()
+{
+	virt_type="gre"
+	[ "$TST_IPV6" ] && virt_type="ip6gre"
+	virt_lib_setup
+}
 
-if [ -z $ip_local -o -z $ip_remote ]; then
-	tst_brkm TBROK "you must specify IP address"
-fi
+do_test()
+{
+	if [ -z $ip_local -o -z $ip_remote ]; then

testcases/network/virt/gre01.sh line 33

Quoted 10 lines
testcases/network/virt/gre01.sh +5 -3
+		tst_brk TBROK "you must specify IP address"
+	fi
 
-tst_resm TINFO "test $virt_type"
-virt_setup "local $(tst_ipaddr) remote $(tst_ipaddr rhost) dev $(tst_iface)" \
-"local $(tst_ipaddr rhost) remote $(tst_ipaddr) dev $(tst_iface rhost)"
+	tst_res TINFO "test $virt_type"
+	virt_setup "local $(tst_ipaddr) remote $(tst_ipaddr rhost) dev $(tst_iface)" \
+	"local $(tst_ipaddr rhost) remote $(tst_ipaddr) dev $(tst_iface rhost)"
 

Shouldn't it be done in setup function?

testcases/network/virt/gre01.sh line 36

Quoted 4 lines
testcases/network/virt/gre01.sh +2 -1
-virt_netperf_msg_sizes
+	virt_netperf_msg_sizes
+}
 

And TST_TESTFUNC=virt_netperf_msg_sizes ?

Quoted 74 lines
testcases/network/virt/gre01.sh +1 -1
-tst_exit
+tst_run
testcases/network/virt/ipvlan01.sh +5 -7
index 426b2cb6b..f49b5ed75 100755
@@ -1,20 +1,18 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create and then delete ipvlan
 # interface multiple times.
 
-TCID=ipvlan01
-TST_TOTAL=2
+TST_TEST_DATA="mode l2,mode l3"
+TST_TEST_DATA_IFS=","
+TST_TESTFUNC=virt_test_02
 
 virt_type="ipvlan"
 
 . virt_lib.sh
 
-options="mode l2,mode l3"
-
-virt_test_02 "$options"
-
-tst_exit
+tst_run
testcases/network/virt/macsec01.sh +8 -9
index cf038e7ca..3d8815b27 100755
@@ -1,5 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
@@ -7,13 +8,16 @@
 # with default MACsec configuration, compare performance with similar
 # IPsec configuration on master interface.
 
-TCID=macsec01
-TST_TOTAL=16
-TST_NEEDS_TMPDIR=1
-
 virt_type="macsec"
 VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-100}
+IPSEC_MODE="transport"
+IPSEC_PROTO="ah"
 
+TST_NEEDS_TMPDIR=1
+TST_TESTFUNC=do_test
+TST_SETUP=ipsec_lib_setup
+IPSEC_LIB_IGNORE_IPSEC_SIZE_ARRAY=1
+TST_CLEANUP=cleanup
 . ipsec_lib.sh
 . virt_lib.sh
 
@@ -22,15 +26,15 @@ cleanup()
 	virt_cleanup
 	tst_ipsec_cleanup
 }
-TST_CLEANUP="cleanup"
 
-IPSEC_MODE=transport
-IPSEC_PROTO=ah
-tst_resm TINFO "setup IPsec $IPSEC_MODE/$IPSEC_PROTO $EALGO"
-tst_ipsec lhost $(tst_ipaddr) $(tst_ipaddr rhost)

testcases/network/virt/macsec01.sh cleanup() · line 36

Quoted 10 lines
testcases/network/virt/macsec01.sh +6 -3
-tst_ipsec rhost $(tst_ipaddr rhost) $(tst_ipaddr)
+do_test()
+{
+	tst_res TINFO "setup IPsec $IPSEC_MODE/$IPSEC_PROTO $EALGO"
+	tst_ipsec lhost $(tst_ipaddr) $(tst_ipaddr rhost)
+	tst_ipsec rhost $(tst_ipaddr rhost) $(tst_ipaddr)
 
-virt_macsec_setup
-virt_netperf_msg_sizes
+	virt_macsec_setup

The same is here, may be better to move it to setup?

Quoted 76 lines
testcases/network/virt/macsec01.sh +3 -1
+	virt_netperf_msg_sizes
+}
 
-tst_exit
+tst_run
testcases/network/virt/macsec02.sh +18 -14
index 63c035e44..ba8c38654 100755
@@ -1,5 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
@@ -7,13 +8,17 @@
 # with enabled frame encryption and replay protection, compare
 # performance with similar IPsec configuration on master interface.
 
-TCID=macsec02
-TST_TOTAL=16
-TST_NEEDS_TMPDIR=1
-
 virt_type="macsec"
 VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-100}
+IPSEC_MODE="transport"
+IPSEC_PROTO="esp_aead"
+EALGO="aes"
 
+TST_NEEDS_TMPDIR=1
+TST_TESTFUNC=do_test
+TST_SETUP=ipsec_lib_setup
+IPSEC_LIB_IGNORE_IPSEC_SIZE_ARRAY=1
+TST_CLEANUP=cleanup
 . ipsec_lib.sh
 . virt_lib.sh
 
@@ -22,16 +27,15 @@ cleanup()
 	virt_cleanup
 	tst_ipsec_cleanup
 }
-TST_CLEANUP="cleanup"
 
-IPSEC_MODE=transport
-IPSEC_PROTO=esp_aead
-EALGO=aes
-tst_resm TINFO "setup IPsec $IPSEC_MODE/$IPSEC_PROTO $EALGO"
-tst_ipsec lhost $(tst_ipaddr) $(tst_ipaddr rhost)
-tst_ipsec rhost $(tst_ipaddr rhost) $(tst_ipaddr)
+do_test()
+{
+	tst_res TINFO "setup IPsec $IPSEC_MODE/$IPSEC_PROTO $EALGO"
+	tst_ipsec lhost $(tst_ipaddr) $(tst_ipaddr rhost)
+	tst_ipsec rhost $(tst_ipaddr rhost) $(tst_ipaddr)
 
-virt_macsec_setup "replay on window 300 encrypt on protect on"
-virt_netperf_msg_sizes
+	virt_macsec_setup "replay on window 300 encrypt on protect on"
+	virt_netperf_msg_sizes
+}
 
-tst_exit
+tst_run
testcases/network/virt/macvlan01.sh +1 -0
index f37851f50..e739fae97 100755
@@ -1,20 +1,21 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create and then delete macvlan

testcases/network/virt/macvlan01.sh line 11

Quoted 10 lines
testcases/network/virt/macvlan01.sh +0 -6
 # interface multiple times.
 
-TCID=macvlan01
-TST_TOTAL=4
-
 virt_type="macvlan"
-
-. virt_lib.sh
-
 options="mode private,mode vepa,mode bridge,mode passthru"

Why not to use TST_TEST_DATA here?

testcases/network/virt/macvlan01.sh line 12

Quoted 1 line
testcases/network/virt/macvlan01.sh +1 -0
+TST_CNT=4

Looks like we don't need TST_CNT here.

testcases/network/virt/macvlan01.sh line 13

Quoted 1 line
testcases/network/virt/macvlan01.sh +1 -0
+TST_TESTFUNC=do_test

TST_TESTFUNC=virt_test_02

Quoted 22 lines
testcases/network/virt/macvlan01.sh +6 -2
+. virt_lib.sh
 
-virt_test_02 "$options"
+do_test()
+{
+	virt_test_02 "$options"
+}
 
-tst_exit
+tst_run
testcases/network/virt/macvtap01.sh +1 -0
index 21fd96777..654cf30bd 100755
@@ -1,20 +1,21 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create and then delete macvtap

testcases/network/virt/macvtap01.sh line 11

Quoted 10 lines
testcases/network/virt/macvtap01.sh +0 -6
 # interface multiple times.
 
-TCID=macvtap01
-TST_TOTAL=4
-
 virt_type="macvtap"
-
-. virt_lib.sh
-
 options="mode private,mode vepa,mode bridge,mode passthru"

Here as well.

Quoted 226 lines
testcases/network/virt/macvtap01.sh +8 -2
+TST_CNT=4
+TST_TESTFUNC=do_test
+. virt_lib.sh
 
-virt_test_02 "$options"
+do_test()
+{
+	virt_test_02 "$options"
+}
 
-tst_exit
+tst_run
testcases/network/virt/virt_lib.sh +56 -37
index eaec33d8f..9b21f6201 100644
@@ -1,5 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
@@ -15,30 +16,52 @@
 #          them in cleanup function. See "start_vni" variable which can
 #          solve it.
 
+TST_SETUP="${TST_SETUP:-virt_lib_setup}"
+TST_CLEANUP="${TST_CLEANUP:-cleanup_vifaces}"
+trap "tst_brk TBROK 'test interrupted'" INT
+
+virt_lib_usage()
+{
+	echo "i n     start ID to use"
+	echo "d x     VxLAN destination address, 'uni' or 'multi'"
+}
+
 virt_lib_parse_args()
 {
 	case "$1" in
-	h)
-		echo "Usage:"
-		echo "h        help"
-		echo "i n      start ID to use"
-		echo "d x      VxLAN destination address, 'uni' or 'multi'"
-		echo "6        run over IPv6"
-		exit 0
-	;;
 	i) start_id=$2 ;;
 	d) vxlan_dst_addr=$2 ;;
-	*)
-		tst_brkm TBROK "unknown option: $1"
+	esac
+}
+
+virt_lib_setup()
+{
+	case "$virt_type" in
+	vxlan|geneve)
+		if tst_kvcmp -lt "3.8"; then
+			tst_brk TCONF "test must be run with kernel 3.8 or newer"
+		fi
+
+		if [ "$TST_IPV6" ] && tst_kvcmp -lt "3.12"; then
+			tst_brk TCONF "test must be run with kernels >= 3.12"
+		fi
+
+		# newer versions of 'ip' complain if this option not set
+		ip li add type vxlan help 2>&1 | grep -q dstport && vxlan_dstport=1
 	;;
 	esac
+
+	tst_check_cmds "ip"
+
+	virt_add ltp_v0 || \
+		tst_brk TCONF "iproute2 or kernel doesn't support $virt_type"
+
+	ROD_SILENT "ip link delete ltp_v0"
 }
 
-TST_USE_LEGACY_API=1
+TST_NEEDS_ROOT=1
 . tst_net.sh
 
-[ -n "$TST_IPV6" -a "$virt_type" = "gre" ] && virt_type="ip6gre"
-
 ip_local=$(tst_ipaddr)
 ip_virt_local="$(TST_IPV6= tst_ipaddr_un)"
 ip6_virt_local="$(TST_IPV6=6 tst_ipaddr_un)"
@@ -53,7 +76,7 @@ vxlan_dstport=0
 
 cleanup_vifaces()
 {
-	tst_resm TINFO "cleanup virtual interfaces..."
+	tst_res TINFO "cleanup virtual interfaces..."
 	local viface=`ip li | sed -nE 's/^[0-9]+: (ltp_v[0-9]+)[@:].+/\1/p'`
 	for vx in $viface; do
 		ip link delete $vx
@@ -73,12 +96,8 @@ virt_cleanup_rmt()
 virt_cleanup()
 {
 	virt_cleanup_rmt
-	[ "$TST_NEEDS_TMPDIR" = 1 ] && tst_rmdir
 }
 
-TST_CLEANUP="cleanup_vifaces"
-trap "tst_brkm TBROK 'test interrupted'" INT
-
 virt_add()
 {
 	local vname=$1
@@ -138,11 +157,11 @@ virt_multiple_add_test()
 	local opt="$@"
 	local max=$(($start_id + $NS_TIMES - 1))
 
-	tst_resm TINFO "add $NS_TIMES $virt_type, then delete"
+	tst_res TINFO "add $NS_TIMES $virt_type, then delete"
 
 	for i in $(seq $start_id $max); do
 		virt_add ltp_v$i id $i $opt || \
-			tst_brkm TFAIL "failed to create 'ltp_v0 $opt'"
+			tst_brk TFAIL "failed to create 'ltp_v0 $opt'"
 		ROD_SILENT "ip link set ltp_v$i up"
 	done
 
@@ -151,7 +170,7 @@ virt_multiple_add_test()
 		ROD_SILENT "ip link delete ltp_v$i"
 	done
 
-	tst_resm TPASS "done"
+	tst_res TPASS "done"
 }
 
 virt_add_delete_test()
@@ -159,15 +178,15 @@ virt_add_delete_test()
 	local opt="$@"
 	local max=$(($NS_TIMES - 1))
 
-	tst_resm TINFO "add/del $virt_type $NS_TIMES times"
+	tst_res TINFO "add/del $virt_type $NS_TIMES times"
 
 	for i in $(seq 0 $max); do
 		virt_add ltp_v0 $opt || \
-			tst_brkm TFAIL "failed to create 'ltp_v0 $opt'"
+			tst_brk TFAIL "failed to create 'ltp_v0 $opt'"
 		ROD_SILENT "ip link set ltp_v0 up"
 		ROD_SILENT "ip link delete ltp_v0"
 	done
-	tst_resm TPASS "done"
+	tst_res TPASS "done"
 }
 
 virt_setup()
@@ -175,11 +194,11 @@ virt_setup()
 	local opt="$1"
 	local opt_r="${2:-$1}"
 
-	tst_resm TINFO "setup local ${virt_type} with '$opt'"
+	tst_res TINFO "setup local ${virt_type} with '$opt'"
 	virt_add ltp_v0 $opt || \
-		tst_brkm TBROK "failed to create 'ltp_v0 $opt'"
+		tst_brk TBROK "failed to create 'ltp_v0 $opt'"
 
-	tst_resm TINFO "setup rhost ${virt_type} with '$opt_r'"
+	tst_res TINFO "setup rhost ${virt_type} with '$opt_r'"
 	virt_add_rhost "$opt_r"
 
 	ROD_SILENT "ip addr add ${ip6_virt_local}/64 dev ltp_v0 nodad"
@@ -212,11 +231,11 @@ virt_minimize_timeout()
 vxlan_setup_subnet_uni()
 {
 	if tst_kvcmp -lt "3.10"; then
-		tst_brkm TCONF "test must be run with kernel 3.10 or newer"
+		tst_brk TCONF "test must be run with kernel 3.10 or newer"
 	fi
 
 	[ "$(ip li add type $virt_type help 2>&1 | grep remote)" ] || \
-		tst_brkm TCONF "iproute doesn't support remote unicast address"
+		tst_brk TCONF "iproute doesn't support remote unicast address"
 
 	local opt="$1 remote $(tst_ipaddr rhost)"
 	local opt_r="$2 remote $(tst_ipaddr)"
@@ -265,26 +284,26 @@ virt_compare_netperf()
 	tst_netload -H $ip_remote $opts -d res_ipv4
 
 	local lt="$(cat res_ipv4)"
-	tst_resm TINFO "time lan($lt) $virt_type IPv4($vt) and IPv6($vt6) ms"
+	tst_res TINFO "time lan($lt) $virt_type IPv4($vt) and IPv6($vt6) ms"
 
 	per=$(( $vt * 100 / $lt - 100 ))
 	per6=$(( $vt6 * 100 / $lt - 100 ))
 
 	case "$virt_type" in
 	vxlan|geneve)
-		tst_resm TINFO "IP4 $virt_type over IP$TST_IPVER slower by $per %"
-		tst_resm TINFO "IP6 $virt_type over IP$TST_IPVER slower by $per6 %"
+		tst_res TINFO "IP4 $virt_type over IP$TST_IPVER slower by $per %"
+		tst_res TINFO "IP6 $virt_type over IP$TST_IPVER slower by $per6 %"
 	;;
 	*)
-		tst_resm TINFO "IP4 $virt_type slower by $per %"
-		tst_resm TINFO "IP6 $virt_type slower by $per6 %"
+		tst_res TINFO "IP4 $virt_type slower by $per %"
+		tst_res TINFO "IP6 $virt_type slower by $per6 %"
 	esac
 
 	if [ "$per" -ge "$VIRT_PERF_THRESHOLD" -o \
 	     "$per6" -ge "$VIRT_PERF_THRESHOLD" ]; then
-		tst_resm TFAIL "Test failed, threshold: $VIRT_PERF_THRESHOLD %"
+		tst_res TFAIL "Test failed, threshold: $VIRT_PERF_THRESHOLD %"
 	else
-		tst_resm TPASS "Test passed, threshold: $VIRT_PERF_THRESHOLD %"
+		tst_res TPASS "Test passed, threshold: $VIRT_PERF_THRESHOLD %"
 	fi
 }
 
@@ -292,7 +311,7 @@ virt_check_cmd()
 {
 	$@ > /dev/null 2>&1
 	if [ $? -ne 0 ]; then
-		tst_resm TCONF "'$@' option(s) not supported, skipping it"
+		tst_res TCONF "'$@' option(s) not supported, skipping it"
 		return 1
 	fi
 	ROD_SILENT "ip li delete ltp_v0"

testcases/network/virt/virt_lib.sh virt_netperf_msg_sizes() · line 363

Quoted 8 lines
testcases/network/virt/virt_lib.sh +0 -1
@@ -338,74 +357,25 @@ virt_netperf_msg_sizes()
 
 # Check if we can create then delete virtual interface n times.
 # virt_test_01 [OPTIONS]
-# OPTIONS - different options separated by comma.
 virt_test_01()
 {
 	start_id="${start_id:-1}"
 	local opts="${1:-}"

$opts is unused now

Quoted 17 lines
testcases/network/virt/virt_lib.sh +2 -14
-	local n=0
-
-	while true; do
-		n=$((n + 1))
-		p="$(echo $opts | cut -d',' -f$n)"
-		if [ -z "$p" -a $n -gt 1 ]; then
-			break
-		fi
-
-		tst_resm TINFO "add $virt_type with '$p'"
-
-		virt_check_cmd virt_add ltp_v0 id 0 $p || continue
 
-		virt_multiple_add_test "$p"
-	done
+	tst_res TINFO "add $virt_type with '$2'"
+	virt_check_cmd virt_add ltp_v0 id 0 $2 || return

testcases/network/virt/virt_lib.sh virt_netperf_msg_sizes() · line 375

Quoted 10 lines
testcases/network/virt/virt_lib.sh +1 -1
+	virt_multiple_add_test "$2"
 }
 
 # Check if we can create then delete virtual interface n times.
 # virt_test_02 [OPTIONS]
-# OPTIONS - different options separated by comma.
 virt_test_02()
 {
 	start_id="${start_id:-1}"
 	local opts="${1:-}"

And here.

Quoted 95 lines
testcases/network/virt/virt_lib.sh +3 -39
-	local n=0
-
-	while true; do
-		n=$((n + 1))
-		p="$(echo $opts | cut -d',' -f$n)"
-		if [ -z "$p" -a $n -gt 1 ]; then
-			break
-		fi
-
-		tst_resm TINFO "add and then delete $virt_type with '$p'"
-
-		virt_check_cmd virt_add ltp_v0 $p || continue
 
-		virt_add_delete_test "$p"
+	tst_res TINFO "add and then delete $virt_type with '$2'"
 
-		start_id=$(($start_id + $NS_TIMES))
-	done
+	virt_check_cmd virt_add ltp_v0 $2 || return
+	virt_add_delete_test "$2"
 }
-
-tst_require_root
-
-case "$virt_type" in
-vxlan|geneve)
-	if tst_kvcmp -lt "3.8"; then
-		tst_brkm TCONF "test must be run with kernel 3.8 or newer"
-	fi
-
-	if [ "$TST_IPV6" ] && tst_kvcmp -lt "3.12"; then
-		tst_brkm TCONF "test must be run with kernels >= 3.12"
-	fi
-
-	# newer versions of 'ip' complain if this option not set
-	ip li add type vxlan help 2>&1 | grep -q dstport && vxlan_dstport=1
-;;
-esac
-
-tst_check_cmds "ip"
-
-virt_add ltp_v0 || \
-	tst_brkm TCONF "iproute2 or kernel doesn't support $virt_type"
-
-ROD_SILENT "ip link delete ltp_v0"
testcases/network/virt/vlan01.sh +8 -11
index 4dceae82f..69d2564cb 100755
@@ -1,17 +1,11 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create multiple VLAN interfaces.
 
-TCID=vlan01
-TST_TOTAL=9
-
-virt_type="vlan"
-
-. virt_lib.sh
-
 p0="protocol 802.1Q"
 p1="protocol 802.1ad"
 lb0="loose_binding off"
@@ -19,9 +13,12 @@ lb1="loose_binding on"
 rh0="reorder_hdr off"
 rh1="reorder_hdr on"
 
-options=" ,$p0 $lb0 $rh0,$p0 $lb0 $rh1,$p0 $lb1 $rh0,$p0 $lb1 $rh1,\
-$p1 $lb0 $rh0,$p1 $lb0 $rh1,$p1 $lb1 $rh0,$p1 $lb1 $rh1,"
+virt_type="vlan"
 
-virt_test_01 "$options"
+TST_TEST_DATA=",$p0 $lb0 $rh0,$p0 $lb0 $rh1,$p0 $lb1 $rh0,$p0 $lb1 $rh1,\
+$p1 $lb0 $rh0,$p1 $lb0 $rh1,$p1 $lb1 $rh0,$p1 $lb1 $rh1"
+TST_TEST_DATA_IFS=","
+TST_TESTFUNC=virt_test_01
+. virt_lib.sh
 
-tst_exit
+tst_run
testcases/network/virt/vlan02.sh +1 -0
index 2b84a7cd0..04a8a5c60 100755
@@ -1,18 +1,20 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>

testcases/network/virt/vlan02.sh line 12

Quoted 10 lines
testcases/network/virt/vlan02.sh +1 -3
 #
 # Local test, check if we can create and then delete VLAN
 # interface 4095 times.
 
-TCID=vlan02
-TST_TOTAL=1
-
 virt_type="vlan"
 
+TST_TESTFUNC=do_test

Shouldn't it be virt_add_delete_test with TST_TEST_DATA?

Quoted 107 lines
testcases/network/virt/vlan02.sh +5 -2
 . virt_lib.sh
 
-virt_add_delete_test "id 4094"
+do_test()
+{
+	virt_add_delete_test "id 4094"
+}
 
-tst_exit
+tst_run
testcases/network/virt/vlan03.sh +26 -24
index 33bfaf84c..adadd76fd 100755
@@ -1,5 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2015-2017 Oracle and/or its affiliates.
 # Author: Alexey Kodanev <[email protected]>
 #
@@ -10,20 +11,6 @@
 # Test-case 2: The same as above but must fail, because VLAN allows
 #              to communicate only within the same VLAN segment.
 
-TCID=vlan03
-TST_TOTAL=6
-TST_NEEDS_TMPDIR=1
-
-virt_type="vlan"
-
-. virt_lib.sh
-
-TST_CLEANUP="virt_cleanup"
-
-if [ -z $ip_local -o -z $ip_remote ]; then
-	tst_brkm TBROK "you must specify IP address"
-fi
-
 p0="protocol 802.1Q"
 p1="protocol 802.1ad"
 lb0="loose_binding off"
@@ -31,23 +18,38 @@ lb1="loose_binding on"
 rh0="reorder_hdr off"
 rh1="reorder_hdr on"
 
-opts=" ,$p0 $lb0 $rh1,$p1 $lb1 $rh1"
+virt_type="vlan"
+
+TST_NEEDS_TMPDIR=1
+TST_TEST_DATA=",$p0 $lb0 $rh1,$p1 $lb1 $rh1"
+TST_TEST_DATA_IFS=","
+TST_TESTFUNC=do_test
+TST_SETUP=do_setup
+TST_CLEANUP=virt_cleanup
+. virt_lib.sh
 
-for n in $(seq 1 3); do
-	p="$(echo $opts | cut -d',' -f$n)"
+do_setup()
+{
+	if [ -z $ip_local -o -z $ip_remote ]; then
+		tst_brk TBROK "you must specify IP address"
+	fi
+	virt_lib_setup
+}
 
-	virt_check_cmd virt_add ltp_v0 id 0 $p || continue
+do_test()
+{
+	virt_check_cmd virt_add ltp_v0 id 0 $2 || return
 
-	tst_resm TINFO "networks with the same VLAN ID must work"
-	virt_setup "id 4094 $p" "id 4094 $p"
+	tst_res TINFO "networks with the same VLAN ID must work"
+	virt_setup "id 4094 $2" "id 4094 $2"
 	virt_netperf_msg_sizes
 	virt_cleanup_rmt
 
-	tst_resm TINFO "different VLAN ID shall not work together"
-	virt_setup "id 4093 $p" "id 4094 $p"
+	tst_res TINFO "different VLAN ID shall not work together"
+	virt_setup "id 4093 $2" "id 4094 $2"
 	virt_minimize_timeout
 	virt_compare_netperf "fail"
 	virt_cleanup_rmt
-done
+}
 
-tst_exit
+tst_run
testcases/network/virt/vxlan01.sh +1 -1
index 49bcb942a..027fc6f45 100755
@@ -1,23 +1,28 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2014-2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
 # Local test, check if we can create multiple VXLAN interfaces.
 
 TCID=vxlan01
-TST_TOTAL=5
 TST_OPTS="hi:d:"

testcases/network/virt/vxlan01.sh line 18

Quoted 10 lines
testcases/network/virt/vxlan01.sh +1 -2
 TST_PARSE_ARGS=virt_lib_parse_args
+TST_USAGE=virt_lib_usage
 
 virt_type="vxlan"
 start_id=16700000
 
-. virt_lib.sh
-
 options="l2miss l3miss,norsc nolearning noproxy,\
 ttl 0x01 tos 0x01,ttl 0xff tos 0xff,gbp"

TST_TEST_DATA instead?

testcases/network/virt/vxlan01.sh line 19

Quoted 1 line
testcases/network/virt/vxlan01.sh +1 -0
+TST_CNT=5

Is it really needed, virt_test_01 uses the 2nd argument only, right?

testcases/network/virt/vxlan01.sh line 20

Quoted 1 line
testcases/network/virt/vxlan01.sh +1 -0
+TST_TESTFUNC=do_test

TST_TESTFUNC=virt_test_01?

Quoted 128 lines
testcases/network/virt/vxlan01.sh +6 -2
+. virt_lib.sh
 
-virt_test_01 "$options"
+do_test()
+{
+	virt_test_01 "$options"
+}
 
-tst_exit
+tst_run
testcases/network/virt/vxlan02.sh +10 -5
index dde1dabc8..24e5c4dfb 100755
@@ -1,5 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2014-2015 Oracle and/or its affiliates. All Rights Reserved.
 # Author: Alexey Kodanev <[email protected]>
 #
@@ -7,18 +8,22 @@
 # interface 5000 times.
 
 TCID=vxlan02
-TST_TOTAL=1
 TST_OPTS="hi:d:"
 TST_PARSE_ARGS=virt_lib_parse_args
+TST_USAGE=virt_lib_usage
 
 virt_type="vxlan"
 start_id=16700000
 
+TST_TESTFUNC=do_test
 . virt_lib.sh
 
-[ "$TST_IPV6" ] && mult_addr="ff02::abc" || mult_addr="239.1.1.1"
-opt="group $mult_addr"
+do_test()
+{
+	local mult_addr="239.1.1.1"
+	[ "$TST_IPV6" ] && mult_addr="ff02::abc"
 
-virt_add_delete_test "id $start_id $opt"
+	virt_add_delete_test "id $start_id group $mult_addr"
+}
 
-tst_exit
+tst_run
testcases/network/virt/vxlan03.sh +19 -18
index d8c533cb3..521953f73 100755
@@ -1,5 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Petr Vorel <[email protected]>
 # Copyright (c) 2014-2017 Oracle and/or its affiliates.
 # Author: Alexey Kodanev <[email protected]>
 #
@@ -11,10 +12,10 @@
 #              to communicate only within the same VXLAN segment.
 
 TCID=vxlan03
-TST_TOTAL=4
 TST_NEEDS_TMPDIR=1
 TST_OPTS="hi:d:"
 TST_PARSE_ARGS=virt_lib_parse_args
+TST_USAGE=virt_lib_usage
 
 virt_type="vxlan"
 start_id=16700000
@@ -22,6 +23,11 @@ start_id=16700000
 # Destination address, can be unicast or multicast address
 vxlan_dst_addr="uni"
 
+TST_TEST_DATA=",gbp"
+TST_TEST_DATA_IFS=","
+TST_NEEDS_TMPDIR=1
+TST_TESTFUNC=do_test
+TST_CLEANUP=virt_cleanup
 . virt_lib.sh
 
 # In average cases (with small packets less then 150 bytes) VxLAN slower
@@ -31,30 +37,25 @@ vxlan_dst_addr="uni"
 VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-160}
 [ "$VIRT_PERF_THRESHOLD" -lt 160 ] && VIRT_PERF_THRESHOLD=160
 
-TST_CLEANUP="virt_cleanup"
-
-if [ -z $ip_local -o -z $ip_remote ]; then
-	tst_brkm TBROK "you must specify IP address"
-fi
-
-opts=" ,gbp"
-
-for n in $(seq 1 2); do
-	p="$(echo $opts | cut -d',' -f$n)"
+do_test()
+{
+	if [ -z $ip_local -o -z $ip_remote ]; then
+		tst_brk TBROK "you must specify IP address"
+	fi
 
-	virt_check_cmd virt_add ltp_v0 id 0 $p || continue
+	virt_check_cmd virt_add ltp_v0 id 0 $2 || continue
 
-	tst_resm TINFO "the same VNI must work"
+	tst_res TINFO "the same VNI must work"
 	# VNI is 24 bits long, so max value, which is not reserved, is 0xFFFFFE
-	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $p" "id 0xFFFFFE $p"
+	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $2" "id 0xFFFFFE $2"
 	virt_netperf_msg_sizes
 	virt_cleanup_rmt
 
-	tst_resm TINFO "different VNI shall not work together"
-	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $p" "id 0xFFFFFD $p"
+	tst_res TINFO "different VNI shall not work together"
+	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $2" "id 0xFFFFFD $2"
 	virt_minimize_timeout
 	virt_compare_netperf "fail"
 	virt_cleanup_rmt
-done
+}
 
-tst_exit
+tst_run
author
#9 lore raw

PATCH 6/6 net/{stress, virt}: Migrate tests using virt_lib.sh and ipsec_lib.sh

Hi Alexey,

Quoted 3 lines

Hi Petr,

Thanks for the patches, good work! Some comments below.

Thanks for your review! Agree on everything, but the last one is problematic.

Quoted 11 lines

testcases/network/virt/vlan02.sh line 12

Quoted 9 lines
testcases/network/virt/vlan02.sh +1 -3
 
-TCID=vlan02
-TST_TOTAL=1
-
 virt_type="vlan"
 
+TST_TESTFUNC=do_test

Shouldn't it be virt_add_delete_test with TST_TEST_DATA?

no, virt_add_delete_test uses $@ and it's used by virt_test_02.
As TST_TEST_DATA uses format: $1 for test number and $2 data itself we'd have to pass fake param $1 when call it, which would be very ugly.

Now I'm thinking (too late), whether would be better swap params passed by TST_TEST_DATA (i.e. $1 for data itself and $2 for test number). But as normal testing with TST_CNT uses $1 for test number, I wanted be consistent.

Sometimes I regret that we don't have also TST_TESTFUNC_PARAMS, which would be passed to TST_TESTFUNC just once. But we already have several ways how to start functions...

Quoted 10 lines

testcases/network/virt/vlan02.sh line 20

Quoted 10 lines

. virt_lib.sh

testcases/network/virt/vlan02.sh +5 -2
-virt_add_delete_test "id 4094"
+do_test()
+{
+	virt_add_delete_test "id 4094"
+}
 
-tst_exit
+tst_run

I've fixed some other minor issues. I'll give it a bit of testing and send v2.

Kind regards,
Petr