@@ -739,19 +739,25 @@ int main(int argc, char *argv[])
739739 usleep (1000000 );
740740 modbus_flush (ctx );
741741
742- #if defined(_WIN32 ) || defined(__FreeBSD__ ) || defined(__OpenBSD__ )
743- /* Timeout of 20ms between bytes, allow for 2*16+1
744- * Windows sleep seems to be at least 15ms always
745- * Windows sleep seems to be at least 15ms always.
746- * For some reason, FreeBSD 12 and OpenBSD 6.5 also
747- * tended to fail with 7ms variant as "gmake check"
748- * but pass in
749- * gmake -j 8 && ( ./tests/unit-test-server|cat & sleep 1 ; ./tests/unit-test-client|cat )
750- */
742+ #if defined(_WIN32 )
743+ /* Timeout of 20ms between bytes, allow for 2*16+1
744+ * Windows sleep seems to be at least 15ms always.
745+ */
751746 TEST_TITLE ("2/2 Adapted byte timeout (33ms > 20ms)" );
752747 modbus_set_byte_timeout (ctx , 0 , 33000 );
753748 rc = modbus_read_registers (
754749 ctx , UT_REGISTERS_ADDRESS_BYTE_SLEEP_20_MS , 1 , tab_rp_registers );
750+ #elif defined(__FreeBSD__ ) || defined(__OpenBSD__ )
751+ /* For some reason, FreeBSD 12 and OpenBSD 6.5 also
752+ * tended to fail with 7ms and even 33ms variants
753+ * as "gmake check", but passed in
754+ * gmake -j 8 && ( ./tests/unit-test-server|cat & sleep 1 ; ./tests/unit-test-client|cat )
755+ * An even longer timeout seems to satisfy all of them.
756+ */
757+ TEST_TITLE ("2/2 Adapted byte timeout (66ms > 20ms)" );
758+ modbus_set_byte_timeout (ctx , 0 , 66000 );
759+ rc = modbus_read_registers (
760+ ctx , UT_REGISTERS_ADDRESS_BYTE_SLEEP_20_MS , 1 , tab_rp_registers );
755761#else
756762 /* Timeout of 7ms between bytes */
757763 TEST_TITLE ("2/2 Adapted byte timeout (7ms > 5ms)" );
0 commit comments