Skip to content

Commit 4d59e59

Browse files
idoschdavem330
authored andcommitted
selftests: netdevsim: Always initialize 'RET' variable
The variable is used by log_test() to check if the test case completely successfully or not. In case it is not initialized at the start of a test case, it is possible for the test case to fail despite not encountering any errors. Example: ``` ... TEST: Trap group statistics [ OK ] TEST: Trap policer [FAIL] Policer drop counter was not incremented TEST: Trap policer binding [FAIL] Policer drop counter was not incremented ``` Failure of trap_policer_test() caused trap_policer_bind_test() to fail as well. Fix by adding missing initialization of the variable. Fixes: 5fbff58 ("selftests: netdevsim: Add test cases for devlink-trap policers") Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent be43224 commit 4d59e59

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ trap_policer_test()
264264
local packets_t0
265265
local packets_t1
266266

267+
RET=0
268+
267269
if [ $(devlink_trap_policers_num_get) -eq 0 ]; then
268270
check_err 1 "Failed to dump policers"
269271
fi
@@ -328,6 +330,8 @@ trap_group_check_policer()
328330

329331
trap_policer_bind_test()
330332
{
333+
RET=0
334+
331335
devlink trap group set $DEVLINK_DEV group l2_drops policer 1
332336
check_err $? "Failed to bind a valid policer"
333337
if [ $(devlink_trap_group_policer_get "l2_drops") -ne 1 ]; then

0 commit comments

Comments
 (0)