public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] lib/tst_net.sh: don't treat TWARN/TCONF as failure in tst_netload()
@ 2019-02-26 16:23 Alexey Kodanev
  2019-02-26 16:23 ` [LTP] [PATCH 2/2] lib/tst_net.sh: use SO_BINDTODEVICE " Alexey Kodanev
  2019-02-26 18:26 ` [LTP] [PATCH 1/2] lib/tst_net.sh: don't treat TWARN/TCONF as failure " Petr Vorel
  0 siblings, 2 replies; 9+ messages in thread
From: Alexey Kodanev @ 2019-02-26 16:23 UTC (permalink / raw)
  To: ltp

Report TWARN and don't stop the test in that case.

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

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 3148643..7625c51 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -573,7 +573,7 @@ tst_netload()
 	[ "$setup_srchost" = 1 ] && s_opts="${s_opts}-S $hostopt "
 
 	local expect_ret=0
-	[ "$expect_res" != "pass" ] && expect_ret=1
+	[ "$expect_res" != "pass" ] && expect_ret=3
 
 	tst_rhost_run -c "pkill -9 netstress\$"
 	s_opts="${cs_opts}${s_opts}-R $s_replies -B $TST_TMPDIR"
@@ -590,26 +590,37 @@ tst_netload()
 	c_opts="${cs_opts}${c_opts}-a $c_num -r $c_requests -d $rfile -g $port"
 
 	tst_res_ TINFO "run client 'netstress -l $c_opts'"
-	netstress -l $c_opts > tst_netload.log 2>&1 || ret=1
+	netstress -l $c_opts > tst_netload.log 2>&1 || ret=$?
 	tst_rhost_run -c "pkill -9 netstress\$"
 
-	if [ "$expect_ret" -ne "$ret" ]; then
+	if [ "$expect_ret" -ne 0 ]; then
+		if [ $((ret & expect_ret)) -ne 0 ]; then
+			tst_res_ TPASS "netstress failed as expected"
+		else
+			tst_res_ TFAIL "unexpected pass, ret is $ret"
+		fi
+		return $ret
+	fi
+
+	if [ "$ret" -ne 0 ]; then
 		tst_dump_rhost_cmd
 		cat tst_netload.log
-		tst_brk_ TFAIL "expected '$expect_res' but ret: '$ret'"
+		[ $((ret & 3)) -ne 0 ] && \
+			tst_brk_ TFAIL "expected '$expect_res' but ret: '$ret'"
+		[ $((ret & 32)) -ne 0 ] && \
+			tst_brk_ TCONF "not supported configuration"
+		[ $((ret & 4)) -ne 0 ] && \
+			tst_res_ TWARN "netstress has warnings"
 	fi
 
-	if [ "$ret" -eq 0 ]; then
-		if [ ! -f $rfile ]; then
-			tst_dump_rhost_cmd
-			cat tst_netload.log
-			tst_brk_ TFAIL "can't read $rfile"
-		fi
-		tst_res_ TPASS "netstress passed, time spent '$(cat $rfile)' ms"
-	else
-		tst_res_ TPASS "netstress failed as expected"
+	if [ ! -f $rfile ]; then
+		tst_dump_rhost_cmd
+		cat tst_netload.log
+		tst_brk_ TFAIL "can't read $rfile"
 	fi
 
+	tst_res_ TPASS "netstress passed, time spent '$(cat $rfile)' ms"
+
 	return $ret
 }
 
-- 
1.7.1


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

* [LTP] [PATCH 2/2] lib/tst_net.sh: use SO_BINDTODEVICE in tst_netload()
  2019-02-26 16:23 [LTP] [PATCH 1/2] lib/tst_net.sh: don't treat TWARN/TCONF as failure in tst_netload() Alexey Kodanev
