1 #!/bin/bash 2 # SPDX-License-Identifier: GPL-2.0 3 4 lib_dir=$(dirname $0)/../../../../net/forwarding 5 6 NUM_NETIFS=6 7 source $lib_dir/lib.sh 8 source $lib_dir/tc_common.sh 9 source $lib_dir/devlink_lib.sh 10 source ../mlxsw_lib.sh 11 12 mlxsw_only_on_spectrum 2+ || exit 1 13 14 current_test="" 15 16 cleanup() 17 { 18 pre_cleanup 19 if [ ! -z $current_test ]; then 20 ${current_test}_cleanup 21 fi 22 # Need to reload in order to avoid router abort. 23 devlink_reload 24 } 25 26 trap cleanup EXIT 27 28 ALL_TESTS=" 29 router 30 tc_flower 31 mirror_gre 32 tc_police 33 port 34 rif_mac_profile 35 rif_counter 36 port_range 37 " 38 39 for current_test in ${TESTS:-$ALL_TESTS}; do 40 RET_FIN=0 41 source ${current_test}_scale.sh 42 43 num_netifs_var=${current_test^^}_NUM_NETIFS 44 num_netifs=${!num_netifs_var:-$NUM_NETIFS} 45 46 for should_fail in 0 1; do 47 RET=0 48 target=$(${current_test}_get_target "$should_fail") 49 if ((target == 0)); then 50 continue 51 fi 52 53 ${current_test}_setup_prepare 54 setup_wait $num_netifs 55 # Update target in case occupancy of a certain resource changed 56 # following the test setup. 57 target=$(${current_test}_get_target "$should_fail") 58 ${current_test}_test "$target" "$should_fail" 59 if [[ "$should_fail" -eq 0 ]]; then 60 log_test "'$current_test' $target" 61 62 if ((!RET)); then 63 tt=${current_test}_traffic_test 64 if [[ $(type -t $tt) == "function" ]]; then 65 $tt "$target" 66 log_test "'$current_test' $target traffic test" 67 fi 68 fi 69 else 70 log_test "'$current_test' overflow $target" 71 fi 72 ${current_test}_cleanup $target 73 devlink_reload 74 RET_FIN=$(( RET_FIN || RET )) 75 done 76 done 77 current_test="" 78 79 exit "$RET_FIN"
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.