diff options
author | Seth Tisue <seth@tisue.net> | 2015-09-24 21:59:27 -0400 |
---|---|---|
committer | Seth Tisue <seth@tisue.net> | 2015-09-25 11:36:19 -0400 |
commit | a9b079ac24ef96dce4d08a3860b03ca7f5730c32 (patch) | |
tree | 94dfc684bc2b4da4080b54b9bda8230941288949 /src/partest-extras | |
parent | daead5063f9c030d4c13cc49d264e68cc4e13f34 (diff) | |
download | scala-a9b079ac24ef96dce4d08a3860b03ca7f5730c32.tar.gz scala-a9b079ac24ef96dce4d08a3860b03ca7f5730c32.tar.bz2 scala-a9b079ac24ef96dce4d08a3860b03ca7f5730c32.zip |
fix bug in partest-extras causing test failures on Windows
includes comment with full details
Diffstat (limited to 'src/partest-extras')
-rw-r--r-- | src/partest-extras/scala/tools/partest/IcodeComparison.scala | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/partest-extras/scala/tools/partest/IcodeComparison.scala b/src/partest-extras/scala/tools/partest/IcodeComparison.scala index 7122703918..1430db886e 100644 --- a/src/partest-extras/scala/tools/partest/IcodeComparison.scala +++ b/src/partest-extras/scala/tools/partest/IcodeComparison.scala @@ -48,8 +48,13 @@ abstract class IcodeComparison extends DirectTest { compile("-d" :: testOutput.path :: arg0 :: args.toList : _*) val icodeFiles = testOutput.files.toList filter (_ hasExtension "icode") - try icodeFiles sortBy (_.name) flatMap (f => f.lines.toList) - finally icodeFiles foreach (f => f.delete()) + // Some methods in scala.reflect.io.File leak an InputStream, leaving the underlying file open. + // Windows won't delete an open file, but we must ensure the files get deleted, since the logic + // here depends on it (collectIcode will be called multiple times, and we can't allow crosstalk + // between calls). So we are careful to use `slurp` which does call `close`, and careful to + // check that `delete` returns true indicating successful deletion. + try icodeFiles sortBy (_.name) flatMap (f => f.slurp().lines.toList) + finally icodeFiles foreach (f => require(f.delete())) } /** Collect icode at the default phase, `printIcodeAfterPhase`. */ |