@ 2019-02-26 16:23 ` Alexey Kodanev
  2019-02-26 18:27   ` Petr Vorel
  2019-02-26 18:26 ` [LTP] [PATCH 1/2] lib/tst_net.sh: don't treat TWARN/TCONF as failure " Petr Vorel
  1 sibling, 1 reply; 9+ messages in thread
From: Alexey Kodanev @ 2019-02-26 16:23 UTC (permalink / raw)
  To: ltp

Since we have the information about the device, enable the
usage of the option, when starting netstress.

It can be disabled with TST_NETLOAD_BINDTODEVICE=0.

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

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 7625c51..9e26cee 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -537,6 +537,7 @@ tst_netload()
 	# number of server replies after which TCP connection is closed
 	local s_replies="${TST_NETLOAD_MAX_SRV_REPLIES:-500000}"
 	local s_opts=
+	local bind_to_device=1
 
 	if [ ! "$TST_NEEDS_TMPDIR" = 1 ]; then
 		tst_brk_ TBROK "Using tst_netload requires setting TST_NEEDS_TMPDIR=1"
@@ -564,7 +565,8 @@ tst_netload()
 		f) cs_opts="${cs_opts}-f " ;;
 		F) cs_opts="${cs_opts}-F " ;;
 		e) expect_res="$OPTARG" ;;
-		D) cs_opts="${cs_opts}-D $OPTARG " ;;
+		D) cs_opts="${cs_opts}-D $OPTARG "
+		   bind_to_device=0 ;;
 		*) tst_brk_ TBROK "tst_netload: unknown option: $OPTARG" ;;
 		esac
 	done
@@ -572,6 +574,11 @@ tst_netload()
 
 	[ "$setup_srchost" = 1 ] && s_opts="${s_opts}-S $hostopt "
 
+	if [ "$bind_to_device" = 1 -a "$TST_NETLOAD_BINDTODEVICE" = 1 ]; then
+		c_opts="${c_opts}-D $(tst_iface) "
+		s_opts="${s_opts}-D $(tst_iface rhost) "
+	fi
+
 	local expect_ret=0
 	[ "$expect_res" != "pass" ] && expect_ret=3
 
@@ -788,6 +795,7 @@ fi
 
 export TST_NETLOAD_CLN_REQUESTS="${TST_NETLOAD_CLN_REQUESTS:-10000}"
 export TST_NETLOAD_CLN_NUMBER="${TST_NETLOAD_CLN_NUMBER:-2}"
+export TST_NETLOAD_BINDTODEVICE="${TST_NETLOAD_BINDTODEVICE:-1}"
 export HTTP_DOWNLOAD_DIR="${HTTP_DOWNLOAD_DIR:-/var/www/html}"
 export FTP_DOWNLOAD_DIR="${FTP_DOWNLOAD_DIR:-/var/ftp}"
 export FTP_UPLOAD_DIR="${FTP_UPLOAD_DIR:-/var/ftp/pub}"
-- 
1.7.1


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

* [LTP] [PATCH 1/2] lib/tst_net.sh: don't treat TWARN/TCONF as failure in tst_netload()
  2019-02-26 16:23 [LTP] [PATCH 1/2] lib/tst_net.sh: don't treat TWARN/TCONF as failure in tst_netload() Alexey Kodanev
  2019-02-26 16:23 ` [LTP] [PATCH 2/2] lib/tst_net.sh: use SO_BINDTODEVICE " Alexey Kodanev
@ 2019-02-26 18:26 ` Petr Vorel
  2019-02-28 13:04   ` Alexey Kodanev
  1 sibling, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2019-02-26 18:26 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> Report TWARN and don't stop the test in that case.

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

With one minor comment below.
...
> --- a/testcases/lib/tst_net.sh
> +++ b/testcases/lib/tst_net.sh
> @@ -573,7 +573,7 @@ tst_netload()
>  	[ "$setup_srchost" = 1 ] && s_opts="${s_opts}-S $hostopt "

>  	local expect_ret=0
> -	[ "$expect_res" != "pass" ] && expect_ret=1
> +	[ "$expect_res" != "pass" ] && expect_ret=3

>  	tst_rhost_run -c "pkill -9 netstress\$"
>  	s_opts="${cs_opts}${s_opts}-R $s_replies -B $TST_TMPDIR"
> @@ -590,26 +590,37 @@ tst_netload()
>  	c_opts="${cs_opts}${c_opts}-a $c_num -r $c_requests -d $rfile -g $port"

>  	tst_res_ TINFO "run client 'netstress -l $c_opts'"
> -	netstress -l $c_opts > tst_netload.log 2>&1 || ret=1
> +	netstress -l $c_opts > tst_netload.log 2>&1 || ret=$?
>  	tst_rhost_run -c "pkill -9 netstress\$"

