All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] lib/tst_net.sh: don't init ltp_ns if custom is used
@ 2018-04-12 16:09 Alexey Kodanev
  2018-04-12 16:09 ` [LTP] [PATCH 2/2] lib/tst_net.sh: use nodad in tst_add_ipaddr() Alexey Kodanev
  2018-04-12 16:45 ` [LTP] [PATCH 1/2] lib/tst_net.sh: don't init ltp_ns if custom is used Alexey Kodanev
  0 siblings, 2 replies; 4+ messages in thread
From: Alexey Kodanev @ 2018-04-12 16:09 UTC (permalink / raw)
  To: ltp

We can define our own LTP_NETNS with custom setup, don't setup
the default one in that particular case.

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

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index bbef12a..53f6277 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -103,7 +103,7 @@ init_ltp_netspace()
 
 	local pid=
 
-	if [ ! -f /var/run/netns/ltp_ns ]; then
+	if [ ! -f /var/run/netns/ltp_ns -a -z "$LTP_NETNS" ]; then
 		ROD ip li add name ltp_ns_veth1 type veth peer name ltp_ns_veth2
 		pid="$(ROD ns_create net,mnt)"
 		mkdir -p /var/run/netns
@@ -112,6 +112,8 @@ init_ltp_netspace()
 		ROD ns_exec $pid net,mnt mount -t sysfs none /sys
 		ROD ns_ifmove ltp_ns_veth1 $pid
 		ROD ns_exec $pid net,mnt ip li set lo up
+	else
+		tst_res_ TINFO "using not default LTP netns: '$LTP_NETNS'"
 	fi
 
 	LHOST_IFACES="${LHOST_IFACES:-ltp_ns_veth2}"
-- 
1.7.1


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

* [LTP] [PATCH 2/2] lib/tst_net.sh: use nodad in tst_add_ipaddr()
  2018-04-12 16:09 [LTP] [PATCH 1/2] lib/tst_net.sh: don't init ltp_ns if custom is used Alexey Kodanev
@ 2018-04-12 16:09 ` Alexey Kodanev
  2018-04-12 16:45 ` [LTP] [PATCH 1/2] lib/tst_net.sh: don't init ltp_ns if custom is used Alexey Kodanev
  1 sibling, 0 replies; 4+ messages in thread
From: Alexey Kodanev @ 2018-04-12 16:09 UTC (permalink / raw)
  To: ltp

Save time when the tests run with netns and without network.sh.

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

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 53f6277..a95eb33 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -126,8 +126,6 @@ init_ltp_netspace()
 
 	tst_restore_ipaddr
 	tst_restore_ipaddr rhost
-
-	tst_wait_ipv6_dad
 }
 
 # Run command on remote host.
@@ -389,9 +387,10 @@ tst_add_ipaddr()
 {
 	local type="${1:-lhost}"
 	local link_num="${2:-0}"
-	local mask
+	local mask dad
 
 	if [ "$TST_IPV6" ]; then
+		dad="nodad"
 		[ "$type" = "lhost" ] && mask=$IPV6_LPREFIX || mask=$IPV6_RPREFIX
 	else
 		[ "$type" = "lhost" ] && mask=$IPV4_LPREFIX || mask=$IPV4_RPREFIX
@@ -401,12 +400,12 @@ tst_add_ipaddr()
 
 	if [ $type = "lhost" ]; then
 		tst_res_ TINFO "set local addr $(tst_ipaddr)/$mask"
-		ip addr add $(tst_ipaddr)/$mask dev $iface
+		ip addr add $(tst_ipaddr)/$mask dev $iface $dad
 		return $?
 	fi
 
 	tst_res_ TINFO "set remote addr $(tst_ipaddr rhost)/$mask"
-	tst_rhost_run -c "ip addr add $(tst_ipaddr rhost)/$mask dev $iface"
+	tst_rhost_run -c "ip addr add $(tst_ipaddr rhost)/$mask dev $iface $dad"
 }
 
 # tst_restore_ipaddr [TYPE] [LINK]
-- 
1.7.1


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

