Skip to content
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

Fix the filelock test under Mac #560

Closed
ndmitchell opened this issue Jan 22, 2018 · 4 comments
Closed

Fix the filelock test under Mac #560

ndmitchell opened this issue Jan 22, 2018 · 4 comments

Comments

@ndmitchell
Copy link
Owner

Currently it goes a bit weird:

## FINISHED TESTING errors
## BUILD filelock test
## TESTING filelock
(5.466000000000001e-6,"before onceFork")
(7.8909e-5,"after onceFork")
(1.41555e-4,"a1")
## BUILD filelock -VVV
(1.72613e-4,"b1")
## BUILD filelock -VVV
% Starting run
% Starting run 2
% Starting run 3
% Before withLockFile on ./.shake.lock
% Inside withLockFile
% Starting run
% Starting run 2
% Starting run 3
% Before withLockFile on ./.shake.lock
% Inside withLockFile
./.shake.database: openFile: resource busy (file is locked)
% Missing -> Waiting, filelock
# filelock
% Waiting -> Error, filelock
% result filelock = error
Error when running Shake build system:
* filelock
Error, file does not exist and no rule available:
  filelock
CallStack (from HasCallStack):
  error, called at src/Development/Shake/Internal/Rules/File.hs:180:58 in main:Development.Shake.Internal.Rules.File
(4.925253e-3,"after try a")
(5.0741070000000004e-3,"after try b")
TESTS FAILED
shake-test: user error (Expected one success and one failure, got [Left (ExitFailure 1),Left (ExitFailure 1)])
Test suite shake-test: FAIL
Test suite logged to: dist/test/shake-0.16-shake-test.log
0 of 1 test suites (0 of 1 test cases) passed.
neil: Failed when running system command: cabal test --show-details=streaming
CallStack (from HasCallStack):
  error, called at src/System/Process/Extra.hs:34:9 in extra-1.6.2-H6ipqC4P0F96PdmnLHr5qr:System.Process.Extra
  system_, called at src/Cabal.hs:197:24 in main:Cabal

For now I've disabled it with an isMac test.

@dwijnand
Copy link
Contributor

dwijnand commented Jul 8, 2019

Removing the isMac and running with cabal v2-run -O0 shake-test -- filelock it seemed to pass for me:

09:42:54 $ cabal v2-run -O0 shake-test -- filelock
Resolving dependencies...
Up to date
Longest file modification time lag was 2ms
## BUILD filelock
Starting sleep
Finished sleep
Build completed in 5.01s


09:44:48 $

Perhaps that's because I upgraded from HFS+ which has 1s time granularity to APFS (Apple File System) which has 1ns? Looks like Travis CI still uses HFS+: https://docs.travis-ci.com/user/reference/osx/#file-system.

@ndmitchell
Copy link
Owner Author

That could well be it - glad to hear it works somewhere - that means it probably works fine for users even if I still have to disable it on CI.

ndmitchell added a commit that referenced this issue Jul 21, 2019
@ndmitchell
Copy link
Owner Author

Having tried on the branch 560-ismac I can confirm it still fails on CI. Not sure if it's the 1s vs 1ns difference (there's no timing aspects in the code), but I can imagine the file locking on HFS+ has some kind of issues.

ndmitchell added a commit that referenced this issue Jul 21, 2019
@ndmitchell
Copy link
Owner Author

Given it works locally on modern systems (thanks for testing!), and the lock isn't essential for correct operation in normal usage, I'm going to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants