Reworks the FSW tests to be 100% passing.
- Adds path validation to most tests.
- Adds a Retry mechanism to handle expected intermittent failures due to untrustworthy underlying API calls.
- Adds more test cases to NotifyFilter and splits existing tests into separate dir/file tests to cover either behavior.
- Enable test parallelization
Commit migrated from https://github.com/dotnet/corefx/commit/28d10fa256f40c3d37a8cb82d96a1e5520df03d2
- Add Common TempDirectory class for short-term temporary directories that are easy to create and destroy
- Put all FSW tests into the System.IO.Tests namespace
- Modify all FSW tests to use the common TempFile/TempDirectory classes instead of their own custom one
- Modify all FSW tests to watch for events in a temporary directory. There shouldn't be any more new items being created or watched in the runtime folder.
- Fix the SymLink tests to use the ConditionalFact attribute similar to how the FileSystem tests function.
- Remove the unnecessary symlink print statements being outputted by the FileSystem CreateSymbolicLink function.
Commit migrated from https://github.com/dotnet/corefx/commit/65356f9471850b796d01f63536c3ba36e504f8e1
- On Linux, FileSystemWatcher is built on top of inotify, which has various limits configured in the system for how many instances and watches can be created. When these limits are hit, exceptions are generated, but the Linux-provided error messages are cryptic about what the problem is. This change adds better error messages for those cases. It also ensures that errors regarding watch limits always come out of OnError rather than sometimes being thrown synchronously from EnableRaisingEvents and other times coming out asynchronously.
- As part of fixing that, I noticed that we had some reliability issues around marking the instance as enabled. I fixed this up to ensure that we only mark the instance as enabled when we've created everything we need to successfully launch it.
- While doing that, I noticed that on OS X, if we restart an FSW, we were unnecessarily re-creating a delegate. I changed it to avoid the unnecessary allocation.
- And while doing that, I also noticed that we we had a bad exception message when constructing an FSW with something other than a directory. I fixed the error message.
- I added tests for all these things.
Commit migrated from https://github.com/dotnet/corefx/commit/57cf111281a22feafb83854789680680da3cab50
The FSW tests still take ~10 seconds on my machine, most of which is spent waiting for events to not fire. This change just separates the tests out so that they're not all on the same class, letting xunit parallelize them. They now take ~3.5 seconds on my machine.
Commit migrated from https://github.com/dotnet/corefx/commit/2fbabe417accb662a6ed63a40506dea0268cf8e2
This commit fixes issues highlighted when running the System.IO.FileSystem.Watcher tests on Linux. There are 49 tests that pass on Windows; after these product and test fixes, only 7 of those fail on Linux, all due to Windows-specific tests that will need to be tweaked based on target system or disabled entirely on Linux:
- 2 are P/Invoking to Win32 functions related to security
- 3 are trying to overflow the event buffer but not doing so on Linux
- 2 are expecting case-insensitive file paths
Commit migrated from https://github.com/dotnet/corefx/commit/7176a0dc531a1a9c9032c36330bbf92e7ca57f65