* [LTP] [PATCH 1/2] lib/tst_net.sh: don't init ltp_ns if custom is used
  2018-04-12 16:09 [LTP] [PATCH 1/2] lib/tst_net.sh: don't init ltp_ns if custom is used Alexey Kodanev
  2018-04-12 16:09 ` [LTP] [PATCH 2/2] lib/tst_net.sh: use nodad in tst_add_ipaddr() Alexey Kodanev
@ 2018-04-12 16:45 ` Alexey Kodanev
  2018-04-19 13:32   ` Alexey Kodanev
  1 sibling, 1 reply; 4+ messages in thread
From: Alexey Kodanev @ 2018-04-12 16:45 UTC (permalink / raw)
  To: ltp

On 12.04.2018 19:09, Alexey Kodanev wrote:
> We can define our own LTP_NETNS with custom setup, don't setup
> the default one in that particular case.
> 
...
> -	if [ ! -f /var/run/netns/ltp_ns ]; then
> +	if [ ! -f /var/run/netns/ltp_ns -a -z "$LTP_NETNS" ]; then
>  		ROD ip li add name ltp_ns_veth1 type veth peer name ltp_ns_veth2
>  		pid="$(ROD ns_create net,mnt)"
>  		mkdir -p /var/run/netns
> @@ -112,6 +112,8 @@ init_ltp_netspace()
>  		ROD ns_exec $pid net,mnt mount -t sysfs none /sys
>  		ROD ns_ifmove ltp_ns_veth1 $pid
>  		ROD ns_exec $pid net,mnt ip li set lo up
> +	else

It should have been 'elif [ -n "$LTP_NETNS" ] ...' here instead.
Otherwise the info will be printed if "/var/run/netns/ltp_ns"
already exists.

> +		tst_res_ TINFO "using not default LTP netns: '$LTP_NETNS'"
>  	fi
>  
>  	LHOST_IFACES="${LHOST_IFACES:-ltp_ns_veth2}"
> 


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

* [LTP] [PATCH 1/2] lib/tst_net.sh: don't init ltp_ns if custom is used
  2018-04-12 16:45 ` [LTP] [PATCH 1/2] lib/tst_net.sh: don't init ltp_ns if custom is used Alexey Kodanev
@ 2018-04-19 13:32   ` Alexey Kodanev
  0 siblings, 0 replies; 4+ messages in thread
From: Alexey Kodanev @ 2018-04-19 13:32 UTC (permalink / raw)
  To: ltp

On 04/12/2018 07:45 PM, Alexey Kodanev wrote:
...
>> -	if [ ! -f /var/run/netns/ltp_ns ]; then
>> +	if [ ! -f /var/run/netns/ltp_ns -a -z "$LTP_NETNS" ]; then
>>  		ROD ip li add name ltp_ns_veth1 type veth peer name ltp_ns_veth2
>>  		pid="$(ROD ns_create net,mnt)"
>>  		mkdir -p /var/run/netns
>> @@ -112,6 +112,8 @@ init_ltp_netspace()
>>  		ROD ns_exec $pid net,mnt mount -t sysfs none /sys
>>  		ROD ns_ifmove ltp_ns_veth1 $pid
>>  		ROD ns_exec $pid net,mnt ip li set lo up
>> +	else
> 
> It should have been 'elif [ -n "$LTP_NETNS" ] ...' here instead.
> Otherwise the info will be printed if "/var/run/netns/ltp_ns"
> already exists.
> 
>> +		tst_res_ TINFO "using not default LTP netns: '$LTP_NETNS'"
>>  	fi
>>  

Applied the patch series with the above changes.

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

end of thread, other threads:[~2018-04-19 13:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-12 16:09 [LTP] [PATCH 1/2] lib/tst_net.sh: don't init ltp_ns if custom is used Alexey Kodanev
2018-04-12 16:09 ` [LTP] [PATCH 2/2] lib/tst_net.sh: use nodad in tst_add_ipaddr() Alexey Kodanev
2018-04-12 16:45 ` [LTP] [PATCH 1/2] lib/tst_net.sh: don't init ltp_ns if custom is used Alexey Kodanev
2018-04-19 13:32   ` 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.