Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

enable FileSystem.Watcher on FreeBSD - #42488

Merged
stephentoub merged 2 commits into
dotnet:masterfrom
wfurt:freebsd_watcher
Nov 9, 2019
Merged

stephentoub merged 2 commits into
dotnet:masterfrom
wfurt:freebsd_watcher

Conversation

@wfurt

@wfurt wfurt commented Nov 8, 2019

Copy link
Copy Markdown
Member

This piggybacks on #40202. With the hint from @rootwyrm I realized with libinotify we can use our current inotify() code from Linux on FreeBSD. That may not be as optimal as using kqueue directly but it seems to work reasonably well. It can pass all tests with exception of newly added System.IO.Tests.File_Move_Tests.File_Move_Multiple_From_Unwatched_To_WatchedMac.

 /usr/home/furt/git/wfurt-corefx/artifacts/bin/System.IO.FileSystem.Watcher.Tests/netcoreapp-FreeBSD-Debug ~/git/wfurt-corefx/src/System.IO.FileSystem.Watcher/tests
    Discovering: System.IO.FileSystem.Watcher.Tests (method display = ClassAndMethod, method display options = None)
    Discovered:  System.IO.FileSystem.Watcher.Tests (found 147 of 183 test cases)
    Starting:    System.IO.FileSystem.Watcher.Tests (parallel test collections = on, max threads = 2)
      System.IO.Tests.File_Move_Tests.File_Move_Multiple_From_Unwatched_To_WatchedMac(filesCount: 3) [FAIL]
        Assert.Equal() Failure
        Expected: SelectArrayIterator<<>f__AnonymousType1<String, String>, FiredEvent> [Created /tmp/File_Move_Tests_jviqx2cg.0d2/FileMove_Multiple_FromUnwatchedToWatched_233_249fe60e/dir_watched/file0 , Created /tmp/File_Move_Tests_jviqx2cg.0d2/FileMove_Multiple_FromUnwatchedToWatched_233_249fe60e/dir_watched/file1 , Created /tmp/File_Move_Tests_jviqx2cg.0d2/FileMove_Multiple_FromUnwatchedToWatched_233_249fe60e/dir_watched/file2 ]
        Actual:   List<FiredEvent> [Created /tmp/File_Move_Tests_jviqx2cg.0d2/FileMove_Multiple_FromUnwatchedToWatched_233_249fe60e/dir_watched/file0 , Created /tmp/File_Move_Tests_jviqx2cg.0d2/FileMove_Multiple_FromUnwatchedToWatched_233_249fe60e/dir_watched/file2 , Created /tmp/File_Move_Tests_jviqx2cg.0d2/FileMove_Multiple_FromUnwatchedToWatched_233_249fe60e/dir_watched/file1 ]
        Stack Trace:
          /usr/home/furt/git/wfurt-corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs(253,0): at System.IO.Tests.File_Move_Tests.FileMove_Multiple_FromUnwatchedToWatched(Int32 filesCount)
          /usr/home/furt/git/wfurt-corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs(62,0): at System.IO.Tests.File_Move_Tests.File_Move_Multiple_From_Unwatched_To_WatchedMac(Int32 filesCount)
    Finished:    System.IO.FileSystem.Watcher.Tests
  === TEST EXECUTION SUMMARY ===
     System.IO.FileSystem.Watcher.Tests  Total: 267, Errors: 0, Failed: 1, Skipped: 0, Time: 3.360s

It gets expected events but they are out of order.

@jasonpugsley @joperator

fixes #2046

}

[Theory]
[PlatformSpecific(~TestPlatforms.FreeBSD)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this test never work, or it's a bug right now that it doesn't work? Just wondering if this should be an ActiveIssue instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know yet. I want to chat with @aik-jahoda as that test seems unstable on OSX as well. Probably for other reasons but we may find way how to make adjustments. I don't know if reordering is artifact of libinotify or not. But with catching and idle timers in MacOS, I suspect that may happen as well.

@stephentoub
stephentoub merged commit c88cb6e into dotnet:master Nov 9, 2019
@wfurt
wfurt deleted the freebsd_watcher branch November 9, 2019 21:52
@karelz karelz added this to the 5.0 milestone Dec 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants