]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh
selftests: mlxsw: resource_scale: Fix return value
[mirror_ubuntu-jammy-kernel.git] / tools / testing / selftests / drivers / net / mlxsw / spectrum / resource_scale.sh
CommitLineData
1b6130df
YM
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
2cca8751
PM
4lib_dir=$(dirname $0)/../../../../net/forwarding
5
1b6130df 6NUM_NETIFS=6
2cca8751
PM
7source $lib_dir/lib.sh
8source $lib_dir/tc_common.sh
1b6130df
YM
9source devlink_lib_spectrum.sh
10
11current_test=""
12
13cleanup()
14{
15 pre_cleanup
16 if [ ! -z $current_test ]; then
17 ${current_test}_cleanup
18 fi
19 devlink_sp_size_kvd_to_default
20}
21
22devlink_sp_read_kvd_defaults
23trap cleanup EXIT
24
5154b1b8 25ALL_TESTS="router tc_flower mirror_gre tc_police port"
1b6130df 26for current_test in ${TESTS:-$ALL_TESTS}; do
059b18e2 27 RET_FIN=0
1b6130df
YM
28 source ${current_test}_scale.sh
29
30 num_netifs_var=${current_test^^}_NUM_NETIFS
31 num_netifs=${!num_netifs_var:-$NUM_NETIFS}
32
33 for profile in $KVD_PROFILES; do
34 RET=0
35 devlink_sp_resource_kvd_profile_set $profile
36 if [[ $RET -gt 0 ]]; then
37 log_test "'$current_test' [$profile] setting"
38 continue
39 fi
40
41 for should_fail in 0 1; do
42 RET=0
43 target=$(${current_test}_get_target "$should_fail")
44 ${current_test}_setup_prepare
45 setup_wait $num_netifs
46 ${current_test}_test "$target" "$should_fail"
47 ${current_test}_cleanup
48 if [[ "$should_fail" -eq 0 ]]; then
49 log_test "'$current_test' [$profile] $target"
50 else
51 log_test "'$current_test' [$profile] overflow $target"
52 fi
58594aa3 53 RET_FIN=$(( RET_FIN || RET ))
1b6130df
YM
54 done
55 done
56done
57current_test=""
58
059b18e2 59exit "$RET_FIN"