blob: 097a9952a9917cdf5b508c29ef5e239b92ccd5ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# common test setup
set -o pipefail
#set -x
lo=localhost
ip=127.0.0.1
ip6=::1
# Some versions of expr can't handle can't mix regexp and math
test=$(expr $0 : '.*/t\([0-9]*\)_')
port=$(expr 5000 + $test)
lport=$(expr 6000 - $test)
@() { echo "+ $@"; "$@"; }
run_iperf() {
mode=server
server=(-s)
client=(-c)
# Split server and client args lists
for a; do
case $a in
(-c) mode=client;;
(-s) mode=server;;
(*)
case $mode in
(server) server+=($a);;
(client) client+=($a);;
esac
esac
done
# Start server
# Wait for "listening"
# Start client
# Merge server and client output
# Store results for additional processing and also copy to stderr for progress
results=$(@ src/iperf -p $port "${server[@]}" 2>&1 | {
awk '{print};/listening/{exit 0}';
@ src/iperf -p $port "${client[@]}"; cat;
} 2>&1 | tee /dev/stderr)
# Check for known error messages
if [[ "$results" =~ unrecognized|ignoring|failed|not\ valid ]]; then
exit 1
fi
}
|