summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/base.sh47
-rwxr-xr-xt/t10_dualtest.sh12
-rwxr-xr-xt/t11_tradeoff.sh12
-rwxr-xr-xt/t12_full_duplex.sh13
-rwxr-xr-xt/t13_reverse.sh13
-rwxr-xr-xt/t1_tcp.sh14
-rwxr-xr-xt/t2_tcp6.sh14
-rwxr-xr-xt/t3_udp.sh12
-rwxr-xr-xt/t4_udp6.sh12
-rwxr-xr-xt/t5_f.sh12
-rwxr-xr-xt/t6_filelong.sh12
-rwxr-xr-xt/t7_n.sh12
-rwxr-xr-xt/t8_num.sh12
-rwxr-xr-xt/t9_parallel.sh12
14 files changed, 209 insertions, 0 deletions
diff --git a/t/base.sh b/t/base.sh
new file mode 100644
index 0000000..097a995
--- /dev/null
+++ b/t/base.sh
@@ -0,0 +1,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
+}
+
diff --git a/t/t10_dualtest.sh b/t/t10_dualtest.sh
new file mode 100755
index 0000000..cc370d1
--- /dev/null
+++ b/t/t10_dualtest.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+. $(dirname $0)/base.sh
+
+# usage:
+# run_iperf -s server args -c client args
+#
+# client args should contain $ip or -V $ip6
+# results returned in $results
+
+run_iperf \
+ -s -P 1 -i 1 -t 3 \
+ -c $ip -P 1 --dualtest -L $lport -i 1 -t 2
diff --git a/t/t11_tradeoff.sh b/t/t11_tradeoff.sh
new file mode 100755
index 0000000..b962371
--- /dev/null
+++ b/t/t11_tradeoff.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+. $(dirname $0)/base.sh
+
+# usage:
+# run_iperf -s server args -c client args
+#
+# client args should contain $ip or -V $ip6
+# results returned in $results
+
+run_iperf \
+ -s -P 1 -i 1 -t 3 \
+ -c $ip -P 1 --tradeoff -L $lport -i 1 -t 2
diff --git a/t/t12_full_duplex.sh b/t/t12_full_duplex.sh
new file mode 100755
index 0000000..f159921
--- /dev/null
+++ b/t/t12_full_duplex.sh
@@ -0,0 +1,13 @@
+#!/bin/bash -e
+. $(dirname $0)/base.sh
+
+# usage:
+# run_iperf -s server args -c client args
+#
+# client args should contain $ip or -V $ip6
+# results returned in $results
+
+run_iperf \
+ -s -P 1 -i 1 -t 3 \
+ -c $ip -P 1 --full-duplex -i 1 -t 2
+
diff --git a/t/t13_reverse.sh b/t/t13_reverse.sh
new file mode 100755
index 0000000..8b0292a
--- /dev/null
+++ b/t/t13_reverse.sh
@@ -0,0 +1,13 @@
+#!/bin/bash -e
+. $(dirname $0)/base.sh
+
+# usage:
+# run_iperf -s server args -c client args
+#
+# client args should contain $ip or -V $ip6
+# results returned in $results
+
+run_iperf \
+ -s -P 1 -i 1 -t 3 \
+ -c $ip -P 1 --reverse -i 1 -t 2
+
diff --git a/t/t1_tcp.sh b/t/t1_tcp.sh
new file mode 100755
index 0000000..965f15e
--- /dev/null
+++ b/t/t1_tcp.sh
@@ -0,0 +1,14 @@
+#!/bin/bash -e
+. $(dirname $0)/base.sh
+
+# usage:
+# run_iperf -s server args -c client args
+#
+# client args should contain $ip or -V $ip6
+# results returned in $results
+
+run_iperf \
+ -s -P 1 -i 1 -t 3 \
+ -c $ip -P 1 -i 1 -t 2
+
+
diff --git a/t/t2_tcp6.sh b/t/t2_tcp6.sh
new file mode 100755
index 0000000..802b2d8
--- /dev/null
+++ b/t/t2_tcp6.sh
@@ -0,0 +1,14 @@
+#!/bin/bash -e
+. $(dirname $0)/base.sh
+
+# usage:
+# run_iperf -s server args -c client args
+#
+# client args should contain $ip or -V $ip6
+# results returned in $results
+
+run_iperf \
+ -s --ipv6_domain -P 1 -i 1 -t 3 \
+ -c $ip6 -V -P 1 -i 1 -t 2
+
+
diff --git a/t/t3_udp.sh b/t/t3_udp.sh
new file mode 100755
index 0000000..4374253
--- /dev/null
+++ b/t/t3_udp.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+. $(dirname $0)/base.sh
+
+# usage:
+# run_iperf -s server args -c client args
+#
+# client args should contain $ip or -V $ip6
+# results returned in $results
+
+run_iperf \
+ -s -P 1 -u -i 1 -t 3 \
+ -c $ip -P 1 -u -b 10m -i 1 -t 2
diff --git a/t/t4_udp6.sh b/t/t4_udp6.sh
new file mode 100755
index 0000000..698020f
--- /dev/null
+++ b/t/t4_udp6.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+. $(dirname $0)/base.sh
+
+# usage:
+# run_iperf -s server args -c client args
+#
+# client args should contain $ip or -V $ip6
+# results returned in $results
+
+run_iperf \
+ -s -V -P 1 -u -i 1 -t 3 \
+ -c $ip6 -V -P 1 -u -b 10m -i 1 -t 2
diff --git a/t/t5_f.sh b/t/t5_f.sh
new file mode 100755
index 0000000..b5232d4
--- /dev/null
+++ b/t/t5_f.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+. $(dirname $0)/base.sh
+
+# usage:
+# run_iperf -s server args -c client args
+#
+# client args should contain $ip or -V $ip6
+# results returned in $results
+
+run_iperf \
+ -s -P 1 -u -i 1 -t 3 \
+ -c $ip -P 1 -u -b 1m -i 1 -F Makefile
diff --git a/t/t6_filelong.sh b/t/t6_filelong.sh
new file mode 100755
index 0000000..e83efa7
--- /dev/null
+++ b/t/t6_filelong.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+. $(dirname $0)/base.sh
+
+# usage:
+# run_iperf -s server args -c client args
+#
+# client args should contain $ip or -V $ip6
+# results returned in $results
+
+run_iperf \
+ -s -P 1 -u -i 1 -t 3 \
+ -c $ip -P 1 -u -b 1m -i 1 -t 2 --file_input Makefile
diff --git a/t/t7_n.sh b/t/t7_n.sh
new file mode 100755
index 0000000..c6547d8
--- /dev/null
+++ b/t/t7_n.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+. $(dirname $0)/base.sh
+
+# usage:
+# run_iperf -s server args -c client args
+#
+# client args should contain $ip or -V $ip6
+# results returned in $results
+
+run_iperf \
+ -s -P 1 -i 1 -t 8 \
+ -c $ip -P 1 -i 1 -n 1G
diff --git a/t/t8_num.sh b/t/t8_num.sh
new file mode 100755
index 0000000..f041cdf
--- /dev/null
+++ b/t/t8_num.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+. $(dirname $0)/base.sh
+
+# usage:
+# run_iperf -s server args -c client args
+#
+# client args should contain $ip or -V $ip6
+# results returned in $results
+
+run_iperf \
+ -s -P 1 -i 1 -t 8 \
+ -c $ip -P 1 -i 1 --num 1G
diff --git a/t/t9_parallel.sh b/t/t9_parallel.sh
new file mode 100755
index 0000000..4dcab5d
--- /dev/null
+++ b/t/t9_parallel.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+. $(dirname $0)/base.sh
+
+# usage:
+# run_iperf -s server args -c client args
+#
+# client args should contain $ip or -V $ip6
+# results returned in $results
+
+run_iperf \
+ -s --parallel 4 -i 1 -t 3 \
+ -c $ip -P 4 -i 1 -t 2