> -	if [ "$expect_ret" -ne "$ret" ]; then
> +	if [ "$expect_ret" -ne 0 ]; then
> +		if [ $((ret & expect_ret)) -ne 0 ]; then
> +			tst_res_ TPASS "netstress failed as expected"
> +		else
> +			tst_res_ TFAIL "unexpected pass, ret is $ret"
I like the previous one, which mentioned what was expected. maybe something
like:
			tst_res_ TFAIL "unexpected pass, expected '$expect_ret', but ret: $ret"

Or even mention $expect_res, which is word (not number)?


Kind regards,
Petr

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

* [LTP] [PATCH 2/2] lib/tst_net.sh: use SO_BINDTODEVICE in tst_netload()
  2019-02-26 16:23 ` [LTP] [PATCH 2/2] lib/tst_net.sh: use SO_BINDTODEVICE " Alexey Kodanev
@ 2019-02-26 18:27   ` Petr Vorel
  2019-03-14 13:33     ` Petr Vorel
  0 siblings, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2019-02-26 18:27 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> Since we have the information about the device, enable the
> usage of the option, when starting netstress.

> It can be disabled with TST_NETLOAD_BINDTODEVICE=0.

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


Kind regards,
Petr

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

* [LTP] [PATCH 1/2] lib/tst_net.sh: don't treat TWARN/TCONF as failure in tst_netload()
  2019-02-26 18:26 ` [LTP] [PATCH 1/2] lib/tst_net.sh: don't treat TWARN/TCONF as failure " Petr Vorel
@ 2019-02-28 13:04   ` Alexey Kodanev
  0 siblings, 0 replies; 9+ messages in thread
From: Alexey Kodanev @ 2019-02-28 13:04 UTC (permalink / raw)
  To: ltp

On 26.02.2019 21:26, Petr Vorel wrote:
...
>> -	if [ "$expect_ret" -ne "$ret" ]; then
>> +	if [ "$expect_ret" -ne 0 ]; then
>> +		if [ $((ret & expect_ret)) -ne 0 ]; then
>> +			tst_res_ TPASS "netstress failed as expected"
>> +		else
>> +			tst_res_ TFAIL "unexpected pass, ret is $ret"
> I like the previous one, which mentioned what was expected. maybe something
> like:
> 			tst_res_ TFAIL "unexpected pass, expected '$expect_ret', but ret: $ret"
> 
> Or even mention $expect_res, which is word (not number)?

Applied with $expect_res. Thanks for review Petr!

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

* [LTP] [PATCH 2/2] lib/tst_net.sh: use SO_BINDTODEVICE in tst_netload()
  2019-02-26 18:27   ` Petr Vorel
@ 2019-03-14 13:33     ` Petr Vorel
  2019-03-14 14:37       ` Alexey Kodanev
  0 siblings, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2019-03-14 13:33 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> > Since we have the information about the device, enable the
> > usage of the option, when starting netstress.

> > It can be disabled with TST_NETLOAD_BINDTODEVICE=0.

Having any reason not to push this patch?

Kind regards,
Petr

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

