Skip to content

Commit

Permalink
Issue 982 (#1054)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
bmah888 authored Sep 18, 2020
1 parent 52d0de3 commit b818ef5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/iperf_client_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions test_commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b818ef5

Please sign in to comment.