diff options
author | Amit Cohen <amitc@mellanox.com> | 2020-07-29 12:26:48 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-07-29 12:16:21 -0700 |
commit | 10fef9ca6a879e7bee090b8e51c9812d438d3fb1 (patch) | |
tree | bb7d75ce89ffd1845ae8f48e0d730c62226a12c4 /tools | |
parent | 5515c3448d55bdcb5ff8a1778aa84f34e4205596 (diff) | |
download | linux-stable-10fef9ca6a879e7bee090b8e51c9812d438d3fb1.tar.gz linux-stable-10fef9ca6a879e7bee090b8e51c9812d438d3fb1.tar.bz2 linux-stable-10fef9ca6a879e7bee090b8e51c9812d438d3fb1.zip |
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: 64916b57c0b1 ("selftests: forwarding: Add speed and auto-negotiation test")
Reported-by: Danielle Ratson <danieller@mellanox.com>
Signed-off-by: Amit Cohen <amitc@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/testing/selftests/net/forwarding/ethtool.sh | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/tools/testing/selftests/net/forwarding/ethtool.sh b/tools/testing/selftests/net/forwarding/ethtool.sh index eb8e2a23bbb4..43a948feed26 100755 --- a/tools/testing/selftests/net/forwarding/ethtool.sh +++ b/tools/testing/selftests/net/forwarding/ethtool.sh @@ -252,8 +252,6 @@ check_highest_speed_is_chosen() fi local -a speeds_arr=($(common_speeds_get $h1 $h2 0 1)) - # Remove the first speed, h1 does not advertise this speed. - unset speeds_arr[0] max_speed=${speeds_arr[0]} for current in ${speeds_arr[@]}; do |