* [LTP] [PATCH 2/2] lib/tst_net.sh: use SO_BINDTODEVICE in tst_netload()
  2019-03-14 13:33     ` Petr Vorel
@ 2019-03-14 14:37       ` Alexey Kodanev
  2019-03-14 16:20         ` Petr Vorel
  0 siblings, 1 reply; 9+ messages in thread
From: Alexey Kodanev @ 2019-03-14 14:37 UTC (permalink / raw)
  To: ltp

Hi Petr,
On 3/14/19 4:33 PM, Petr Vorel wrote:
> Hi Alexey,
> 
>>> Since we have the information about the device, enable the
>>> usage of the option, when starting netstress.
> 
>>> It can be disabled with TST_NETLOAD_BINDTODEVICE=0.
> 
> Having any reason not to push this patch?
> 

Yes, at least this patch breaks mpls and ipsec/vti tests.

For mpls the fix can be:

diff --git a/testcases/network/mpls/mpls_lib.sh b/testcases/network/mpls/mpls_lib.sh
index 84b3236..4ac7995 100755
--- a/testcases/network/mpls/mpls_lib.sh
+++ b/testcases/network/mpls/mpls_lib.sh
@@ -8,7 +8,7 @@ TST_NEEDS_ROOT=1
 TST_NEEDS_DRIVERS="mpls_router mpls_iptunnel mpls_gso"
 TST_NEEDS_CMDS="sysctl modprobe"
 TST_TEST_DATA="icmp tcp udp"
-
+TST_NETLOAD_BINDTODEVICE=0
 . tst_net.sh


For ipsec/vti we have to set the vti device:

diff --git a/testcases/network/stress/sctp/sctp_ipsec_vti.sh b/testcases/network/stress/sctp/sctp_ipsec_vti.sh
index fe6135a..9c57471 100755
--- a/testcases/network/stress/sctp/sctp_ipsec_vti.sh
+++ b/testcases/network/stress/sctp/sctp_ipsec_vti.sh
@@ -17,7 +17,7 @@ do_test()

        [ "$2" != "$rand_opt" ] && opts="-A $rand_opt"
        tst_netload -H $ip_rmt_tun -T sctp $opts -r $IPSEC_REQUESTS \
-               -S $ip_loc_tun
+               -S $ip_loc_tun -D $tst_vti
 }



Moreover, since the "-D" is rather optional, may be it would be good
to control it with TST_NELOAD_BINDTODEVICE too?

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 7e16d58..e017321 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -565,7 +565,7 @@ tst_netload()
                f) cs_opts="${cs_opts}-f " ;;
                F) cs_opts="${cs_opts}-F " ;;
                e) expect_res="$OPTARG" ;;
-               D) cs_opts="${cs_opts}-D $OPTARG "
+               D) [ "$TST_NETLOAD_BINDTODEVICE" = 1 ] && cs_opts="${cs_opts}-D $OPTARG "
                   bind_to_device=0 ;;
                *) tst_brk_ TBROK "tst_netload: unknown option: $OPTARG" ;;
                esac



> Kind regards,
> Petr
> 


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

* [LTP] [PATCH 2/2] lib/tst_net.sh: use SO_BINDTODEVICE in tst_netload()
  2019-03-14 14:37       ` Alexey Kodanev
@ 2019-03-14 16:20         ` Petr Vorel
  2019-03-14 17:27           ` Alexey Kodanev
  0 siblings, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2019-03-14 16:20 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> >>> Since we have the information about the device, enable the
> >>> usage of the option, when starting netstress.

> >>> It can be disabled with TST_NETLOAD_BINDTODEVICE=0.

> > Having any reason not to push this patch?


> Yes, at least this patch breaks mpls and ipsec/vti tests.
Right, all but mpls01 are broken, haven't noticed this.
Any idea why?

Kind regards,
Petr

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

* [LTP] [PATCH 2/2] lib/tst_net.sh: use SO_BINDTODEVICE in tst_netload()
  2019-03-14 16:20         ` Petr Vorel
@ 2019-03-14 17:27           ` Alexey Kodanev
  0 siblings, 0 replies; 9+ messages in thread
From: Alexey Kodanev @ 2019-03-14 17:27 UTC (permalink / raw)
  To: ltp

On 3/14/19 7:20 PM, Petr Vorel wrote:
> Hi Alexey,
> 
>>>>> Since we have the information about the device, enable the
>>>>> usage of the option, when starting netstress.
> 
>>>>> It can be disabled with TST_NETLOAD_BINDTODEVICE=0.
> 
>>> Having any reason not to push this patch?
> 
> 
>> Yes, at least this patch breaks mpls and ipsec/vti tests.
> Right, all but mpls01 are broken, haven't noticed this.
> Any idea why?

mpls01 just creates/deletes routes, checks options - it's not using tst_netload().


> 
> Kind regards,
> Petr
> 


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

end of thread, other threads:[~2019-03-14 17:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-26 16:23 [LTP] [PATCH 1/2] lib/tst_net.sh: don't treat TWARN/TCONF as failure in tst_netload() Alexey Kodanev
2019-02-26 16:23 ` [LTP] [PATCH 2/2] lib/tst_net.sh: use SO_BINDTODEVICE " Alexey Kodanev
2019-02-26 18:27   ` Petr Vorel
2019-03-14 13:33     ` Petr Vorel
2019-03-14 14:37       ` Alexey Kodanev
2019-03-14 16:20         ` Petr Vorel
2019-03-14 17:27           ` Alexey Kodanev
2019-02-26 18:26 ` [LTP] [PATCH 1/2] lib/tst_net.sh: don't treat TWARN/TCONF as failure " Petr Vorel
2019-02-28 13:04   ` Alexey Kodanev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox