Added test + fixes + URC queue optimization - #46
Merged
Merged
Conversation
Prevent Ceedling from adding every STM32Cube directory to compiler include paths, which can exceed the system argument length limit.
Defer direct URC callbacks until framing determines whether binary data follows. Report the preserved URC line length after parser state resets.
Cover fragmented binary data, timeouts, I/O failures, parser recovery, response APIs, and interleaved URCs. Require URC callbacks to run and validate binary payload delivery with and without the URC queue.
Migrate the project configuration to Ceedling 1 syntax and plugins. Install the same Ceedling release in the STM32 build image and pin a compatible gcovr version for coverage reports.
Do not dequeue URCs while a fragmented binary URC still owns the enqueue mutex. Process the queue once reception completes.
Split binary URC headers and payloads across separate receive calls with and without the URC queue. Also fragment the response discard path when the caller's binary buffer is too small.
Store partial binary length bytes in the client receive state instead of a shared static buffer. This prevents interleaved clients from corrupting each other's binary frame lengths.
Interleave partial headers from two clients with different nonzero length bytes. Verify each client retains its own header before receiving the remaining payload.
Store direct URC payload data after the string terminator instead of overwriting it. Accept payloads that exactly fill the available direct or queued URC buffer.
Cover partial-header failures, zero-length frames, exact-fit buffers, opaque control bytes, oversized payload discard, and subsequent parser recovery with and without the URC queue.
Cover UART argument validation, reopen behavior, and background RX work. Fix the test fixture buffers so ring-buffer overflow checks remain bounded.
Hold the command mutex while closing the UART and checking whether background receive work may run. This prevents queued work from reading a UART after another thread closes it. Unwind intentionally incomplete commands in unit-test teardown before closing the client.
Drive command responses and URCs through the UART emulator, ISR, and background RX worker. Cover fragmented text and binary responses, fragmented binary URCs, timeout recovery, and immediate teardown.
Do not retain mutex ownership while a fragmented binary URC waits for more payload. Hide incomplete entries from dequeueing so another thread can safely abort the transaction when a receive session closes.
Serialize open with close and background RX. Clear partial parser and binary response state at session boundaries, and abort an incomplete queued binary URC before starting the next UART session.
Inject device initialization, UART configuration, and callback setup failures and verify a valid reopen after each one. Exercise repeated commands, text and binary URCs, close/reopen cycles, and interrupted binary payloads in regular and opt-in soak scenarios.
Support 1, 1.5, 2, and 3 Mbaud termios mappings used during module baud-rate negotiation.
Use poll() for nonblocking, timed, and blocking reads. Retry interrupted poll and read calls, and reject zero-progress writes to avoid an unbounded loop.
Skip receive handling while the client is closed and retry transient receive failures instead of terminating the process. Track successful thread creation so teardown never joins an invalid thread, and release pthread attributes after setup.
Exercise Linux UART configuration, binary transfers, timeout behavior, fault handling, and repeated open/close using pseudoterminals. Run the suite with sanitizers and gcov through inv test.posix.run.
Disable the UART peripheral clock when HAL initialization fails so a failed open does not leave hardware resources enabled.
Fail UART open and release initialized resources when the first interrupt-driven receive operation cannot be armed.
Split writes at the HAL transfer-size limit instead of truncating the requested length to 16 bits.
Treat negative read timeouts as infinite waits as documented, while retaining finite timeout and nonblocking behavior.
Reject duplicate RX task creation and let the task clear its own handle before deletion. Wait on that handle during teardown to avoid querying a failed or already deleted task.
Exercise the STM32 UART and FreeRTOS ports with host HAL and RTOS shims, including failure injection, fragmentation, overflow, timeout, large transfers, and repeated task lifecycle tests. Add Invoke tasks for sanitizer, coverage, and Renode integration runs.
Track initialization separately from the boot tick and calculate elapsed time with unsigned arithmetic. This avoids epoch resets at tick zero and negative elapsed times when the platform timer wraps.
Exercise initialization, timer rollover, busy-wait sleep, mutex state, and background RX stubs with a deterministic host clock. Add sanitizer and coverage execution through the test.no-os Invoke namespace and keep the standalone suite out of Ceedling discovery.
Start receive workers only while a client is open and wake them from UART readiness events instead of polling every 10 milliseconds. Keep command reads timed. Event-driven workers drain only bytes that are immediately available.
Verify idle workers remain blocked, UART input wakes them, and shutdown cancels pending waits across POSIX and FreeRTOS host tests.
Keep variable-length URC entries in circular storage so dequeue can advance a cursor instead of moving every remaining entry. Preserve contiguous binary payload buffers and align entry headers for targets that require halfword-aligned access.
Cover wrapped FIFO ordering, binary payload continuity, abort recovery, exact-capacity entries, alignment, sustained reuse, and full queues.
Add POSIX, no-OS, and STM32 host tests to a native test matrix. Run both Renode examples and align Ceedling with the project version. Keep the regular Zephyr suite in pull requests while excluding its long-running stress configuration.
Use explicit wrap state when calculating contiguous payload space so an entry ending at the read cursor cannot overwrite unread queue data.
Snapshot binary receive state under the command mutex before deciding whether queued URCs can be delivered outside the lock.
Verify that an entry filling the wrapped head reports no remaining binary payload space.
Compile the real Windows OS and UART ports against deterministic Win32 fakes. Cover COM configuration, I/O faults, event waits, and RX worker lifecycle.
Expose the Windows host suite through Invoke and execute it with MSVC on the native Windows pull request runner.
ante-ublox
requested review from
henningrehn,
magnushanssonublox and
ubx-cmag
September 7, 2026 12:24
Exclude native Windows tests from Ceedling and namespace mocked Win32 symbols so they do not conflict with kernel32.lib. Use one writable ccache directory for every STM32 Docker step.
ante-ublox
force-pushed
the
anan_fixes
branch
from
September 7, 2026 14:03
231ff9f to
ab5e7a8
Compare
ubx-cmag
approved these changes
Sep 8, 2026
ubx-cmag
left a comment
Contributor
There was a problem hiding this comment.
It's almost impossible to review this many files, but I have merged them to my matter branch and it seem to work well, lets merge this and fix later if anything new is found.
On STM32H7 I got 1.25 Mbit/s with HTTP download and 880 kbits/s with HTTPS (TLS)
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.
No description provided.