From 7e42fcf024f8b1032b3df6354e15d453869f2e15 Mon Sep 17 00:00:00 2001 From: Stéphane Raimbault Date: Tue, 21 Oct 2014 08:45:03 +0200 Subject: [PATCH] Fix wrong usleep value to wait 5 ms between bytes in test server --- tests/unit-test-client.c | 5 +++-- tests/unit-test-server.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/unit-test-client.c b/tests/unit-test-client.c index af2bb98..0bb0900 100644 --- a/tests/unit-test-client.c +++ b/tests/unit-test-client.c @@ -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); @@ -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); diff --git a/tests/unit-test-server.c b/tests/unit-test-server.c index 06b5ac3..77ed7b2 100644 --- a/tests/unit-test-server.c +++ b/tests/unit-test-server.c @@ -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); @@ -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; -- libgit2 0.21.4