Add new function virt_test_02() to the library and update
tests with it.

Signed-off-by: Alexey Kodanev <alexey.koda...@oracle.com>
---
 testcases/network/virt/ipvlan01.sh  |   19 ++++---------------
 testcases/network/virt/macvlan01.sh |   19 ++++---------------
 testcases/network/virt/macvtap01.sh |   19 ++++---------------
 testcases/network/virt/virt_lib.sh  |   28 ++++++++++++++++++++++++++++
 testcases/network/virt/vlan02.sh    |    4 ++--
 testcases/network/virt/vxlan02.sh   |    4 ++--
 6 files changed, 44 insertions(+), 49 deletions(-)

diff --git a/testcases/network/virt/ipvlan01.sh 
b/testcases/network/virt/ipvlan01.sh
index 706c1d8..156de78 100755
--- a/testcases/network/virt/ipvlan01.sh
+++ b/testcases/network/virt/ipvlan01.sh
@@ -16,8 +16,8 @@
 #
 # Author: Alexey Kodanev <alexey.koda...@oracle.com>
 #
-# Test-case 1: Local test, check if we can create and then delete ipvlan
-#              interface 500 times.
+# Local test, check if we can create and then delete ipvlan
+# interface 1000 times.
 
 TCID=ipvlan01
 TST_TOTAL=2
@@ -27,19 +27,8 @@ virt_type="ipvlan"
 . test_net.sh
 . virt_lib.sh
 
-modes="l2 l3"
+options="mode l2,mode l3"
 
-start_id=1
-virt_count=500
-
-for m in $modes; do
-       tst_resm TINFO "add $virt_type with mode '$m'"
-
-       virt_check_cmd virt_add ltp_v0 mode $m || m=""
-
-       virt_add_delete_test "mode $m"
-
-       start_id=$(($start_id + $virt_count))
-done
+virt_test_02 "$options"
 
 tst_exit
diff --git a/testcases/network/virt/macvlan01.sh 
b/testcases/network/virt/macvlan01.sh
index 35febd0..402edde 100755
--- a/testcases/network/virt/macvlan01.sh
+++ b/testcases/network/virt/macvlan01.sh
@@ -16,8 +16,8 @@
 #
 # Author: Alexey Kodanev <alexey.koda...@oracle.com>
 #
-# Test-case 1: Local test, check if we can create and then delete macvlan
-#              interface 500 times.
+# Local test, check if we can create and then delete macvlan
+# interface 2000 times.
 
 TCID=macvlan01
 TST_TOTAL=4
@@ -27,19 +27,8 @@ virt_type="macvlan"
 . test_net.sh
 . virt_lib.sh
 
-modes="private vepa bridge passthru"
+options="mode private,mode vepa,mode bridge,mode passthru"
 
-start_id=1
-virt_count=500
-
-for m in $modes; do
-       tst_resm TINFO "add $virt_type with mode '$m'"
-
-       virt_check_cmd virt_add ltp_v0 mode $m || m=""
-
-       virt_add_delete_test "mode $m"
-
-       start_id=$(($start_id + $virt_count))
-done
+virt_test_02 "$options"
 
 tst_exit
diff --git a/testcases/network/virt/macvtap01.sh 
b/testcases/network/virt/macvtap01.sh
index 8bb3636..3408c94 100755
--- a/testcases/network/virt/macvtap01.sh
+++ b/testcases/network/virt/macvtap01.sh
@@ -16,8 +16,8 @@
 #
 # Author: Alexey Kodanev <alexey.koda...@oracle.com>
 #
-# Test-case 1: Local test, check if we can create and then delete macvtap
-#              interface 500 times.
+# Local test, check if we can create and then delete macvtap
+# interface 2000 times.
 
 TCID=macvtap01
 TST_TOTAL=4
@@ -27,19 +27,8 @@ virt_type="macvtap"
 . test_net.sh
 . virt_lib.sh
 
-modes="private vepa bridge passthru"
+options="mode private,mode vepa,mode bridge,mode passthru"
 
-start_id=1
-virt_count=500
-
-for m in $modes; do
-       tst_resm TINFO "add $virt_type with mode '$m'"
-
-       virt_check_cmd virt_add ltp_v0 mode $m || m=""
-
-       virt_add_delete_test "mode $m"
-
-       start_id=$(($start_id + $virt_count))
-done
+virt_test_02 "$options"
 
 tst_exit
diff --git a/testcases/network/virt/virt_lib.sh 
b/testcases/network/virt/virt_lib.sh
index 2ccba43..d79f7bc 100644
--- a/testcases/network/virt/virt_lib.sh
+++ b/testcases/network/virt/virt_lib.sh
@@ -289,6 +289,34 @@ virt_test_01()
        done
 }
 
+# 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=1
+       virt_count=500
+
+       local opts=${1:-""}
+       local n=0
+
+       while ((1)); 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 || p=""
+
+               virt_add_delete_test "$p"
+
+               start_id=$(($start_id + $virt_count))
+       done
+}
+
 tst_require_root
 
 case "$virt_type" in
diff --git a/testcases/network/virt/vlan02.sh b/testcases/network/virt/vlan02.sh
index 0fb35a3..60addba 100755
--- a/testcases/network/virt/vlan02.sh
+++ b/testcases/network/virt/vlan02.sh
@@ -16,8 +16,8 @@
 #
 # Author: Alexey Kodanev <alexey.koda...@oracle.com>
 #
-# Test-case 1: Local test, check if we can create and then delete VLAN
-#              interface 4095 times.
+# Local test, check if we can create and then delete VLAN
+# interface 4095 times.
 #
 
 TCID=vlan02
diff --git a/testcases/network/virt/vxlan02.sh 
b/testcases/network/virt/vxlan02.sh
index 1470495..0b3a21c 100755
--- a/testcases/network/virt/vxlan02.sh
+++ b/testcases/network/virt/vxlan02.sh
@@ -16,8 +16,8 @@
 #
 # Author: Alexey Kodanev <alexey.koda...@oracle.com>
 #
-# Test-case 1: Local test, check if we can create and then delete VXLAN
-#              interface 5000 times.
+# Local test, check if we can create and then delete VXLAN
+# interface 5000 times.
 #
 
 TCID=vxlan02
-- 
1.7.1


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to