Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Fix TaskRunnerTest.MaybeExecuteTaskOnlyExpired flake#29484

Merged
bdero merged 2 commits into
flutter-team-archive:masterfrom
bdero:bdero/fix-92928
Nov 2, 2021
Merged

Fix TaskRunnerTest.MaybeExecuteTaskOnlyExpired flake#29484
bdero merged 2 commits into
flutter-team-archive:masterfrom
bdero:bdero/fix-92928

Conversation

@bdero

@bdero bdero commented Nov 2, 2021

Copy link
Copy Markdown
Contributor

Fixes flutter/flutter#92928.

This test was scheduling a task only 0.01ms into the future and verifying that it doesn't get executed (which may happen by the time runner.SimulateTimerAwake() samples the current time/depending on how precise it is).

@zanderso

zanderso commented Nov 2, 2021

Copy link
Copy Markdown
Contributor

Depending on how the mock runner samples the time, the way this test is written could be inherently flaky. Maybe @moko256 can advise.

/cc @cbracken

@bdero

bdero commented Nov 2, 2021

Copy link
Copy Markdown
Contributor Author

Since a function ptr for sampling the time is passed to the task runner, I went ahead and removed the time sampling to make it fully deterministic.

@cbracken cbracken left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm -- thanks @bdero!

@bdero
bdero merged commit 4e6f1de into flutter-team-archive:master Nov 2, 2021

@zanderso zanderso left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@moko256

moko256 commented Nov 3, 2021

Copy link
Copy Markdown
Contributor

Thanks @bdero!

The task_runner.cc is using std::chrono::steady_clock::now() to determine whether a task is expired. It is still not mocked up. To mock up it too will make the test more deterministic. I will send the PR later.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

Postsubmit windows shell flake: TaskRunnerTest.MaybeExecuteTaskOnlyExpired

4 participants