Commit Graph
7 Commits
Author SHA1 Message Date
stephentoub 6c5af28f87 Change timeouts on FSW tests
When we're waiting for an event that we know will arrive, we can wait for a fairly long time, because if it doesn't arrive we're going to fail the tests anyway.  This changes makes all of the ExpectEvent calls use a long timeout, much longer than most were previously using.  In the process I removed all of the custom values being passed, as they were all the same or shorter than the new default.  This should help to minimize avoid false positive flakiness.


Commit migrated from https://github.com/dotnet/corefx/commit/81e84b7910244f2f72ba760c100b16c01a38877c
2015-08-11 19:36:20 -04:00
stephentoub 8ce1a4b748 Allow FSW tests to be parallelized
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
2015-08-07 14:17:04 -04:00
Nick Guerrera 046e1595fa Fix FileSystemWatcher test race + wrong event name
On Linux, depending on the timing of events, we can sometimes generate
delete+create instead of rename. As such, we can't perform renames and
test that no create or delete is raised when we're running on Linux.

The issue had so far only arisen on the negative create test and not the
negative delete test, which turned out to be because the negative delete
test was using the wrong event name.


Commit migrated from https://github.com/dotnet/corefx/commit/56c279db8707bf9246109b1ff232925e0312b7f8
2015-08-06 12:55:23 -07:00
Ian Hays e6e252aabf Modified Unix File.Move to use link/unlink instead of rename
Changed the way the UnixFileSystem does File moving; it was previously implemented using the rename syscall but now uses a combination of link and unlink. The side effect of this change is that the FileSystemWatcher will now treat File.Move as a deletion.

- Resolves dotnet/corefx#2460
- Removed all tests from FileSystemWatcher that made calls to File.Move and consolidated them into a new file: FileSystemWatcher.MoveFile.cs. This new file separates tests into Windows and Unix categories and uses Theories to supply the input WatcherChangeType and whether a move should trigger an event for the given type. If we later decide to change the Unix behavior of MoveFile, changing the FileSystemWatcher tests will be a simple matter of flipping the boolean values for the affected tests.
- Fixed some comments in UnixFileSystem to be more specific to FileSystemWatcher
- Changed variable names for FSW Move tests to be more descriptive
- Modified FSW MoveFile and Utitlity helper classes to use guids so that they may be run concurrently.


Commit migrated from https://github.com/dotnet/corefx/commit/cae7c5116d46c0d98e6f0fb3526fa2a15945501a
2015-08-04 15:47:56 -07:00
stephentoub 782d1a5d02 Fix ObjectDisposedException in FileSystemWatcher tests
In my code review of @sokket's new FileSystemWatcher tests (dotnet/corefx#2347), I'd encouraged him to clean up some of the AutoResetEvents that were being created, in the name of good hygiene.  But this introduces a sporadic failure in the tests due to a race condition.

The way that FileSystemWatcher is designed, stopping events on the instance doesn't actually prevent any in-progress operations from being processed, nor does stopping block until all in-process events have completed.  As such, if after stopping processing we dispose of an event that's going to be set by one of the callbacks, it's possible such a set could occur from an in-flight operation after we've already disposed of the event, leading to an ObjectDisposedException that crashes the tests.

I contemplated adding synchronization to FSW itself to avoid these kinds of race conditions, e.g. by ensuring that the call to set "Enabled = false;" won't return until all in-progress operations have completed, but that could cause deadlocks not currently possible.  As such, I simply stopped explicitly disposing of the events created in the tests, leaving the cleanup to finalization (as is already done for most other events in the tests).


Commit migrated from https://github.com/dotnet/corefx/commit/43bfad63384aee6eb7e20c064054c5e1cd00fbf0
2015-07-22 17:09:31 -04:00
Jonathan Miller a179a5735a Adding new Unit Tests to the FileSystemWatcher code base and fixing a
small bug in the Linux FileSystemWatcher that would notify a listener
about a new directory before we had a chance to process it, which
could lead to missed notifications and not fit user expectations.


Commit migrated from https://github.com/dotnet/corefx/commit/750602b098ceef5aa11ab626bdb359980dd1aa02
2015-07-16 14:59:21 -07:00
dotnet-bot 254a638e63 Add System.IO.FileSystem.Watcher Source and Tests
Commit migrated from https://github.com/dotnet/corefx/commit/73ab96765fa59e5a1d224ecf804a29379da30c0b
2015-03-09 11:50:41 -07:00