Commit Graph
26 Commits
Author SHA1 Message Date
Maxim Lipnin d87c9338f5 Share CFRunLoop for FSEventStreams in FileSystemWatcher on OSX (dotnet/corefx#33865)
* Share CFRunLoop for FSEventStreams in FileSystemWatcher on OSX

* Address review comments

* Add execution context capturing

* Fix nits

* Add some tests to check multiple watchers

* Address review comments

* Update FileSystemWatcher tests

* Add timeout for non-expected events

* Wrap FileSystemWatcher_File_Create_EnablingDisablingNotAffectRaisingEvent test in ExecuteWithRetry helper method and mark it with Outerloop

* Wrap FileSystemWatcher_File_Create_WatchOwnPath test in ExecuteWithRetry helper method

* Move disposing FileSystemWatcher instances to a finally section in FileSystemWatcher_File_Create_ForceLoopRestart test

* Use null-conditional operator before disposing


Commit migrated from https://github.com/dotnet/corefx/commit/8a06434b29599950571aa7975458ae5b465d1a0d
2018-12-19 20:59:39 -05:00
Stephen Toub af60d4a06b Add a FileSystemWatcher test for ExecutionContext (dotnet/corefx#33903)
Make sure that a) ExecutionContext properly flows, and b) events from multiple FileSystemWatchers are raised on the right ExecutionContext.

