diff mbox series

ipsec_lib.sh: test xfrm_user driver locally before rhost

Message ID 20201216094037.5886-1-kory.maincent@bootlin.com
State Changes Requested
Headers show
Series ipsec_lib.sh: test xfrm_user driver locally before rhost | expand

Commit Message

Kory Maincent Dec. 16, 2020, 9:40 a.m. UTC
First, test the presence of the driver locally to avoid a misleading TWARN from
tst_net_run in case of driver not present.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 testcases/network/stress/ipsec/ipsec_lib.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Alexey Kodanev Dec. 16, 2020, 10:31 a.m. UTC | #1
On 16.12.2020 12:40, Kory Maincent wrote:
> First, test the presence of the driver locally to avoid a misleading TWARN from
> tst_net_run in case of driver not present.
> 
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> ---
>  testcases/network/stress/ipsec/ipsec_lib.sh | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
> index 198c9315d..1db5fc6af 100644
> --- a/testcases/network/stress/ipsec/ipsec_lib.sh
> +++ b/testcases/network/stress/ipsec/ipsec_lib.sh
> @@ -83,8 +83,9 @@ ipsec_lib_setup()
>  	ALGR=
>  
>  	if [ -n "$IPSEC_MODE" ]; then
> -		tst_net_run "tst_check_drivers xfrm_user" || \
> -			tst_brk TCONF "xfrm_user driver not available on lhost or rhost"
> +		tst_check_drivers xfrm_user || tst_brk TCONF "xfrm_user driver not available"
> +		tst_rhost_run -c "tst_check_drivers xfrm_user" || \
> +			tst_brk TCONF "xfrm_user driver not available on rhost"

Hi Kory,

tst_net_run() checks the driver locally first, so I don't
quite understand why do exactly the same what tst_net_run()
supposed to do?
Kory Maincent Dec. 16, 2020, 10:55 a.m. UTC | #2
Hello Alexey,

On Wed, 16 Dec 2020 13:31:36 +0300
Alexey Kodanev <alexey.kodanev@oracle.com> wrote:

> On 16.12.2020 12:40, Kory Maincent wrote:
> > First, test the presence of the driver locally to avoid a misleading TWARN
> > from tst_net_run in case of driver not present.
> > 
> > Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> > ---
> >  testcases/network/stress/ipsec/ipsec_lib.sh | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh
> > b/testcases/network/stress/ipsec/ipsec_lib.sh index 198c9315d..1db5fc6af
> > 100644 --- a/testcases/network/stress/ipsec/ipsec_lib.sh
> > +++ b/testcases/network/stress/ipsec/ipsec_lib.sh
> > @@ -83,8 +83,9 @@ ipsec_lib_setup()
> >  	ALGR=
> >  
> >  	if [ -n "$IPSEC_MODE" ]; then
> > -		tst_net_run "tst_check_drivers xfrm_user" || \
> > -			tst_brk TCONF "xfrm_user driver not available on
> > lhost or rhost"
> > +		tst_check_drivers xfrm_user || tst_brk TCONF "xfrm_user
> > driver not available"
> > +		tst_rhost_run -c "tst_check_drivers xfrm_user" || \
> > +			tst_brk TCONF "xfrm_user driver not available on
> > rhost"  
> 
> Hi Kory,
> 
> tst_net_run() checks the driver locally first, so I don't
> quite understand why do exactly the same what tst_net_run()
> supposed to do?

Indeed but it returns a TWARN because the command "tst_check_drivers xfrm_user"
not end properly, but in fact it should return a TCONF due to the missing
xfrm_drivers.
In the final result file we got a FAIL error with the value 36 in place of a
CONF with value 32 which should be the right message.

Regards,
Alexey Kodanev Dec. 16, 2020, 11:10 a.m. UTC | #3
On 16.12.2020 13:55, Köry Maincent wrote:
> Hello Alexey,
> 
> On Wed, 16 Dec 2020 13:31:36 +0300
> Alexey Kodanev <alexey.kodanev@oracle.com> wrote:
> 
>> On 16.12.2020 12:40, Kory Maincent wrote:
>>> First, test the presence of the driver locally to avoid a misleading TWARN
>>> from tst_net_run in case of driver not present.
>>>
>>> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
>>> ---
>>>  testcases/network/stress/ipsec/ipsec_lib.sh | 5 +++--
>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh
>>> b/testcases/network/stress/ipsec/ipsec_lib.sh index 198c9315d..1db5fc6af
>>> 100644 --- a/testcases/network/stress/ipsec/ipsec_lib.sh
>>> +++ b/testcases/network/stress/ipsec/ipsec_lib.sh
>>> @@ -83,8 +83,9 @@ ipsec_lib_setup()
>>>  	ALGR=
>>>  
>>>  	if [ -n "$IPSEC_MODE" ]; then
>>> -		tst_net_run "tst_check_drivers xfrm_user" || \
>>> -			tst_brk TCONF "xfrm_user driver not available on
>>> lhost or rhost"
>>> +		tst_check_drivers xfrm_user || tst_brk TCONF "xfrm_user
>>> driver not available"
>>> +		tst_rhost_run -c "tst_check_drivers xfrm_user" || \
>>> +			tst_brk TCONF "xfrm_user driver not available on
>>> rhost"  
>>
>> Hi Kory,
>>
>> tst_net_run() checks the driver locally first, so I don't
>> quite understand why do exactly the same what tst_net_run()
>> supposed to do?
> 
> Indeed but it returns a TWARN because the command "tst_check_drivers xfrm_user"
> not end properly, but in fact it should return a TCONF due to the missing
> xfrm_drivers.
> In the final result file we got a FAIL error with the value 36 in place of a
> CONF with value 32 which should be the right message.
> 

Perhaps it needs -q option here:

tst_net_run -q "tst_check_drivers xfrm_user" ... so it skips TWARN?
Kory Maincent Dec. 16, 2020, 2:23 p.m. UTC | #4
Hi Alexey,

On Wed, 16 Dec 2020 14:10:34 +0300
Alexey Kodanev <alexey.kodanev@oracle.com> wrote:
> >>
> >> tst_net_run() checks the driver locally first, so I don't
> >> quite understand why do exactly the same what tst_net_run()
> >> supposed to do?  
> > 
> > Indeed but it returns a TWARN because the command "tst_check_drivers
> > xfrm_user" not end properly, but in fact it should return a TCONF due to
> > the missing xfrm_drivers.
> > In the final result file we got a FAIL error with the value 36 in place of a
> > CONF with value 32 which should be the right message.
> >   
> 
> Perhaps it needs -q option here:
> 
> tst_net_run -q "tst_check_drivers xfrm_user" ... so it skips TWARN?
> 

Ah yes, I feel stupid! ;)
Tested it, it works as expected.
Do you want me to send a v2 patch?

Regards,

Köry
diff mbox series

Patch

diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
index 198c9315d..1db5fc6af 100644
--- a/testcases/network/stress/ipsec/ipsec_lib.sh
+++ b/testcases/network/stress/ipsec/ipsec_lib.sh
@@ -83,8 +83,9 @@  ipsec_lib_setup()
 	ALGR=
 
 	if [ -n "$IPSEC_MODE" ]; then
-		tst_net_run "tst_check_drivers xfrm_user" || \
-			tst_brk TCONF "xfrm_user driver not available on lhost or rhost"
+		tst_check_drivers xfrm_user || tst_brk TCONF "xfrm_user driver not available"
+		tst_rhost_run -c "tst_check_drivers xfrm_user" || \
+			tst_brk TCONF "xfrm_user driver not available on rhost"
 		cleanup_xfrm=1
 	fi
 }