Skip to content

ci: build on macOS and Windows - #886

Open
yegorich wants to merge 5 commits into
stephane:masterfrom
yegorich:ci-macos-windows
Open

yegorich wants to merge 5 commits into
stephane:masterfrom
yegorich:ci-macos-windows

Conversation

@yegorich

@yegorich yegorich commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Add macOS and Windows jobs to the autotools workflow:

  • macOS: Homebrew autotools, make and make check. The test logs are printed when make check fails.
  • Windows: MSYS2 UCRT64 MinGW, build only (unit-tests.sh relies on killall, which MSYS2 doesn't provide). Git's core.autocrlf is disabled before checkout, because autoreconf fails on CRLF files.

Unit test fixes needed for macOS

make check failed on the macOS runner because two timing checks had margins too tight for a virtualized machine. The library itself is unchanged.

  • Byte timeout test (UT_REGISTERS_ADDRESS_BYTE_SLEEP_5_MS): the server sends its reply one byte every 5 ms, but sockets returned by modbus_tcp_accept() don't have TCP_NODELAY. After the first byte, Nagle's algorithm held back the remaining bytes until the client's delayed ACK, so the client received one byte and hit its 7 ms byte timeout. The test server now sets TCP_NODELAY before the byte-by-byte send. After that change, usleep(5000) still sometimes overslept by more than 2 ms, so the "adapted" byte timeout is now 50 ms instead of 7 ms. The "too small" case (3 ms < 5 ms) is unchanged.
  • test_server(): for an invalid request, the server sleeps its 0.5 s response timeout before flushing and replying, and the client waited only 0.6 s. The client now waits 2 s. No check there expects a timeout, so passing runs aren't slower.

Should the library set TCP_NODELAY on accepted sockets the same way it does on client sockets? That's left for a separate discussion, since it changes behaviour for every libmodbus server.

🤖 Generated with Claude Code

Add macOS (Homebrew autotools, make check) and Windows (MSYS2 UCRT64
MinGW, build only) jobs to the autotools workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cla-bot

cla-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

Windows runners check out with core.autocrlf=true, and autoreconf fails
on the resulting CRLF files. Disable the conversion before checkout.

Print the unit test logs when make check fails on macOS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cla-bot

cla-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

1 similar comment
@cla-bot

cla-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

The 'Adapted byte timeout (7ms > 5ms)' test failed on macOS: the unit
test server sends its reply one byte every 5 ms, but sockets returned by
modbus_tcp_accept() don't have TCP_NODELAY set, so after the first byte
the remaining ones were held back by Nagle's algorithm until the client's
delayed ACK, far longer than the 7 ms byte timeout.

Set TCP_NODELAY on the socket before sending the reply byte by byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cla-bot

cla-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

On the macOS CI runner the server's usleep(5000) between reply bytes
sometimes oversleeps by more than 2 ms, so the 7 ms byte timeout fired
mid-reply. Use 50 ms, still checking that a byte timeout larger than
the inter-byte delay succeeds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cla-bot

cla-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

Invalid requests make the server sleep its 0.5 s response timeout before
flushing and replying with an exception. The client waited only 0.6 s,
and on the macOS CI runner the reply sometimes arrived later than that.
Use 2 s; no check in test_server() expects a timeout so passing runs
don't get slower.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cla-bot

cla-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant