-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated AppContext, LoopbackMessagingContext, and UDPMessagingContext to serve as PW test fixture classes. #34036
Updated AppContext, LoopbackMessagingContext, and UDPMessagingContext to serve as PW test fixture classes. #34036
Conversation
… reflect PW migration.
…ved LoopbackMessagingContext data to heap.
PR #34036: Size comparison from 3f59179 to d43b087 Full report (27 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, mbed, nxp, qpg, stm32, tizen)
|
PR #34036: Size comparison from 3f59179 to a02c9d7 Full report (62 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, esp32, linux, mbed, nxp, qpg, stm32, telink, tizen)
|
PR #34036: Size comparison from 2af3379 to 4fefac4 Full report (79 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, esp32, linux, mbed, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #34036: Size comparison from e5acdc9 to 789d6c0 Full report (49 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, tizen)
|
PR #34036: Size comparison from f8a633e to f61c712 Full report (20 builds for cc13x4_26x4, cc32xx, mbed, nrfconnect, nxp, qpg, stm32, tizen)
|
PR #34036: Size comparison from f8a633e to 3d37fc4 Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #34036: Size comparison from f199ba4 to f4f25fc Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #34036: Size comparison from 35eba86 to a85954e Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving assuming remaining comments will be addressed.
…easel0/connectedhomeip into feature/appcontext-refactoring
PR #34036: Size comparison from 35eba86 to 71f1caf Full report (8 builds for cc32xx, mbed, qpg, stm32, tizen)
|
PR #34036: Size comparison from 35eba86 to 7c35ed2 Increases above 0.2%:
Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
… to serve as PW test fixture classes. (project-chip#34036) * Modified MessagingContext and its subclasses as well as AppContext to reflect PW migration. * Modifed all tests that use LoopbackMessagingContext or AppContext. Moved LoopbackMessagingContext data to heap. * Removed unneeded scope from call to parent setup/teardown * Made some helper functions into class methods. * Restyled by prettier-markdown * Reverted TestICDManager back to using LoopbackMessagingContext * fixing merge conflicts * fixing merge conflicts * Fixed duplicate code and missing semicolon * Trying to update TestReadHandler_DataVersionFiltersTruncated * Restyled by whitespace * Restyled by clang-format * fixed problem with the new TestReadHandler_DataVersionFiltersTruncated * fix in tracing * Changes to MessagingContext member variable initialization in response to code review * Used std::unique_ptr for MessagingContext.mpData --------- Co-authored-by: Restyled.io <commits@restyled.io>
… to serve as PW test fixture classes. (project-chip#34036) * Modified MessagingContext and its subclasses as well as AppContext to reflect PW migration. * Modifed all tests that use LoopbackMessagingContext or AppContext. Moved LoopbackMessagingContext data to heap. * Removed unneeded scope from call to parent setup/teardown * Made some helper functions into class methods. * Restyled by prettier-markdown * Reverted TestICDManager back to using LoopbackMessagingContext * fixing merge conflicts * fixing merge conflicts * Fixed duplicate code and missing semicolon * Trying to update TestReadHandler_DataVersionFiltersTruncated * Restyled by whitespace * Restyled by clang-format * fixed problem with the new TestReadHandler_DataVersionFiltersTruncated * fix in tracing * Changes to MessagingContext member variable initialization in response to code review * Used std::unique_ptr for MessagingContext.mpData --------- Co-authored-by: Restyled.io <commits@restyled.io>
AppContext, LoopbackMessagingContext, and UDPMessagingContext have member functions that resemble the setup/teardown functions of pigweed (SetUp, TearDown, SetUpTestSuite, TearDownTestSuite), however we are not currently using these classes as actual pigweed test fixture classes. Instead each unit test is creating a test fixture class that contains a pointer to AppContext (or LoopbackMessagingContext, or UDPMessagingContext), and then it dynamically creates the object when the test runs, and deletes it when it's finished. This leads to a lot of redundant code, since each unit test has to do this.
This PR modifies LoopbackMessagingContext and UDPMessagingContext so that they inherit from
::testing::Test
. Since AppContext inherits from LoopbackMessagingContext, it too can be used as a pigweed test fixture class.This PR also modifies all the unit tests that are dynamically creating AppContext, LoopbackMessagingContext, or UDPMessagingContext objects so that they instead inherit from the class directly. This leads to a significant reduction of code, and in many cases the unit test doesn't even need to define a fixture class at all (it can just do
using TestSomething = AppContext;
, or whichever context class it's using).To address the issue of the memory footprint, this PR also modifies MessagingContext and LoopbackMessagingContext so that they store their member variables on the heap, since this was a concern that may have been preventing us from adopting this method earlier.
Here is a summary of what these classes do.
::testing::Test
is what each pigweed unit test (with a fixture) must inherit. The goal is to move this inheritance somewhere else in order to simplify the unit tests.Right now we have 25 test sources that use AppContext (in
src/app/tests
andsrc/controller/tests
), we have 8 test sources that use LoopbackMessagingContext (insrc/messaging/tests
andsrc/protocols/secure_channel/tests
), and we have 1 test source that uses UDPMessagingContext (insrc/messaging/tests
).