Skip to content

CommentPicklingTest fails on Windows #5149

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

Closed
melekhove opened this issue Sep 24, 2018 · 4 comments
Closed

CommentPicklingTest fails on Windows #5149

melekhove opened this issue Sep 24, 2018 · 4 comments

Comments

@melekhove
Copy link
Contributor

Seen in testOnly dotty.tools.vulpix.VulpixUnitTests

@allanrenucci
Copy link
Contributor

Could you post a stack trace?

@melekhove
Copy link
Contributor Author

It could be that my path in #5150 is wrong. At least according to the following stack trace.
But I'm sure that I saw exception at line 211.

Strange.

Here is the stack trace:

[info] Test dotty.tools.dotc.core.tasty.CommentPicklingTest.commentOnClass started
[error] Test dotty.tools.dotc.core.tasty.CommentPicklingTest.commentOnClass failed: java.nio.file.DirectoryNotEmptyException: C:\Users\mev\AppData\Local\Temp\temp7046534152377005690\out, took 0.306 sec
[error]     at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:266)
[error]     at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
[error]     at java.nio.file.Files.delete(Files.java:1126)
[error]     at dotty.tools.io.Path$$anon$1.postVisitDirectory(Path.scala:216)
[error]     at dotty.tools.io.Path$$anon$1.postVisitDirectory(Path.scala:209)
[error]     at java.nio.file.Files.walkFileTree(Files.java:2688)
[error]     at java.nio.file.Files.walkFileTree(Files.java:2742)
[error]     at dotty.tools.io.Path.deleteRecursively(Path.scala:209)
[error]     at dotty.tools.io.Directory$.inTempDirectory(Directory.scala:29)
[error]     at dotty.tools.dotc.core.tasty.CommentPicklingTest.compileAndUnpickle(CommentPicklingTest.scala:82)
[error]     at dotty.tools.dotc.core.tasty.CommentPicklingTest.compileAndCheckComment(CommentPicklingTest.scala:61)
[error]     at dotty.tools.dotc.core.tasty.CommentPicklingTest.commentOnClass(CommentPicklingTest.scala:47)

@melekhove
Copy link
Contributor Author

Update to the issue. I've changed the title because problem is not in the dotty.tools.io.Path but somewhere else.

Here is a stack trace

sbt:dotty> testOnly dotty.tools.dotc.core.tasty.CommentPicklingTest -- *commentOnDef
[info] Test dotty.tools.dotc.core.tasty.CommentPicklingTest.commentOnDef started
[error] Test dotty.tools.dotc.core.tasty.CommentPicklingTest.commentOnDef failed: java.nio.file.DirectoryNotEmptyExcepti
on: C:\Users\mev\AppData\Local\Temp\temp7552947933988336858\out, took 2.665 sec
[error]     at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:266)
[error]     at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
[error]     at java.nio.file.Files.delete(Files.java:1126)
[error]     at dotty.tools.io.Path$$anon$1.postVisitDirectory(Path.scala:216)
[error]     at dotty.tools.io.Path$$anon$1.postVisitDirectory(Path.scala:209)
[error]     at java.nio.file.Files.walkFileTree(Files.java:2688)
[error]     at java.nio.file.Files.walkFileTree(Files.java:2742)
[error]     at dotty.tools.io.Path.deleteRecursively(Path.scala:209)
[error]     at dotty.tools.io.Directory$.inTempDirectory(Directory.scala:29)
[error]     at dotty.tools.dotc.core.tasty.CommentPicklingTest.compileAndUnpickle(CommentPicklingTest.scala:82)
[error]     at dotty.tools.dotc.core.tasty.CommentPicklingTest.compileAndCheckComment(CommentPicklingTest.scala:61)
[error]     at dotty.tools.dotc.core.tasty.CommentPicklingTest.commentOnDef(CommentPicklingTest.scala:27)
[error]     ...
[info] Test run finished: 1 failed, 0 ignored, 1 total, 3.014s
[error] Failed: Total 1, Failed 1, Errors 0, Passed 0
[error] Failed tests:
[error]         dotty.tools.dotc.core.tasty.CommentPicklingTest
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for dotty-doc / Test / testOnly
[error] (dotty-compiler / Test / testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 6 s, completed 26.09.2018 11:52:42

Test fails attempting to delete 'out' directory which is actually empty (files are deleted prior to the call to
postVisitDirectory) There are no any hidden files etc.

The interesting thing is that if we comment out 'unpickle' call the test passes

diff --git a/compiler/test/dotty/tools/dotc/core/tasty/CommentPicklingTest.scala b/compiler/test/dotty/tools/dotc/core/tasty/CommentPicklingTest.scala
index 4cafc167302..06e65884bd0 100644
--- a/compiler/test/dotty/tools/dotc/core/tasty/CommentPicklingTest.scala
+++ b/compiler/test/dotty/tools/dotc/core/tasty/CommentPicklingTest.scala
@@ -100,7 +100,7 @@ class CommentPicklingTest {
         .withClasspath(out.toAbsolute.toString)
         .and("dummy") // Need to pass a dummy source file name
       val unpicklingDriver = new UnpicklingDriver
-      unpicklingDriver.unpickle(unpicklingOptions.all, tastyFiles)(fn)
+//      unpicklingDriver.unpickle(unpicklingOptions.all, tastyFiles)(fn)
     }
   }

Scala sources compilation performed before this step doesn't affect the test. So there is some interesting difference between Driver and UnpicklingDriver which results in some kind of locking the 'out' directory

@melekhove
Copy link
Contributor Author

Ok, I finally managed to find the real reason which fortunately has nothing to do with compiler internals and was in test implementation. Details are in #5170

@melekhove melekhove changed the title dotty.tools.io.Path.deleteRecursively fails (on Windows) if directory is not empty CommentPicklingTest fails on Windows Sep 27, 2018
allanrenucci added a commit that referenced this issue Sep 27, 2018
Fix #5149: Use function that closes the file stream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants