Testing

The configuration option CYGPKG_MODBUS_TESTS defines a set of tests that are built.

By default the package will only build the deterministic, automatic, tests. However, the option CYGPKG_MODBUS_TESTS_MANUAL can be defined to build extra tests that may required manual user-intervention, or are more realistic real-world example applications.

modbus_ut

The modbus_ut test application performs some unit-testing of the ModbusTCP server implementation. The test assumes specific features of the tests/backend_dummy.c backend implementation to perform a variety of fixed tests.

Since the backend handler funtions can NEVER block the test code will explicitly test pending responses to simulate application situations where hardware responses may take arbitrary periods of time, and hence are passed to other user-application threads for processing.

Note: When configured against the lwIP network stack the unit-testing relies on lwIP being configured with CYGFUN_LWIP_NETIF_LOOPBACK. This is required to allow the test code to connect to the ModbusTCP server running on the same network interface.

modbus_server

The modbus_server is only built when CYGPKG_MODBUS_TESTS_MANUAL is configured. It uses the tests/backend_dummy.c as the backend for a simple example server.

The application just runs for a fixed period of time before terminating, and can be used with external ModbusTCP clients.

2017-02-09
Documentation license for this page: eCosPro License