From b818ef511ab1e19c4de927c76fe57ef36b8e89f0 Mon Sep 17 00:00:00 2001 From: "Bruce A. Mah" Date: Fri, 18 Sep 2020 10:16:21 -0700 Subject: [PATCH] Issue 982 (#1054) * fix: Make --reverse tests with --blockcount or --bytes actually terminate. Note that these options still don't really give intuitive results, because the ending conditions are evaluated on the client, which then needs to convey to the server via the control channel to stop sending. This will almost never result in the desired outcome of "a test of exactly N sends (or bytes) sent from the server to the client". Also add test cases for --blockcount / --bytes with --reverse. Towards #982. --- src/iperf_client_api.c | 15 ++++++++++++--- test_commands.sh | 6 ++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c index d0edf7dfe..88297bb42 100644 --- a/src/iperf_client_api.c +++ b/src/iperf_client_api.c @@ -539,11 +539,20 @@ iperf_run_client(struct iperf_test * test) iperf_time_now(&now); tmr_run(&now); - /* Is the test done yet? */ + /* + * Is the test done yet? We have to be out of omitting + * mode, and then we have to have fulfilled one of the + * ending criteria, either by times, bytes, or blocks. + * The bytes and blocks tests needs to handle both the + * cases of the client being the sender and the client + * being the receiver. + */ if ((!test->omitting) && ((test->duration != 0 && test->done) || - (test->settings->bytes != 0 && test->bytes_sent >= test->settings->bytes) || - (test->settings->blocks != 0 && test->blocks_sent >= test->settings->blocks))) { + (test->settings->bytes != 0 && (test->bytes_sent >= test->settings->bytes || + test->bytes_received >= test->settings->bytes)) || + (test->settings->blocks != 0 && (test->blocks_sent >= test->settings->blocks || + test->blocks_received >= test->settings->blocks)))) { // Unset non-blocking for non-UDP tests if (test->protocol->id != Pudp) { diff --git a/test_commands.sh b/test_commands.sh index 146d1dadf..1cf2f4363 100755 --- a/test_commands.sh +++ b/test_commands.sh @@ -51,11 +51,17 @@ host=$1 # -n flag ./src/iperf3 -c $host -n 5M ./src/iperf3 -c $host -n 5M -u -b1G +# -n flag with -R +./src/iperf3 -c $host -n 5M -R +./src/iperf3 -c $host -n 5M -u -b1G -R # conflicting -n -t flags ./src/iperf3 -c $host -n 5M -t 5 # -k mode ./src/iperf3 -c $host -k 1K ./src/iperf3 -c $host -k 1K -u -b1G +# -k mode with -R +./src/iperf3 -c $host -k 1K -R +./src/iperf3 -c $host -k 1K -u -b1G -R # CPU affinity ./src/iperf3 -c $host -A 2/2 ./src/iperf3 -c $host -A 2/2 -u -b1G