-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix test_vfs_works failing on Windows due to extra Write events #830
Conversation
On Windows `notify` generates extra `Write` events for folders, which caused `process_tasks` to not handle all tasks generated on Windows. This fixes rust-lang#827
r? @pnkfelix What do you think about such fix? I think it's ok to be OS-specific here, to guarantee that we process all events. |
Hmm. If your goal is to process "all" pending events, why not loop without any bound on task count until you hit the first timeout, and then return in response to the timeout? The calling code will then be responsible for checking that the events that were processed actually cover the behavior of interest, right? |
Having said that, its looking like these tests are going to end up piling up hack-after-os-specific-hack anyway, so I'm not saying the approach of passing 4-vs-2 is unusable. I'm just want to understand what's wrong with the approach I outlined, which seems slightly more general. |
(I guess awaiting a timeout on every call to |
I like 2 vs 4 for two reasons:
|
My only other misgiving is that I don't understand the claim that this guarantees that we are "processing all events". By definition, the given approach just covers a fixed number (where that fixed number probably matches the total number of events on the platforms that people have bothered to check it).
In other words, its just a best-effort test. Its hard to make a sensible cross-platform test here. So I'll accept the hack, and maybe add further ones along these lines later once I finish figuring out the Mac OS X issues. |
bors r+ |
830: Fix test_vfs_works failing on Windows due to extra Write events r=pnkfelix a=vipentti On Windows `notify` generates extra `Write` events for folders, which caused `process_tasks` to not handle all tasks generated on Windows. This fixes #827 Co-authored-by: Ville Penttinen <[email protected]>
Build succeeded |
Hmm, I just thought of one way that might be able to check for this ... though it may depend on details of how the vfs This would act as a guard against the scenario where there was actually an unexpected event pending. |
Another options is to check that the event queue is empty at the very end of the test,once |
On Windows
notify
generates extraWrite
events for folders, which causedprocess_tasks
to not handle all tasks generated on Windows.This fixes #827