-
-
Notifications
You must be signed in to change notification settings - Fork 83
Fixes to macOS watcher and ensuring that watch is set up before os.watch() returns
#398
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
Fixes to macOS watcher and ensuring that watch is set up before os.watch() returns
#398
Conversation
…h-test-coverage' into improvement/os-watch-test-coverage # Conflicts: # os/watch/src/macos/FSEventsWatcher.scala # os/watch/src/package.scala
|
Can you mention in the PR description how this was tested? Manual testing or one-off testing is fine as well, just should be documented for posterity |
I assumed that the diff in |
|
@arturaz I'd like to know which of those tests are:
These two categories of tests have very different properties, and without such a distinction it is difficult for a reviewer to understand what you are actually testing |
|
Also, given that this is meant to be used in Mill, it's worth mentioning if any |
|
Updated the comment.
Got to run now, will investigate later. |
|
Fixed the issue on macos, now mill's integration tests pass. The problem was that if you passed |
|
tagged this as 0.11.0-M10, should be available once this job completes https://github.com/com-lihaoyi/os-lib/actions/runs/15864572422 |
|
I think the correct tag is |
Pulls in com-lihaoyi/os-lib#398 in an attempt to fix #5225
This should let us dogfood com-lihaoyi/os-lib#398 and see if #5225 still occurs
While debugging com-lihaoyi/os-lib#398 I encountered a lackluster developer experience when running `WatchTests`. - It took ages for the tests to fail. - When the tests failed, the amount of context was very low. This PR improves on both of those areas: - `WatchTests` timeout is now `15s` instead of `120s` when running not on CI. - If the test fails the `eval` context (things like working directory, the command line for eval and environment variables) is printed out. To achieve that, I introduced: - `prepEval` - as `eval` but doesn't actually execute immediatelly. - `withTestClues` - enhances `utest.AssertionError` thrown in the block with the given `TestValues` --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This PR contains multiple fixes.
FSEventsWatcherwas modified to use the new dispatch queue-based API instead of the old, deprecated run-loop based API. This made closing the watcher easier, without any class-level state to maintain, making sure resource release is always done appropriately.watcher.close()is now threadsafe and idempotent.os.watchnow requires the directory to exist, as a sentinel file is written to that directory to make sureos.watchis actually watching the directory before it returns. An exception is thrown if the directory does not exist.Tested with tests added to
os/watch/test/src/WatchTests.scala.These tests work fine in current
mainbranch as well:These tests reliably exhibit the JVM crash in
mainbranch:These tests either fail in
mainbranch because the behaviour there is different:or randomly crash:
This one randomly fails on
mainas well:This one fails because the behaviour has changed:
This should fix the issue witnessed in mill (com-lihaoyi/mill#5225)