feat: S08.09 SolidSyslogFreeRtosTcpStream + tcp_transport BDD on QEMU#341
Conversation
- Flip ipconfigUSE_TCP=1 in Bdd/Targets/FreeRtos/FreeRTOSIPConfig.h with keep-alive enabled (10s) and the network buffer descriptor pool doubled (8 -> 16) to cover TCP retransmit windows alongside in-flight UDP. - Wire SolidSyslogSwitchingSender into Bdd/Targets/FreeRtos/main.c with UDP + TCP inner senders; default to UDP so existing @udp scenarios stay green, and add a `transport` set handler that routes through BddTargetSwitchConfig_SetByName so `--transport tcp` from the Behave harness lands as a transport flip over the UART. - Bump INTERACTIVE_TASK_STACK_DEPTH from *40 to *48 to absorb the extra formatter+address storage that StreamSender.Connect / TransmitFramed layer on top of the UDP-only stack consumption. - Pin setsockopt arg coverage in SolidSyslogFreeRtosTcpStreamTest (socket handle, level=0, optlen=sizeof(TickType_t)) so any regression in the bounded-connect contract surfaces at the test bar. - Add `--transport` -> `transport` translation in Behave's target_driver.py and admit @tcp scenarios in the freertos compose tag filter (excluding the @Buffered store-and-forward features that need the file abstraction not yet on FreeRTOS).
Production (Platform/FreeRtos/Source/SolidSyslogFreeRtosTcpStream.c): - Prefix every static with FreeRtosTcpStream_ for MISRA file-scope identifier uniqueness. - Replace negative guard `if (!IsOpen)` with `IsClosed` predicate so Open's outer condition reads positively. - Extract OpenSocket / ConnectOrCloseOnFailure / TryConnect / ClearTimeouts so Open / Send / Read each read as a single sequence at the stream-of-abstraction level (no native FreeRTOS calls inline). - Mirror the same Try* / *OrCloseOnFailure shape across Send and Read (SendOrCloseOnFailure / TrySend / AllBytesSent and ReceiveOrCloseOnFailure) so the three paths now read symmetrically. - Rename `rc` -> `sentCount` / `receivedCount` for intent. - Name the magic literals: SETSOCKOPT_LEVEL_DEFAULT and SEND_RECV_FLAGS_DEFAULT for the FreeRTOS-Plus-TCP placeholder zeros, and READ_FAILED for the -1 EOF/error sentinel from SolidSyslogStream_Read. Tests (Tests/FreeRtos/SolidSyslogFreeRtosTcpStreamTest.cpp): - Lift TEST_PORT / TEST_MESSAGE / TEST_MESSAGE_LEN / TEST_SHORT_WRITE_BYTES / TEST_READ_BYTES to file scope; replace inline literals throughout. - Add openStream() / readIntoBuffer() helpers on the TEST_GROUP so the arrange step in 25+ tests collapses to one line. - Add CHECK_SOCKET_CLOSED_ONCE macro that pins both the close call count and the identity of the closed socket. Apply it across the close-on-failure tests, tightening three sites that previously only pinned the call count (SendClosesSocketOnError, ReadReturnsNegativeOneOnErrorAndClosesSocket, DestroyClosesOpenSocket).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR implements TCP transport for SolidSyslog on FreeRTOS Plus-TCP. It delivers a new TCP stream adapter module, extends socket test fakes, enables TCP in the network config, integrates UDP+TCP switching into the BDD target, and adds comprehensive unit and BDD test coverage. ChangesFreeRTOS TCP Transport Adapter and BDD Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
☀️ Quality Summary 🚦 build-linux-gcc: 100% successful (✔️ 1111 passed, 🙈 3 skipped) Created by Quality Monitor v1.14.0 (#f3859fd). More details are shown in the GitHub Checks Result. |
Closes #338.
First of three slices for #271 (S08.06 TCP transport on FreeRTOS-Plus-TCP). Lands the FreeRTOS TCP stream adapter, extends the FreeRTOS sockets fake to cover the TCP-side API, flips Plus-TCP into TCP mode in the BDD target, and wraps UDP+TCP under SolidSyslogSwitchingSender so behave's `--transport tcp` flips the active transport over the UART.
Summary
The third commit on the branch rolls in the code-hygiene round (negative-logic removal, helper extraction to a single level of abstraction, MISRA-style class prefixes on every static, intent-revealing test macros, named test fixtures, magic-number cleanup) — see the commit message for the full list.
Test plan
Out of scope (deferred)
Summary by CodeRabbit
New Features
Tests
Chores