]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
selftests: mlxsw: resource_scale: Fix return value
authorAmit Cohen <amcohen@nvidia.com>
Wed, 2 Mar 2022 16:14:47 +0000 (18:14 +0200)
committerPaolo Pisati <paolo.pisati@canonical.com>
Wed, 9 Mar 2022 14:17:58 +0000 (15:17 +0100)
commit58594aa31d16bb21b55a409c9f4fada3616e9343
tree6c5b12a113b35a17a2706155f969209ff1ff350d
parentd9f4f616105d99ce3cfa7a03cd1d6c380d6a809c
selftests: mlxsw: resource_scale: Fix return value

BugLink: https://bugs.launchpad.net/bugs/1964361
[ Upstream commit 196f9bc050cbc5085b4cbb61cce2efe380bc66d0 ]

The test runs several test cases and is supposed to return an error in
case at least one of them failed.

Currently, the check of the return value of each test case is in the
wrong place, which can result in the wrong return value. For example:

 # TESTS='tc_police' ./resource_scale.sh
 TEST: 'tc_police' [default] 968                                     [FAIL]
         tc police offload count failed
 Error: mlxsw_spectrum: Failed to allocate policer index.
 We have an error talking to the kernel
 Command failed /tmp/tmp.i7Oc5HwmXY:969
 TEST: 'tc_police' [default] overflow 969                            [ OK ]
 ...
 TEST: 'tc_police' [ipv4_max] overflow 969                           [ OK ]

 $ echo $?
 0

Fix this by moving the check to be done after each test case.

Fixes: 059b18e21c63 ("selftests: mlxsw: Return correct error code in resource scale test")
Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh