From 29247d0db6953d7a3d45c4da763b487ef695ac1e Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 2 Sep 2022 12:04:33 +1000 Subject: 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 [sbrivio: Reflect new parameter in comment to test_iperf3()] Signed-off-by: Stefano Brivio --- test/lib/test | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'test/lib') 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 -- cgit v1.2.3