diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2022-09-02 12:04:33 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-09-07 11:01:22 +0200 |
commit | 29247d0db6953d7a3d45c4da763b487ef695ac1e (patch) | |
tree | 54c2f53ca616099062794afa7f6104af92bb42cc /test/lib | |
parent | 5c13b511d9e97ae24cfa7bb87a1e23648c8d8249 (diff) | |
download | passt-29247d0db6953d7a3d45c4da763b487ef695ac1e.tar passt-29247d0db6953d7a3d45c4da763b487ef695ac1e.tar.gz passt-29247d0db6953d7a3d45c4da763b487ef695ac1e.tar.bz2 passt-29247d0db6953d7a3d45c4da763b487ef695ac1e.tar.lz passt-29247d0db6953d7a3d45c4da763b487ef695ac1e.tar.xz passt-29247d0db6953d7a3d45c4da763b487ef695ac1e.tar.zst passt-29247d0db6953d7a3d45c4da763b487ef695ac1e.zip |
test: Parameterize run time for throughput performance tests
Currently all the throughput tests are run for 30s. This is reflected in
both the actual parameters given to the iperf commands, but also in the
matching sleeps in test_iperf3.
Allow this to be adjusted more easily with a new parameter to test_iperf3.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[sbrivio: Reflect new parameter in comment to test_iperf3()]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/lib')
-rwxr-xr-x | test/lib/test | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/lib/test b/test/lib/test index 600399b..b293b34 100755 --- a/test/lib/test +++ b/test/lib/test @@ -20,6 +20,7 @@ # $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 # $@: Client options test_iperf3() { __var="${1}"; shift @@ -28,6 +29,7 @@ test_iperf3() { __dest="${1}"; shift __port="${1}"; shift __procs="$((${1} - 1))"; shift + __time="${1}"; shift pane_run "${__spane}" 'for i in $(seq 0 '${__procs}'); do' \ ':> s${i}.bw; done' @@ -42,8 +44,8 @@ test_iperf3() { sleep 2 pane_run "${__cpane}" 'for i in $(seq 0 '${__procs}');' \ 'do ( iperf3 -c '"${__dest}"' -p '"${__port}" \ - "${@}" ' -T s${i} & echo $! > c${i}.pid & ); done' - sleep 40 + '-t'${__time} "${@}" ' -T s${i} & echo $! > c${i}.pid & ); done' + sleep $(echo ${__time} + 10 | bc -l) pane_run "${__cpane}" 'for i in $(seq 0 '${__procs}'); do'\ 'kill -INT $(cat c${i}.pid) 2>/dev/null; done' ) & @@ -57,7 +59,7 @@ test_iperf3() { 'done' else pane_run "${__spane}" 'for i in $(seq 0 '${__procs}');' \ - 'do ( ( iperf3 -s1J -i 30 -p '"${__port}" \ + 'do ( ( iperf3 -s1J -i '${__time}' -p '"${__port}" \ '& echo $! > s${i}.pid ) 2>/dev/null' \ '| jq -rM ".intervals[0].sum.bits_per_second"' \ '> s${i}.bw & );' \ @@ -65,7 +67,7 @@ test_iperf3() { fi pane_status "${__spane}" - sleep 45 + sleep $(echo ${__time} + 15 | bc -l) pane_run "${__spane}" 'for i in $(seq 0 '${__procs}'); do' \ 'kill -INT $(cat s${i}.pid) 2>/dev/null; done' sleep 4 |