netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, davem@davemloft.net, mlxsw@mellanox.com
Subject: Re: [patch net-next] selftests: netdevsim: add devlink params tests
Date: Tue, 13 Aug 2019 15:41:08 -0700	[thread overview]
Message-ID: <20190813154108.30509472@cakuba.netronome.com> (raw)
In-Reply-To: <20190813130446.25712-1-jiri@resnulli.us>

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

> 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:

# ./devlink.sh 
TEST: fw flash test                                                 [ OK ]
TEST: params test                                                   [ OK ]

> +}
> +

  reply	other threads:[~2019-08-13 22:41 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 [this message]
2019-08-14  7:47   ` Jiri Pirko

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=20190813154108.30509472@cakuba.netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=davem@davemloft.net \
    --cc=jiri@resnulli.us \
    --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).