From: Jiri Pirko <jiri@resnulli.us>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, mlxsw@mellanox.com
Subject: Re: [patch net-next] selftests: netdevsim: add devlink params tests
Date: Wed, 14 Aug 2019 09:47:04 +0200 [thread overview]
Message-ID: <20190814074704.GA2580@nanopsycho.mediaserver.passengera.com> (raw)
In-Reply-To: <20190813154108.30509472@cakuba.netronome.com>
Wed, Aug 14, 2019 at 12:41:08AM CEST, jakub.kicinski@netronome.com wrote:
>On Tue, 13 Aug 2019 15:04:46 +0200, Jiri Pirko wrote:
>> From: Jiri Pirko <jiri@mellanox.com>
>>
>> Test recently added netdevsim devlink param implementation.
>>
>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>
>Thanks for the test, but it doesn't pass here:
>
>TEST: fw flash test [ OK ]
>TEST: params test [FAIL]
> Failed to get test1 param value
Interesting. Fors for me correctly. When I run it manually, I get this:
bash-5.0# devlink dev param show netdevsim/netdevsim11 name test1 -j | jq -e -r '.[][][].values[] | select(.cmode == "driverinit").value'
true
bash-5.0# echo $?
0
bash-5.0# devlink dev param set netdevsim/netdevsim11 name test1 cmode driverinit value false
bash-5.0# devlink dev param show netdevsim/netdevsim11 name test1 -j | jq -e -r '.[][][].values[] | select(.cmode == "driverinit").value'
false
bash-5.0# echo $?
0
>
>> diff --git a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
>> index 9d8baf5d14b3..858ebdc8d8a3 100755
>> --- a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
>> +++ b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
>> @@ -3,7 +3,7 @@
>>
>> lib_dir=$(dirname $0)/../../../net/forwarding
>>
>> -ALL_TESTS="fw_flash_test"
>> +ALL_TESTS="fw_flash_test params_test"
>> NUM_NETIFS=0
>> source $lib_dir/lib.sh
>>
>> @@ -30,6 +30,66 @@ fw_flash_test()
>> log_test "fw flash test"
>> }
>>
>> +param_get()
>> +{
>> + local name=$1
>> +
>> + devlink dev param show $DL_HANDLE name $name -j | \
>> + jq -e -r '.[][][].values[] | select(.cmode == "driverinit").value'
>
> ^^
>
>The -e makes jq set exit code to 1 when test1 param is false.
>
>Quoting the man page:
>
> · -e / --exit-status:
>
> Sets the exit status of jq to 0 if the last output values
> was neither false nor null, 1 if the last output value was
> either false or null, or 4 if no valid result was
> ever produced. Normally jq exits with 2 if there was any
> usage problem or system error, 3 if there was a jq program
> compile error, or 0 if the jq program ran.
>
>Without the -e all is well:
Not really, for non-existent param the return value would be wrong:
bash-5.0# devlink dev param show netdevsim/netdevsim11 name test2 -j | jq -e -r '.[][][].values[] | select(.cmode == "driverinit").value'
devlink answers: Invalid argument
bash-5.0# echo $?
4
bash-5.0# devlink dev param show netdevsim/netdevsim11 name test2 -j | jq -r '.[][][].values[] | select(.cmode == "driverinit").value'
devlink answers: Invalid argument
bash-5.0# echo $?
0
The return value is 0 like everyone is fine. You probably have a
different jq version (1.6). Looks like I need to use the same
workaround I have in tools/testing/selftests/net/forwarding/tc_common.sh.
I thought that -e would avoid that.
>
># ./devlink.sh
>TEST: fw flash test [ OK ]
>TEST: params test [ OK ]
>
>> +}
>> +
prev parent reply other threads:[~2019-08-14 7:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-13 13:04 [patch net-next] selftests: netdevsim: add devlink params tests Jiri Pirko
2019-08-13 22:41 ` Jakub Kicinski
2019-08-14 7:47 ` Jiri Pirko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190814074704.GA2580@nanopsycho.mediaserver.passengera.com \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=jakub.kicinski@netronome.com \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).