CI: add mingw-w64 job + headless stdin-binary regression test#101
Merged
Conversation
The stream-link TX demos read a binary <u32_le len><PSDU> stream from stdin, which only works on Windows if stdin is in binary mode. That gate has to be _WIN32 (not _MSC_VER) so it also fires under mingw/GCC — a distinction CI never exercised, because the Windows matrix cell is MSVC + vcpkg only. A build-only mingw job would still miss it: reverting the gate to _MSC_VER compiles clean on mingw and only truncates bytes at runtime. So this does two things: 1. build-mingw job (MSYS2 / MINGW64, libusb via pkg-config, VCPKG_ROOT unset) — builds the library, the two stream demos and the self-test, then runs ctest. Exercises the CMake pkg-config path the MSVC+vcpkg cell never hits. The other demos (WiFiDriverDemo / WiFiDriverTxDemo / PrecoderDemo) use POSIX-only APIs such as fork() and are intentionally not built here — they were never mingw targets. 2. A headless self-test that catches the runtime regression. Extract the binary-stdin gate + length-prefixed reader into txdemo/stream_stdin.h (single source of truth, used by both stream demos), add StreamStdinSelftest which round-trips a canonical stream containing 0x1A/CRLF with no libusb, and register it as the stream_stdin_binary ctest (tests/stream_stdin_test.cmake pipes --gen into the reader). Because the demos and the self-test share the same gate, reverting it fails ctest on the Windows/mingw jobs. ctest now runs in every CI job (the existing matrix cells too, so a total gate removal is caught on MSVC as well). Verified locally on macOS: all targets build, the test passes, and a truncated-at-0x1A stream fails it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
024054f to
6dc0d13
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
CI builds the Windows target with MSVC + vcpkg only — mingw-w64 (GCC on Windows) is never exercised. That's the toolchain the recent stream-demo binary-stdin fix (#100) targets: mingw defines
_WIN32but not_MSC_VER, and gets libusb from pkg-config rather than vcpkg. Two gaps follow:VCPKG_ROOTguard, or a missing include branch)._setmodegate from_WIN32back to_MSC_VERcompiles clean on mingw and only truncates the first PSDU at runtime.Change
1.
build-mingwCI job — MSYS2 / MINGW64, libusb viapkgconf,VCPKG_ROOTunset (so CMake takes the pkg-config path). Builds all targets and runsctest.2. Headless stdin-binary regression test
txdemo/stream_stdin.h— single source of truth for the_WIN32-gatedset_stdin_binary()plus a tri-stateread_exact(). Both stream demos now use it (removes two duplicateread_exactcopies; behavior preserved —StreamTxDemoaborts on a truncated record,StreamDuplexDemostops its TX thread and keeps RX running).StreamStdinSelftest+tests/stream_stdin_test.cmake— pipes a canonical<u32_le len><PSDU>stream containing0x1A/CRLF through the same gate the demos use and asserts the round-trip. No libusb, no radio. Registered as thestream_stdin_binaryctest.Because the demos and the self-test share the gate, a regression fails
cteston the Windows/mingw jobs instead of only surfacing on hardware.ctestnow runs in every job, so a total gate removal is also caught on the MSVC cell.Verification
Local (macOS): all targets build,
ctestpasses (records=5 bytes=20 OK), and a truncated-at-0x1Astream correctly fails the test. The mingw job and Windows text-mode behavior validate in CI.Notes
build-mingwis intentionally not a required status check yet — suggest landing it non-required and promoting once it's proven stable.io.h/fcntl.hin the demos'_MSC_VER/__MINGW32__include branches were left in place to keep this diff off the just-merged StreamTxDemo: fix mingw/Windows-GCC build and binary stdin #100 include structure; trivial follow-up to tidy.🤖 Generated with Claude Code