Repository navigation
fix(Foundation): TaskManagerTest::testCancel waits for the progress notification - #5607
Merged
Merged
Conversation
…otification Task::setProgress() stores the progress before the TaskProgressNotification reaches the observer, so the test could check the progress of the observer before the notification arrived. Wait for the observer, as testFinish does.
With the race in the test fixed, cppignore.win no longer needs the entry.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the cancellation-test synchronization change and its re-enablement on Windows.
No open issues 🎉
What changed in this PR
Fixes an intermittent failure in Foundation’s task-cancellation test by waiting for the observer to receive progress, rather than only for the task’s internal progress to change.
Changes:
- Updates
testCancelto wait for observed progress before asserting its value, matchingtestFinish. - Re-enables
testCancelon Windows by removing its ignore entry.
| File | Description |
|---|---|
Foundation/testsuite/src/TaskManagerTest.cpp |
Waits for observer progress to avoid the notification race. |
cppignore.win |
Removes the Windows exclusion for testCancel. |
Review effort: Balanced
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.
TaskManagerTest::testCancel fails intermittently on
to.progress() == 0.5(TaskManagerTest.cpp:353), for example in linux-gcc-cmake-poco-soo-off on #5601 and in linux-gcc-cmake-sanitizers (hidden-asan) on #5517. The test waits until the task reports progress 0.5 and then checks the observer. Task::setProgress() stores the progress before it posts the TaskProgressNotification, so the check can run before the observer has received it.Tests: TaskManagerTest::testCancel passed 100 runs in a row, and TaskManagerTest passed, on Windows ARM64 with MSVC. CI runs it on Windows without the ignore entry.