On Tue, 13 Aug 2019 15:04:46 +0200, Jiri Pirko wrote:
> From: Jiri Pirko <j...@mellanox.com>
> 
> Test recently added netdevsim devlink param implementation.
> 
> Signed-off-by: Jiri Pirko <j...@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 via email to