Commit 196f9bc0 authored by Amit Cohen's avatar Amit Cohen Committed by Jakub Kicinski

selftests: mlxsw: resource_scale: Fix return value

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: 059b18e2 ("selftests: mlxsw: Return correct error code in resource scale test")
Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent dc975207
...@@ -50,9 +50,9 @@ for current_test in ${TESTS:-$ALL_TESTS}; do ...@@ -50,9 +50,9 @@ for current_test in ${TESTS:-$ALL_TESTS}; do
else else
log_test "'$current_test' [$profile] overflow $target" log_test "'$current_test' [$profile] overflow $target"
fi fi
done
RET_FIN=$(( RET_FIN || RET )) RET_FIN=$(( RET_FIN || RET ))
done done
done
done done
current_test="" current_test=""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment