Repository navigation
Fix #442, insert a transaction that outranks every queued one at the front - #538
Open
SpaceOceanCorp wants to merge 1 commit into
Open
SpaceOceanCorp wants to merge 1 commit into
SpaceOceanCorp wants to merge 1 commit into
Conversation
…the front CF_InsertSortPrio searches the queue from the back for the last transaction whose priority is equal or higher (lower or equal number) and inserts after it. When there is none, the new transaction outranks every queued one, but it was inserted at the back. Insert it at the front instead. Adds CF_CList_InsertFront_Ex and a UT handler for CF_CList_InsertFront; the unit test for this case now expects the front insert.
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.
Description of Change
CF_InsertSortPriosearches the queue from the back for the last transaction whose priority is equal or higher (a lower or equal number) and inserts the new one after it. When there is no such transaction, the new one outranks everything queued, but it was inserted at the back, so it ran last. It is now inserted at the front.This follows the fix suggested in the issue: a new
CF_CList_InsertFront_Exincf_utils.h(the same pattern asCF_CList_InsertBack_Ex), used in that branch. An empty queue still usesCF_CList_InsertBack_Ex, which gives the same result.Linked Issue
Closes #442
Requirements Impact
Testing Evidence
Unit Tests (UT Assert)
The existing test for this case,
Test_CF_InsertSortPrio_When_p_t_Is_NULL_Call_CF_CList_InsertBack_Ex, asserted the old behavior. It is nowTest_CF_InsertSortPrio_When_No_Equal_Or_Higher_Priority_Found_Call_CF_CList_InsertFront_Exand checks thatCF_CList_InsertFrontis called once, on the right queue head and node, and thatCF_CList_InsertBackis not called.CF_CList_InsertFrontgets a default stub handler and context type to capture its arguments, the same asCF_CList_InsertBack.In the cFS bundle (029b3ab,
native_std, unit tests enabled) with this branch, CF builds with no warnings and all 14 CF unit-test suites pass. Withfsw/src/cf_utils.candcf_utils.hreverted and the updated test kept,cf_utilsfails. The changed files are clean under the cFS.clang-format(clang-format 19.1.7).Randomized check on the real queue code
The unit tests stub out the list functions, so they cannot show the resulting order. As a further check outside the PR, we compiled CF's real
cf_clist.ctogether withCF_PrioSearch,CF_InsertSortPrioand theCF_CList_*_Exhelpers, extracted verbatim fromdevand from this branch, with minimal stand-in types. The check inserts 1 to 40 transactions with random priorities 0 to 5 into one queue, 200,000 times, and walks the queue from its head, the order in whichCF_CFDP_StartFirstPendingtakes pending transactions. Built with ASan and UBSan:q_sizewrongdevCOSMOS Test Suite
N/A: no telemetry, command or table changes.
Areas of Expertise Touched
Author Checklist
.clang-formatF´'s
CfdpManager, which was ported from CF v3.0.0, has the same logic (Channel::insertSortPrio), noted in nasa/fprime#6377.CLA: cFS Apps corporate CLA filed by Space Ocean Corp.