All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] lib/test_net.sh: restore TST_IPV6 after temporary assignments
@ 2015-02-02 17:46 Alexey Kodanev
  2015-02-02 17:46 ` [LTP] [PATCH 2/2] lib/test_net.sh: don't use 'tst_brkm TBROK' in tst_add_ipaddr() Alexey Kodanev
  2015-02-06 12:58 ` [LTP] [PATCH 1/2] lib/test_net.sh: restore TST_IPV6 after temporary assignments Alexey Kodanev
  0 siblings, 2 replies; 3+ messages in thread
From: Alexey Kodanev @ 2015-02-02 17:46 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

Also move iface variable to the function which is using it

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/lib/test_net.sh |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index d72e84e..acaed84 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -216,6 +216,8 @@ tst_add_ipaddr()
 	local mask=24
 	[ "$TST_IPV6" ] && mask=64
 
+	local iface=$(tst_iface $type $link_num)
+
 	if [ $type = "lhost" ]; then
 		tst_resm TINFO "set local addr $(tst_ipaddr)/$mask"
 		ip addr add $(tst_ipaddr)/$mask dev $iface || \
@@ -238,8 +240,10 @@ tst_restore_ipaddr()
 
 	tst_init_iface $type $link_num
 
-	local iface=$(tst_iface $type $link_num)
+	local backup_tst_ipv6=$TST_IPV6
 
 	TST_IPV6= tst_add_ipaddr $type $link_num
 	TST_IPV6=6 tst_add_ipaddr $type $link_num
+
+	TST_IPV6=$backup_tst_ipv6
 }
-- 
1.7.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCH 2/2] lib/test_net.sh: don't use 'tst_brkm TBROK' in tst_add_ipaddr()
  2015-02-02 17:46 [LTP] [PATCH 1/2] lib/test_net.sh: restore TST_IPV6 after temporary assignments Alexey Kodanev
@ 2015-02-02 17:46 ` Alexey Kodanev
  2015-02-06 12:58 ` [LTP] [PATCH 1/2] lib/test_net.sh: restore TST_IPV6 after temporary assignments Alexey Kodanev
  1 sibling, 0 replies; 3+ messages in thread
From: Alexey Kodanev @ 2015-02-02 17:46 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

The function can be called in cleanup, so if it somehow failed,
there could be an infinite recursion. Fix it by removing 'tst_brkm'
and returning appropriate exit code.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/lib/test_net.sh |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index acaed84..75ccd76 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -220,13 +220,13 @@ tst_add_ipaddr()
 
 	if [ $type = "lhost" ]; then
 		tst_resm TINFO "set local addr $(tst_ipaddr)/$mask"
-		ip addr add $(tst_ipaddr)/$mask dev $iface || \
-			tst_brkm TBROK "failed to add IP address"
-		return
+		ip addr add $(tst_ipaddr)/$mask dev $iface
+		return $?
 	fi
 
 	tst_resm TINFO "set remote addr $(tst_ipaddr rhost)/$mask"
-	tst_rhost_run -s -c "ip addr add $(tst_ipaddr rhost)/$mask dev $iface"
+	tst_rhost_run -c "ip addr add $(tst_ipaddr rhost)/$mask dev $iface"
+	return $?
 }
 
 # tst_restore_ipaddr [TYPE] [LINK]
@@ -237,13 +237,14 @@ tst_restore_ipaddr()
 {
 	local type=${1:-"lhost"}
 	local link_num=${2:-"0"}
+	local ret=0
 
 	tst_init_iface $type $link_num
 
 	local backup_tst_ipv6=$TST_IPV6
-
-	TST_IPV6= tst_add_ipaddr $type $link_num
-	TST_IPV6=6 tst_add_ipaddr $type $link_num
-
+	TST_IPV6= tst_add_ipaddr $type $link_num || ret=$?
+	TST_IPV6=6 tst_add_ipaddr $type $link_num || ret=$?
 	TST_IPV6=$backup_tst_ipv6
+
+	return $ret
 }
-- 
1.7.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH 1/2] lib/test_net.sh: restore TST_IPV6 after temporary assignments
  2015-02-02 17:46 [LTP] [PATCH 1/2] lib/test_net.sh: restore TST_IPV6 after temporary assignments Alexey Kodanev
  2015-02-02 17:46 ` [LTP] [PATCH 2/2] lib/test_net.sh: don't use 'tst_brkm TBROK' in tst_add_ipaddr() Alexey Kodanev
@ 2015-02-06 12:58 ` Alexey Kodanev
  1 sibling, 0 replies; 3+ messages in thread
From: Alexey Kodanev @ 2015-02-06 12:58 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

Hi!
On 02/02/2015 08:46 PM, Alexey Kodanev wrote:
> Also move iface variable to the function which is using it
>
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> ---
>   testcases/lib/test_net.sh |    6 +++++-
>   1 files changed, 5 insertions(+), 1 deletions(-)

test_net.sh fixes pushed.

Thanks,
Alexey


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-06 12:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-02 17:46 [LTP] [PATCH 1/2] lib/test_net.sh: restore TST_IPV6 after temporary assignments Alexey Kodanev
2015-02-02 17:46 ` [LTP] [PATCH 2/2] lib/test_net.sh: don't use 'tst_brkm TBROK' in tst_add_ipaddr() Alexey Kodanev
2015-02-06 12:58 ` [LTP] [PATCH 1/2] lib/test_net.sh: restore TST_IPV6 after temporary assignments Alexey Kodanev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.