Skip to content

Commit

Permalink
Fix wrong usleep value to wait 5 ms between bytes in test server
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane committed Oct 21, 2014
1 parent 0c131f8 commit 7e42fcf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions tests/unit-test-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,8 @@ int main(int argc, char *argv[])
old_response_to_usec);

if (use_backend == TCP) {
/* Test server is only able to test byte timeout with the TCP backend */
/* The test server is only able to test byte timeouts with the TCP
* backend */

/* Timeout of 3ms between bytes */
modbus_set_byte_timeout(ctx, 0, 3000);
Expand All @@ -551,7 +552,7 @@ int main(int argc, char *argv[])
usleep(11 * 5000);
modbus_flush(ctx);

/* Timeout of 10ms between bytes */
/* Timeout of 7ms between bytes */
modbus_set_byte_timeout(ctx, 0, 7000);
rc = modbus_read_registers(ctx, UT_REGISTERS_ADDRESS_BYTE_SLEEP_5_MS,
1, tab_rp_registers);
Expand Down
5 changes: 3 additions & 2 deletions tests/unit-test-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ int main(int argc, char*argv[])
return -1;
}

/* Unit tests of modbus_mapping_new (tests would not be sufficient if two nb_* were identical) */
/* Unit tests of modbus_mapping_new (tests would not be sufficient if two
nb_* were identical) */
if (mb_mapping->nb_bits != UT_BITS_ADDRESS + UT_BITS_NB) {
printf("Invalid nb bits (%d != %d)\n", UT_BITS_ADDRESS + UT_BITS_NB, mb_mapping->nb_bits);
modbus_free(ctx);
Expand Down Expand Up @@ -194,7 +195,7 @@ int main(int argc, char*argv[])
req[1] = query[1];
for (i=0; i < req_length; i++) {
printf("(%.2X)", req[i]);
usleep(500);
usleep(5000);
send(w_s, (const char*)(req + i), 1, MSG_NOSIGNAL);
}
continue;
Expand Down

0 comments on commit 7e42fcf

Please sign in to comment.