-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix unit tests that use Layer::ScheduleWork to actually run an event loop #22377
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
Comments
One issue with running the event loop: The unit tests currently do a cut down event loop thing where they run just one iteration of it, by manually doing:
in Comparing this to So we have public API to schedule work on the platform manager (via platform eventing), but not public API to tell it to process those events as needed. And of course on Darwin, scheduling work would usually use the Matter work queue, but that's not spun up in most unit tests. Trying to actually use the platform manager to run the event loop puts us in a position where the "run just one event loop iteration" thing doesn't work. So tests would need to be rewritten to actually allow the event loop to run async until the relevant callbacks happen, then do things from there, complete with issues wrt which thread things are running on. It seems like ideally the unit tests that are not using PlatformManager would be able to interpose their own |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
1 similar comment
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Problem
We would like to implement Layer::ScheduleWork in terms of Layer::ScheduleLambda, but currently the latter requires the platform manager event loop to be running. And we have tests that use Layer::ScheduleWork but do not run an actual event loop and expect it to magically work.
Proposed Solution
Fix unit tests that use ScheduleWork to run an event loop, and implement ScheduleWork on top of ScheduleLambda.
The text was updated successfully, but these errors were encountered: