diff mbox series

[1/4] network/gre01: move setup to library

Message ID 1550587673-7995-2-git-send-email-alexey.kodanev@oracle.com
State Accepted
Headers show
Series network: new random message size test-cases | expand

Commit Message

Alexey Kodanev Feb. 19, 2019, 2:47 p.m. UTC
The same setup can be used with the other gre tests.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/network/virt/gre01.sh    |   19 ++-----------------
 testcases/network/virt/virt_lib.sh |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 17 deletions(-)

Comments

Petr Vorel Feb. 20, 2019, 8:13 a.m. UTC | #1
Hi Alexey,
> The same setup can be used with the other gre tests.

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

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/network/virt/gre01.sh b/testcases/network/virt/gre01.sh
index 27373fd..db5be6d 100755
--- a/testcases/network/virt/gre01.sh
+++ b/testcases/network/virt/gre01.sh
@@ -1,7 +1,7 @@ 
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
-# Copyright (c) 2015-2017 Oracle and/or its affiliates.
+# Copyright (c) 2015-2019 Oracle and/or its affiliates.
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 #
 # It requires remote host. Test will setup IPv4 and IPv6 virtual
@@ -10,23 +10,8 @@ 
 
 TST_NEEDS_TMPDIR=1
 TST_TESTFUNC=virt_netperf_msg_sizes
-TST_SETUP=do_setup
+TST_SETUP=virt_gre_setup
 TST_CLEANUP=virt_cleanup
 . virt_lib.sh
 
-do_setup()
-{
-	virt_type="gre"
-	[ "$TST_IPV6" ] && virt_type="ip6gre"
-	virt_lib_setup
-
-	if [ -z $ip_local -o -z $ip_remote ]; then
-		tst_brk TBROK "you must specify IP address"
-	fi
-
-	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)"
-}
-
 tst_run
diff --git a/testcases/network/virt/virt_lib.sh b/testcases/network/virt/virt_lib.sh
index c9fe80c..eb9d052 100644
--- a/testcases/network/virt/virt_lib.sh
+++ b/testcases/network/virt/virt_lib.sh
@@ -355,3 +355,18 @@  virt_test_02()
 	virt_add_delete_test "$2"
 	start_id=$(($start_id + $NS_TIMES))
 }
+
+virt_gre_setup()
+{
+	virt_type="gre"
+	[ "$TST_IPV6" ] && virt_type="ip6gre"
+	virt_lib_setup
+
+	if [ -z $ip_local -o -z $ip_remote ]; then
+		tst_brk TBROK "you must specify IP address"
+	fi
+
+	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)"
+}