add iperf3 customs servers argument

This commit is contained in:
ilogus 2025-08-19 08:40:22 +02:00
commit bf49ea0e19
No known key found for this signature in database
GPG key ID: 612DC7A566BB9D44

29
yabs.sh Normal file → Executable file
View file

@ -59,11 +59,11 @@ else
fi
# flags to skip certain performance tests
unset PREFER_BIN SKIP_FIO SKIP_IPERF SKIP_GEEKBENCH SKIP_NET PRINT_HELP REDUCE_NET GEEKBENCH_4 GEEKBENCH_5 GEEKBENCH_6 DD_FALLBACK IPERF_DL_FAIL JSON JSON_SEND JSON_RESULT JSON_FILE
unset PREFER_BIN SKIP_FIO SKIP_IPERF SKIP_GEEKBENCH SKIP_NET PRINT_HELP REDUCE_NET GEEKBENCH_4 GEEKBENCH_5 GEEKBENCH_6 DD_FALLBACK IPERF_DL_FAIL JSON JSON_SEND JSON_RESULT JSON_FILE IPERF_SERVERS
GEEKBENCH_6="True" # gb6 test enabled by default
# get any arguments that were passed to the script and set the associated skip flags (if applicable)
while getopts 'bfdignhr4596jw:s:' flag; do
while getopts 'bfdignhr4596jw:s:p:' flag; do
case "${flag}" in
b) PREFER_BIN="True" ;;
f) SKIP_FIO="True" ;;
@ -80,6 +80,7 @@ while getopts 'bfdignhr4596jw:s:' flag; do
j) JSON+="j" ;;
w) JSON+="w" && JSON_FILE=${OPTARG} ;;
s) JSON+="s" && JSON_SEND=${OPTARG} ;;
p) IPERF_SERVERS=${OPTARG} ;;
*) exit 1 ;;
esac
done
@ -148,6 +149,9 @@ if [ -n "$PRINT_HELP" ]; then
echo -e " -j : print jsonified YABS results at conclusion of test"
echo -e " -w <filename> : write jsonified YABS results to disk using file name provided"
echo -e " -s <url> : send jsonified YABS results to URL"
echo -e " -p <servers> : specify custom iperf servers (format: host:port_range:name:location:network_modes)"
echo -e " multiple servers separated by commas"
echo -e " example: -p \"example.com:5201-5210:MyServer:New York, NY (10G):IPv4|IPv6\""
echo -e
echo -e "Detected Arch: $ARCH"
echo -e
@ -161,6 +165,7 @@ if [ -n "$PRINT_HELP" ]; then
[[ -n $GEEKBENCH_4 ]] && echo -e " running geekbench 4"
[[ -n $GEEKBENCH_5 ]] && echo -e " running geekbench 5"
[[ -n $GEEKBENCH_6 ]] && echo -e " running geekbench 6"
[[ -n $IPERF_SERVERS ]] && echo -e " -p, using custom iperf servers: $IPERF_SERVERS"
echo -e
echo -e "Local Binary Check:"
([[ -z $LOCAL_FIO ]] && echo -e " fio not detected, will download precompiled binary") ||
@ -897,6 +902,24 @@ if [ -z "$SKIP_IPERF" ]; then
)
fi
# if custom iperf servers are provided, use them instead of the default servers
if [ -n "$IPERF_SERVERS" ]; then
# clear the default iperf locations array
IPERF_LOCS=()
# parse the custom iperf servers and add them to the array
IFS=',' read -ra CUSTOM_SERVERS <<< "$IPERF_SERVERS"
for server in "${CUSTOM_SERVERS[@]}"; do
# parse server definition: host:port_range:name:location:network_modes
IFS=':' read -ra SERVER_PARTS <<< "$server"
if [ ${#SERVER_PARTS[@]} -eq 5 ]; then
IPERF_LOCS+=("${SERVER_PARTS[0]}" "${SERVER_PARTS[1]}" "${SERVER_PARTS[2]}" "${SERVER_PARTS[3]}" "${SERVER_PARTS[4]}")
else
echo -e "Invalid server format: $server (expected format: host:port_range:name:location:network_modes)"
fi
done
fi
# get the total number of iperf locations (total array size divided by 5 since each location has 5 elements)
IPERF_LOCS_NUM=${#IPERF_LOCS[@]}
IPERF_LOCS_NUM=$((IPERF_LOCS_NUM / 5))
@ -914,7 +937,7 @@ if [ -z "$SKIP_IPERF" ]; then
fi
# launch_geekbench
# Purpose: This method is designed to run the Primate Labs' Geekbench 4/5 Cross-Platform Benchmark utility
# Purpose: This method is designed to run the Primate Labs' Geekbench 4/5/6 Cross-Platform Benchmark utility
# Parameters:
# 1. VERSION - indicates which Geekbench version to run
function launch_geekbench {