brintos

brintos / linux-shallow public Read only

0
0
Text · 1.7 KiB · 482ebb7 Raw
85 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 devlink_lib_spectrum.sh10 11current_test=""12 13cleanup()14{15	pre_cleanup16	if [ ! -z $current_test ]; then17		${current_test}_cleanup18	fi19	devlink_sp_size_kvd_to_default20}21 22devlink_sp_read_kvd_defaults23trap cleanup EXIT24 25ALL_TESTS="26	router27	tc_flower28	mirror_gre29	tc_police30	port31	rif_mac_profile32	rif_counter33	port_range34"35 36for current_test in ${TESTS:-$ALL_TESTS}; do37	RET_FIN=038	source ${current_test}_scale.sh39 40	num_netifs_var=${current_test^^}_NUM_NETIFS41	num_netifs=${!num_netifs_var:-$NUM_NETIFS}42 43	for profile in $KVD_PROFILES; do44		RET=045		devlink_sp_resource_kvd_profile_set $profile46		if [[ $RET -gt 0 ]]; then47			log_test "'$current_test' [$profile] setting"48			continue49		fi50 51		for should_fail in 0 1; do52			RET=053			target=$(${current_test}_get_target "$should_fail")54			if ((target == 0)); then55				continue56			fi57			${current_test}_setup_prepare58			setup_wait $num_netifs59			# Update target in case occupancy of a certain resource60			# changed following the test setup.61			target=$(${current_test}_get_target "$should_fail")62			${current_test}_test "$target" "$should_fail"63			if [[ "$should_fail" -eq 0 ]]; then64				log_test "'$current_test' [$profile] $target"65 66				if ((!RET)); then67					tt=${current_test}_traffic_test68					if [[ $(type -t $tt) == "function" ]]69					then70						$tt "$target"71						log_test "'$current_test' [$profile] $target traffic test"72					fi73				fi74			else75				log_test "'$current_test' [$profile] overflow $target"76			fi77			${current_test}_cleanup $target78			RET_FIN=$(( RET_FIN || RET ))79		done80	done81done82current_test=""83 84exit "$RET_FIN"85