Эх сурвалжийг харах

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

Stéphane Raimbault 10 жил өмнө
parent
commit
7e42fcf024

+ 3 - 2
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);

+ 3 - 2
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;