aboutgitcodebugslistschat
path: root/test/lib
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-11-06 18:08:28 +1100
committerStefano Brivio <sbrivio@redhat.com>2023-11-07 09:56:10 +0100
commite516809a74ffd495481a7adf6b565181861a41f9 (patch)
tree1b99cba3173477677b3b0e6ac203db673fca0cd2 /test/lib
parentf9ff6678d4bbf5d9c80c1c6f784c3955468c09d6 (diff)
downloadpasst-e516809a74ffd495481a7adf6b565181861a41f9.tar
passt-e516809a74ffd495481a7adf6b565181861a41f9.tar.gz
passt-e516809a74ffd495481a7adf6b565181861a41f9.tar.bz2
passt-e516809a74ffd495481a7adf6b565181861a41f9.tar.lz
passt-e516809a74ffd495481a7adf6b565181861a41f9.tar.xz
passt-e516809a74ffd495481a7adf6b565181861a41f9.tar.zst
passt-e516809a74ffd495481a7adf6b565181861a41f9.zip
test/perf: Start iperf3 server less often
Currently we start both the iperf3 server(s) and client(s) afresh each time we want to make a bandwidth measurement. That's not really necessary as usually a whole batch of bandwidth measurements can use the same server. Split up the iperf3 directive into 3 directives: iperf3s to start the server, iperf3 to make a measurement and iperf3k to kill the server, so that we can start the server less often. This - and more importantly, the reduced number of waits for the server to be ready - reduces runtime of the performance tests on my laptop by about 4m (out of ~28minutes). For now we still restart the server between IPv4 and IPv6 tests. That's because in some cases the latency measurements we make in between use the same ports. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/lib')
-rwxr-xr-xtest/lib/test57
1 files changed, 38 insertions, 19 deletions
diff --git a/test/lib/test b/test/lib/test
index 3ca5dbc..1d571c3 100755
--- a/test/lib/test
+++ b/test/lib/test
@@ -13,19 +13,45 @@
# Copyright (c) 2021 Red Hat GmbH
# Author: Stefano Brivio <sbrivio@redhat.com>
+# test_iperf3s() - Start iperf3 server
+# $1: Destination/server context
+# $2: Port number, ${i} is translated to process index
+# $3: Number of processes to run in parallel
+test_iperf3s() {
+ __sctx="${1}"
+ __port="${2}"
+ __procs="$((${3} - 1))"
+
+ pane_or_context_run_bg "${__sctx}" \
+ 'for i in $(seq 0 '${__procs}'); do' \
+ ' iperf3 -s -p'${__port}' &' \
+ ' echo $! > s${i}.pid; ' \
+ 'done' \
+
+ sleep 1 # Wait for server to be ready
+}
+
+# test_iperf3k() - Kill iperf3 server
+# $1: Destination/server context
+test_iperf3k() {
+ __sctx="${1}"
+
+ pane_or_context_run "${__sctx}" 'kill -INT $(cat s*.pid); rm s*.pid'
+
+ sleep 3 # Wait for kernel to free up ports
+}
+
# test_iperf3() - Ugly helper for iperf3 directive
# $1: Variable name: to put the measure bandwidth into
# $2: Source/client context
-# $3: Destination/server context
-# $4: Destination name or address for client
-# $5: Port number, ${i} is translated to process index
-# $6: Number of processes to run in parallel
-# $7: Run time, in seconds
+# $3: Destination name or address for client
+# $4: Port number, ${i} is translated to process index
+# $5: Number of processes to run in parallel
+# $6: Run time, in seconds
# $@: Client options
test_iperf3() {
__var="${1}"; shift
__cctx="${1}"; shift
- __sctx="${1}"; shift
__dest="${1}"; shift
__port="${1}"; shift
__procs="$((${1} - 1))"; shift
@@ -33,14 +59,6 @@ test_iperf3() {
pane_or_context_run "${__cctx}" 'rm -f c*.json'
- pane_or_context_run_bg "${__sctx}" \
- 'for i in $(seq 0 '${__procs}'); do' \
- ' (iperf3 -s1 -p'${__port}' -i'${__time}') &' \
- ' echo $! > s${i}.pid; ' \
- 'done' \
-
- sleep 1 # Wait for server to be ready
-
# A 1s wait for connection on what's basically a local link
# indicates something is pretty wrong
__timeout=1000
@@ -55,17 +73,12 @@ test_iperf3() {
' wait' \
')'
- # Kill the server, just in case -1 didn't work right
- pane_or_context_run "${__sctx}" 'kill -INT $(cat s*.pid); rm s*.pid'
-
__jval=".end.sum_received.bits_per_second"
__bw=$(pane_or_context_output "${__cctx}" \
'cat c*.json | jq -rMs "map('${__jval}') | add"')
TEST_ONE_subs="$(list_add_pair "${TEST_ONE_subs}" "__${__var}__" "${__bw}" )"
-
- sleep 3 # Wait for kernel to free up ports
}
test_one_line() {
@@ -283,6 +296,12 @@ test_one_line() {
"lat")
table_value_latency ${__arg} || TEST_ONE_perf_nok=1
;;
+ "iperf3s")
+ test_iperf3s ${__arg}
+ ;;
+ "iperf3k")
+ test_iperf3k ${__arg}
+ ;;
"iperf3")
test_iperf3 ${__arg}
;;