diff mbox series

[RFC,v2,2/2] tst_netload: Exit with TCONF when netstress exit with CONF

Message ID 20180301105943.5487-2-pvorel@suse.cz
State Superseded
Delegated to: Petr Vorel
Headers show
Series [RFC,v2,1/2] lib: TCONF on "not supported" errnos in SAFE_SOCKET() | expand

Commit Message

Petr Vorel March 1, 2018, 10:59 a.m. UTC
as some issues are configuration issues.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/test_net.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Alexey Kodanev March 1, 2018, 3:49 p.m. UTC | #1
On 03/01/2018 01:59 PM, Petr Vorel wrote:
> as some issues are configuration issues.
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/lib/test_net.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
> index 95e13ee03..db9bb028d 100644
> --- a/testcases/lib/test_net.sh
> +++ b/testcases/lib/test_net.sh
> @@ -453,7 +453,9 @@ tst_netload()
>  	tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1
>  	if [ $? -ne 0 ]; then
>  		cat tst_netload.log
> -		tst_brkm TFAIL "server failed"
> +		local ttype="TFAIL"
> +		grep -e 'CONF:' tst_netload.log && ttype="TCONF"


What about using the returned status instead of grep?

Thanks,
Alexey
Petr Vorel March 1, 2018, 6:42 p.m. UTC | #2
Hi Alexey,

> On 03/01/2018 01:59 PM, Petr Vorel wrote:
> > as some issues are configuration issues.

> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> >  testcases/lib/test_net.sh | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)

> > diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
> > index 95e13ee03..db9bb028d 100644
> > --- a/testcases/lib/test_net.sh
> > +++ b/testcases/lib/test_net.sh
> > @@ -453,7 +453,9 @@ tst_netload()
> >  	tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1
> >  	if [ $? -ne 0 ]; then
> >  		cat tst_netload.log
> > -		tst_brkm TFAIL "server failed"
> > +		local ttype="TFAIL"
> > +		grep -e 'CONF:' tst_netload.log && ttype="TCONF"


> What about using the returned status instead of grep?
Sure, that's much better solution, thanks!


Kind regards,
Petr
Petr Vorel March 2, 2018, 9:12 a.m. UTC | #3
Hi Alexey,

> > > diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
> > > index 95e13ee03..db9bb028d 100644
> > > --- a/testcases/lib/test_net.sh
> > > +++ b/testcases/lib/test_net.sh
> > > @@ -453,7 +453,9 @@ tst_netload()
> > >  	tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1
> > >  	if [ $? -ne 0 ]; then
> > >  		cat tst_netload.log
> > > -		tst_brkm TFAIL "server failed"
> > > +		local ttype="TFAIL"
> > > +		grep -e 'CONF:' tst_netload.log && ttype="TCONF"


> > What about using the returned status instead of grep?
> Sure, that's much better solution, thanks!

Actually, this would not work - we need to get info from:
	tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1

But tst_rhost_run return only 1 on failure:

	local ret=0
	...
	'$pre_cmd $cmd $post_cmd'" $out 2>&1 || echo 'RTERR'`
	...
	echo "$output" | grep -q 'RTERR$' && ret=1

So I'd leave it using grep unless we want to change tst_rhost_run to return the exit code
of the last command (this would work for ssh and netns, and I guess for rsh as well).

Another thing in tst_netload(), on client side:
	netstress -l $c_opts > tst_netload.log 2>&1 || ret=1
	tst_rhost_run -c "pkill -9 netstress\$"

	if [ "$expect_ret" -ne "$ret" ]; then
		tst_dump_rhost_cmd
		cat tst_netload.log
		tst_brkm TFAIL "expected '$expect_res' but ret: '$ret'"
	fi

There are 3 netstress usages expecting to fail (via virt_compare_netperf "fail").
So far we don't report TCONF for client, so this code is correct. But if not we can have
TCONF and result will be TPASS as we don't distinguish between TCONF and TFAIL when
running netstress on client side either.

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index 95e13ee03..db9bb028d 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -453,7 +453,9 @@  tst_netload()
 	tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1
 	if [ $? -ne 0 ]; then
 		cat tst_netload.log
-		tst_brkm TFAIL "server failed"
+		local ttype="TFAIL"
+		grep -e 'CONF:' tst_netload.log && ttype="TCONF"
+		tst_brkm $ttype "server failed"
 	fi
 
 	local port=$(tst_rhost_run -s -c "cat $TST_TMPDIR/netstress_port")