Commit migrated from https://github.com/dotnet/corefx/commit/81c6ce11a40df6d93de97ffc11408569befba727
2018-12-09 08:56:55 -05:00
Stephen Toub 4c9eb2ec25 Simplify built-in types across corefx tests (dotnet/corefx#30660)
Commit migrated from https://github.com/dotnet/corefx/commit/7ae1a252d7e68c5513d2658de7a401c37e9b0504
2018-06-25 22:42:04 -07:00
Anirudh Agnihotry 46c3899a36 Added Filters Property to FileSystemWatcher class (dotnet/corefx#29315)
* Filters Property and tests added

* Tests fixed for osx

* Tests fixed for netfx and error message improved

* Tests fixed for netfx and error message improved

* Added tests for insert,contains ,removeat, index of , to string and gettype

* ToString removed and asser.equal corrected

* Comments and overload of epectevent added for netcoreapp

* Removed duplicate code

* setup and execution separated

* Expected patshs argument added

* ExpectNoEvent Added, negative added for all the test , expected path problem corrected

* handler

* Storing tuple and Unexpected Events

* name added to return values tuples


Commit migrated from https://github.com/dotnet/corefx/commit/9f2377fcd4e46f2c607d03672ed0bb92fe9cb68e
2018-05-15 01:03:38 +05:30
Kasper Fabæch Brandt 58ea9bfc83 Make FileSystemWatcher tests tolerant of spurious/extra events on all platforms. Fixes dotnet/coreclrdotnet/corefx#14154. (dotnet/corefx#24406)
Commit migrated from https://github.com/dotnet/corefx/commit/8665e8bbd98cc47bf4bcfdc7c2939c477953d85c
2017-10-03 14:38:04 -07:00
Brian Chavez 232a1dfac0 Grammar check - "a [a,e]" rule. (dotnet/corefx#23697)
* Grammar check - "a [a,e]" rule.

* Corrected "a attributes" to "an attribute"


Commit migrated from https://github.com/dotnet/corefx/commit/be75987c628347e1d44bba15c5272ade3dcfa65c
2017-08-31 09:29:39 -04:00
Paul Harrington 79d26b7560 Fix typos: occurred/occurrence (dotnet/corefx#16459)
Commit migrated from https://github.com/dotnet/corefx/commit/94a4ddf3f8f04ef2dc0486afcb62ef873bec2530
2017-02-24 23:56:39 -08:00
Ian Hays e3733e9157 Fix some intermittently failing Desktop FSW tests (dotnet/corefx#15007)
* Fix some intermittently failing Desktop FSW tests

They're failing for misc reasons but mostly are plagued by timeouts. I excluded some actual failures and increased timeouts for the other ones so desktop FSW runs should be clean going forward.

* Make FSW_NotifyFilter test catch any ArgException

This is so it still runs on desktop and isn't just flat out excluded.

* Fix FSW StopCalledOnBackgroundThread test

* fix FSW test


Commit migrated from https://github.com/dotnet/corefx/commit/f548a49b0d40b90b45ef43ea27bd99e16c50676c
2017-01-11 13:40:01 -08:00
Ian Hays fce9ab927d Add missing FileSystemWatcher methods
Adds source and tests for the remaining missing members in FileSystemWatcher. This required that FileSystemWatcher take a dependency on System.ComponentModel.TypeConverter.


Commit migrated from https://github.com/dotnet/corefx/commit/7e87de255ba67eed5953f9899887a73420dff5d9
2016-11-16 10:35:51 -08:00
Ian Hays 2cfb99941a Add Outerloop messages and cleanup FSW tests
Commit migrated from https://github.com/dotnet/corefx/commit/f9f626d63eb7de1fc41d68c5e1602f86e86014d1
2016-09-13 10:38:38 -07:00
Ian Hays bc45535170 Merge pull request dotnet/corefx#11349 from ianhays/IO_symlink_tests
Use rooted path for symlink creation in IO tests

Commit migrated from https://github.com/dotnet/corefx/commit/9fbfe43dbd61f06e6c9c7a481b5edf4d19f8db1d
2016-09-07 08:33:19 -07:00
Ian Hays a30acca4b1 Move some flaky FSW tests to Outerloop
All of the FSW tests are potentially subject to intermittent failures because of the inherint flakiness of the underlying OS file system watching APIs. Although we do some manual stuff to get around that flakiness (e.g. retries, long timeouts), some scenarios aren't reliable enough to make it through. This commit moves those to Outerloop so they don't get in the way of our gated check in tests.


Commit migrated from https://github.com/dotnet/corefx/commit/c827a452b599d67fe68773b96b4da75044452446
2016-09-01 14:28:30 -07:00
Ian Hays 969ebf860d Use rooted path for symlink creation in IO tests
Commit migrated from https://github.com/dotnet/corefx/commit/68836fa5f2c1b5dd525fa58321fbdf210e72bc6c
2016-09-01 11:10:21 -07:00
Ian Hays f859973d23 Expand CanCreateSymlinks test
Make it harder to pass the CanCreateSymbolicLinks check so that tests don't fail on some systems where a file symlink can be created but a directory symlink can't be.


Commit migrated from https://github.com/dotnet/corefx/commit/6d84c1d4121a7efdc31970d1cd7ba750aaee6525
2016-06-29 08:33:07 -07:00
Ian Hays eda731960e Disable event filtering on OSX FSW
The OSX FileSystemWatcher coalesces past events of a file into new events. Previously we did some special work to try to filter out those extraneous events to better match the FSW inotify/win32 behavior. However, this had the consequence that we filtered out some valid events. This commit modifies the behavior to raise an event for exactly every flag that the OS API sets. It also modifies the OSX tests to no longer assert that an event *didn't* occur, but to only assert that an event *did* occur.


Commit migrated from https://github.com/dotnet/corefx/commit/1d3cb36b3f23c804cb243be07320c77e22d008c2
2016-05-20 11:12:15 -07:00
Ian Hays febb25693e FileSystemWatcher test overhaul
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
2016-05-09 11:24:59 -07:00
Ian Hays c0f649508b Modify FileSysemWatcher tests to use temp paths.
- 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
2016-04-22 09:14:49 -07:00
dotnet-bot 39d1eab950 Update licensing headers
Commit migrated from https://github.com/dotnet/corefx/commit/7cad8486cbabbce0236bdf530e30db7036335524
2016-01-27 08:02:28 -08:00
Peter Jas a29604278c code: Fixes occurred spelling.
Fixes dotnet/corefx#3661.


Commit migrated from https://github.com/dotnet/corefx/commit/544a3885ff51e04db89b70e3f155be1a5c64f166
2015-10-06 15:27:09 +00:00
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 d6467ac0af Use RuntimeInformation across corefx for platform detection
This commit deletes our temporary Interop.PlatformDetection.cs mechanism and replaces usage of it with usage of System.Runtime.InteropServices.RuntimeInformation.dll.


Commit migrated from https://github.com/dotnet/corefx/commit/6861b625b391566544be9a60356c8c03b15e5fb5
2015-08-06 10:25:17 -04:00
Jonathan Miller 1d2f6fe59e Adding new Unit Tests to validate the more complex FileSystemWatcher
scenarios: symlinks, deep directory structures, and preseeded directories.


Commit migrated from https://github.com/dotnet/corefx/commit/c41c161d721f16bc0c83fe7c1d77378c06f005c3
2015-08-05 14:30:54 -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