Fix mingw tests reporting (same as upstream) #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Re-post of stephane#794 into NUT fork's
rtu_usb
branch. Same description applies:Another part of work, done in NUT fork of libmodbus as a subset of #3, ripe for up-streaming to minimize context differences for eventual RTU USB contribution as such.
This PR focuses on usability of the libmodbus test suite to investigate problems seen by
make check
in diverse platform builds (including FreeBSD, OpenBSD, a couple of illumos/Solaris distros, MacOS+HomeBrew, Linux, Linux+MinGW and MSYS2 for Windows target).This selection of commits does not include any major attempts to fix the issues seen on those workers, but rather a large mostly cosmetic change set to represent the test progress:
tests/unit-test-client.c
, aTEST_TITLE()
macro was introduced to report the beginning of a test case, so that subsequent error messages issued by the library methods called byunit-test-client
can be attributed to this test case and aid in troubleshooting. The title string is remembered aslast_test_title[]
and reported in subsequent success or failure ofASSERT_TRUE()
message(s). Program text was reshuffled to begin the test cases with the title, and adapt the wording where needed, but there should not be any functional changes in the test cases just yet.tests/unit-test.h.in
andtests/unit-test-client.c
, aFLUSHOUT()
macro was introduced to facilitate debugging in Windows (GitBASH) console which tends to fluctuate between flushing out every character (so messing up reports from test server and client writing to same console) to buffering and only flushing every 4KB or so.cat
's seems to have helped the situation a lot more than peppering the code with flushing or even configuring the behavior withsetvbuf
, as explored in the fork's original PR.tests/unit-test-server.c
, added clearer logging about reasons of test set-up failure, if it happens.tests/unit-test-server.c
andtests/unit-test-client.c
(withip_or_device
) and intests/unit-test.h.in
(withUT_BITS_ADDRESS_VAL
), a few C fixes landed to help with some compilers and their view on standards and static analysis.FYI: Upstream PR stephane#792 seems like a useful addition to the test suite as well, although that case did not pop out in my experiments.