Skip to content

Commit 10fef9c

Browse files
amitcohen1davem330
authored andcommitted
selftests: ethtool: Fix test when only two speeds are supported
The test case check_highest_speed_is_chosen() configures $h1 to advertise a subset of its supported speeds and checks that $h2 chooses the highest speed from the subset. To find the common advertised speeds between $h1 and $h2, common_speeds_get() is called. Currently, the first speed returned from common_speeds_get() is removed claiming "h1 does not advertise this speed". The claim is wrong because the function is called after $h1 already advertised a subset of speeds. In case $h1 supports only two speeds, it will advertise a single speed which will be later removed because of previously mentioned bug. This results in the test needlessly failing. When more than two speeds are supported this is not an issue because the first advertised speed is the lowest one. Fix this by not removing any speed from the list of commonly advertised speeds. Fixes: 64916b5 ("selftests: forwarding: Add speed and auto-negotiation test") Reported-by: Danielle Ratson <[email protected]> Signed-off-by: Amit Cohen <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5515c34 commit 10fef9c

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

tools/testing/selftests/net/forwarding/ethtool.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,6 @@ check_highest_speed_is_chosen()
252252
fi
253253

254254
local -a speeds_arr=($(common_speeds_get $h1 $h2 0 1))
255-
# Remove the first speed, h1 does not advertise this speed.
256-
unset speeds_arr[0]
257255

258256
max_speed=${speeds_arr[0]}
259257
for current in ${speeds_arr[@]}; do

0 commit comments

Comments
 (0)