brintos

brintos / linux-shallow public Read only

0
0
Text · 1.5 KiB · 899b689 Raw
80 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.03 4lib_dir=$(dirname $0)/../../../../net/forwarding5 6NUM_NETIFS=67source $lib_dir/lib.sh8source $lib_dir/tc_common.sh9source $lib_dir/devlink_lib.sh10source ../mlxsw_lib.sh11 12mlxsw_only_on_spectrum 2+ || exit 113 14current_test=""15 16cleanup()17{18	pre_cleanup19	if [ ! -z $current_test ]; then20		${current_test}_cleanup21	fi22	# Need to reload in order to avoid router abort.23	devlink_reload24}25 26trap cleanup EXIT27 28ALL_TESTS="29	router30	tc_flower31	mirror_gre32	tc_police33	port34	rif_mac_profile35	rif_counter36	port_range37"38 39for current_test in ${TESTS:-$ALL_TESTS}; do40	RET_FIN=041	source ${current_test}_scale.sh42 43	num_netifs_var=${current_test^^}_NUM_NETIFS44	num_netifs=${!num_netifs_var:-$NUM_NETIFS}45 46	for should_fail in 0 1; do47		RET=048		target=$(${current_test}_get_target "$should_fail")49		if ((target == 0)); then50			continue51		fi52 53		${current_test}_setup_prepare54		setup_wait $num_netifs55		# Update target in case occupancy of a certain resource changed56		# 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 ]]; then60			log_test "'$current_test' $target"61 62			if ((!RET)); then63				tt=${current_test}_traffic_test64				if [[ $(type -t $tt) == "function" ]]; then65					$tt "$target"66					log_test "'$current_test' $target traffic test"67				fi68			fi69		else70			log_test "'$current_test' overflow $target"71		fi72		${current_test}_cleanup $target73		devlink_reload74		RET_FIN=$(( RET_FIN || RET ))75	done76done77current_test=""78 79exit "$RET_FIN"80