Skip to content

[SL-ONLY] Add unit tests for OTATlvProcessor - #1028

Draft
Arghya Dutta (silabs-ArghyaD) wants to merge 3 commits into
mainfrom
add_otatlv_unit_tests
Draft

Arghya Dutta (silabs-ArghyaD) wants to merge 3 commits into
mainfrom
add_otatlv_unit_tests

Conversation

@silabs-ArghyaD

Copy link
Copy Markdown
Contributor

Summary

Created unit tests for OTATlvProcessor
Coverage:

  • Buffer/state helpers — IsValidTag, IsError, OTADataAccumulator (Init/Accumulate/Clear), and Init/Clear lifecycle (descriptor callback required, state reset on clear).
  • Process() state machine — partial vs complete TLV handling, CHIP_OTA_CHANGE_PROCESSOR on completion, progress codes (BUFFER_TOO_SMALL, FETCH_ALREADY_SCHEDULED) that still advance, fatal errors that do not (including mid-stream), and failed ExitAction.

Related issues

MATTER-5934

Testing

Locally tested the unit tests.
Output -

[==========] Running all tests.
[ RUN      ] OTATlvProcessorIsValidTag.AcceptsKnownTagsAndRejectsOutOfRange
[       OK ] OTATlvProcessorIsValidTag.AcceptsKnownTagsAndRejectsOutOfRange
[ RUN      ] OTATlvProcessorFixture.IsErrorTreatsProgressCodesAsNonErrors
[       OK ] OTATlvProcessorFixture.IsErrorTreatsProgressCodesAsNonErrors
[ RUN      ] OTATlvProcessorFixture.IsErrorTreatsOtaChangeProcessorAsFailure
[       OK ] OTATlvProcessorFixture.IsErrorTreatsOtaChangeProcessorAsFailure
[ RUN      ] OTATlvProcessorFixture.ProcessPartialBlockReturnsNoError
[       OK ] OTATlvProcessorFixture.ProcessPartialBlockReturnsNoError
[ RUN      ] OTATlvProcessorFixture.ProcessCompleteBlockReturnsChangeProcessor
[       OK ] OTATlvProcessorFixture.ProcessCompleteBlockReturnsChangeProcessor
[ RUN      ] OTATlvProcessorFixture.ProcessFatalErrorDoesNotAdvance
[       OK ] OTATlvProcessorFixture.ProcessFatalErrorDoesNotAdvance
[ RUN      ] OTATlvProcessorFixture.ProcessBufferTooSmallStillAdvances
[       OK ] OTATlvProcessorFixture.ProcessBufferTooSmallStillAdvances
[ RUN      ] OTATlvProcessorFixture.ProcessFetchScheduledStillAdvances
[       OK ] OTATlvProcessorFixture.ProcessFetchScheduledStillAdvances
[ RUN      ] OTATlvProcessorFixture.ProcessMultiChunkUntilComplete
[       OK ] OTATlvProcessorFixture.ProcessMultiChunkUntilComplete
[ RUN      ] OTATlvProcessorFixture.ProcessExactLengthWithNoRemainder
[       OK ] OTATlvProcessorFixture.ProcessExactLengthWithNoRemainder
[ RUN      ] OTATlvProcessorFixture.ProcessFatalErrorMidStream
[       OK ] OTATlvProcessorFixture.ProcessFatalErrorMidStream
[ RUN      ] OTATlvProcessorFixture.ProcessExitActionFailure
[       OK ] OTATlvProcessorFixture.ProcessExitActionFailure
[ RUN      ] OTADataAccumulator.AccumulatesUntilThreshold
[       OK ] OTADataAccumulator.AccumulatesUntilThreshold
[ RUN      ] OTADataAccumulator.LeavesRemainderInBlock
[       OK ] OTADataAccumulator.LeavesRemainderInBlock
[ RUN      ] OTATlvProcessorInit.RequiresDescriptorCallback
[       OK ] OTATlvProcessorInit.RequiresDescriptorCallback
[ RUN      ] OTATlvProcessorInit.SucceedsWithDescriptorCallback
[       OK ] OTATlvProcessorInit.SucceedsWithDescriptorCallback
[ RUN      ] OTATlvProcessorClear.ResetsProcessorState
[       OK ] OTATlvProcessorClear.ResetsProcessorState
[==========] Done running all tests.
[  PASSED  ] 17 test(s).

@silabs-ArghyaD Arghya Dutta (silabs-ArghyaD) changed the title Added unit tests for OTATlvProcessor [SL-ONLY] Added unit tests for OTATlvProcessor Jun 19, 2026
@silabs-matter-ci-bot silabs-matter-ci-bot Bot added the sl-only This TAG indicates that this commit is a silabs-specific commit that cannot be upstreamed to CSA. label Jun 19, 2026
@silabs-ArghyaD Arghya Dutta (silabs-ArghyaD) changed the title [SL-ONLY] Added unit tests for OTATlvProcessor [SL-ONLY] Add unit tests for OTATlvProcessor Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sl-only This TAG indicates that this commit is a silabs-specific commit that cannot be upstreamed to CSA.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants