summaryrefslogtreecommitdiff
path: root/test/tx/regression/threadx_queue_trace_test.c
AgeCommit message (Collapse)Author
2026-09-15Covered the queue services' trace inserts in every system stateFrédéric Desbiens
Each queue service carries one TX_TRACE_IN_LINE_INSERT, and gcov scores twelve branch outcomes for the macro. Nine of those inserts sat at one or five of twelve, 91 uncovered outcomes in all, because exactly one test in the suite ever turns tracing on and it does not drive the queue API. The code runs -- the sites are hit hundreds of times -- but tracing is never enabled when it does. The new test enables tracing and walks all nine services once per condition the macro distinguishes: in thread context, in interrupt context from the test ISR dispatch, with the system state forced to TX_INITIALIZE_IN_PROGRESS, with the queue event class filtered out, and across a buffer wrap with and without a buffer-full notification registered. That is every arm of the macro, so all nine sites reach twelve of twelve and the whole queue subsystem -- 22 files, 596 lines, 394 branches -- is at 100% line and branch in the trace configuration and in the merged report. Two techniques need stating, because both reach into the kernel from the test rather than through the API. The system state is written directly, with interrupts held off across the pass. The initialization arm of the macro is otherwise unreachable: the only caller that runs at that state is tx_application_define, and under the ctest harness that entry point belongs to the test control code, not to the test. Interrupts are disabled for the pass so the timer thread cannot observe the forced value, and the same variable's interrupt nesting count is restored before anything else reads it. Create and delete are driven through _tx_queue_create and _tx_queue_delete in the forced-state passes. The error checking shell rejects both from any caller that is not a thread, so the inserts behind it cannot be reached any other way. The shell itself is already at 100% from its own tests; what these passes cover is the insert behind it. The trace buffer is positioned one entry short of its end before each service in the wrap passes. Filling the buffer instead wraps it on whichever service happens to write the last entry, which covers one site and leaves the other eight; positioning puts each service's own insert on the boundary in turn. The buffer is also small enough that ordinary use wraps it many times over, and the test fails unless the notification is called once per service. This is the test shape the remaining subsystems will follow, worked end to end on one of them first. Merged coverage over the five build configurations rises from 3329/4108 branches to 3421/4108, with lines unchanged at 4204/4220. The branch gate goes to 82.50, below the measured figure by the same margin the line gate carries, because the resume-from-ISR sites still move between runs. Assisted-by: Claude Code (Opus 5) <[email protected]>