Commit 7e42fcf024f8b1032b3df6354e15d453869f2e15

Authored by Stéphane Raimbault
1 parent 0c131f83

Fix wrong usleep value to wait 5 ms between bytes in test server

tests/unit-test-client.c
... ... @@ -538,7 +538,8 @@ int main(int argc, char *argv[])
538 538 old_response_to_usec);
539 539  
540 540 if (use_backend == TCP) {
541   - /* Test server is only able to test byte timeout with the TCP backend */
  541 + /* The test server is only able to test byte timeouts with the TCP
  542 + * backend */
542 543  
543 544 /* Timeout of 3ms between bytes */
544 545 modbus_set_byte_timeout(ctx, 0, 3000);
... ... @@ -551,7 +552,7 @@ int main(int argc, char *argv[])
551 552 usleep(11 * 5000);
552 553 modbus_flush(ctx);
553 554  
554   - /* Timeout of 10ms between bytes */
  555 + /* Timeout of 7ms between bytes */
555 556 modbus_set_byte_timeout(ctx, 0, 7000);
556 557 rc = modbus_read_registers(ctx, UT_REGISTERS_ADDRESS_BYTE_SLEEP_5_MS,
557 558 1, tab_rp_registers);
... ...
tests/unit-test-server.c
... ... @@ -84,7 +84,8 @@ int main(int argc, char*argv[])
84 84 return -1;
85 85 }
86 86  
87   - /* Unit tests of modbus_mapping_new (tests would not be sufficient if two nb_* were identical) */
  87 + /* Unit tests of modbus_mapping_new (tests would not be sufficient if two
  88 + nb_* were identical) */
88 89 if (mb_mapping->nb_bits != UT_BITS_ADDRESS + UT_BITS_NB) {
89 90 printf("Invalid nb bits (%d != %d)\n", UT_BITS_ADDRESS + UT_BITS_NB, mb_mapping->nb_bits);
90 91 modbus_free(ctx);
... ... @@ -194,7 +195,7 @@ int main(int argc, char*argv[])
194 195 req[1] = query[1];
195 196 for (i=0; i < req_length; i++) {
196 197 printf("(%.2X)", req[i]);
197   - usleep(500);
  198 + usleep(5000);
198 199 send(w_s, (const char*)(req + i), 1, MSG_NOSIGNAL);
199 200 }
200 201 continue;
... ...