Skip to content

Commit

Permalink
selftests: mlxsw: Reduce test run time
Browse files Browse the repository at this point in the history
Instead of iterating over all the available trap policers, only perform
the tests with three policers: The first, the last and the one in the
middle of the range. On a Spectrum-3 system, this reduces the run time
from almost an hour to a few minutes.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ido Schimmel authored and David S. Miller committed Oct 25, 2021
1 parent 535ac9a commit e860419
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
32 changes: 20 additions & 12 deletions tools/testing/selftests/drivers/net/mlxsw/devlink_trap_policer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,17 @@ __rate_test()

rate_test()
{
local id
local last_policer=$(devlink -j -p trap policer show |
jq '[.[]["'$DEVLINK_DEV'"][].policer] | max')

for id in $(devlink_trap_policer_ids_get); do
echo
log_info "Running rate test for policer $id"
__rate_test $id
done
log_info "Running rate test for policer 1"
__rate_test 1

log_info "Running rate test for policer $((last_policer / 2))"
__rate_test $((last_policer / 2))

log_info "Running rate test for policer $last_policer"
__rate_test $last_policer
}

__burst_test()
Expand Down Expand Up @@ -342,13 +346,17 @@ __burst_test()

burst_test()
{
local id
local last_policer=$(devlink -j -p trap policer show |
jq '[.[]["'$DEVLINK_DEV'"][].policer] | max')

log_info "Running burst test for policer 1"
__burst_test 1

log_info "Running burst test for policer $((last_policer / 2))"
__burst_test $((last_policer / 2))

for id in $(devlink_trap_policer_ids_get); do
echo
log_info "Running burst size test for policer $id"
__burst_test $id
done
log_info "Running burst test for policer $last_policer"
__burst_test $last_policer
}

trap cleanup EXIT
Expand Down
6 changes: 0 additions & 6 deletions tools/testing/selftests/net/forwarding/devlink_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -563,12 +563,6 @@ devlink_trap_group_policer_get()
| jq '.[][][]["policer"]'
}

devlink_trap_policer_ids_get()
{
devlink -j -p trap policer show \
| jq '.[]["'$DEVLINK_DEV'"][]["policer"]'
}

devlink_port_by_netdev()
{
local if_name=$1
Expand Down

0 comments on commit e860419

Please sign in to comment.