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

get test suite passing on Windows #4770

Merged
merged 5 commits into from Oct 5, 2015

Conversation

SethTisue
Copy link
Member

this was manually tested (by ssh'ing to a Cygwin prompt on
jenkins-worker-windows-publish), since
scala/scala-jenkins-infra#36 isn't done yet

review by @adriaanm, @som-snytt, @retronym, @martijnhoekstra

this is mostly intended for .scala files, since because """ preserves
line endings, so we get different results if source files have CRLF.
this was making a few tests fail on Windows (because they used """ to
enclose expected output)
usually it hardly matters, but it's still a bug, and on Windows we
can't delete an open file, so this can cause trouble for someone
writing a test that relies on being able to generate icode files
and then clean them up afterwards.  (and in fact, two
IcodeComparison-based tests were failing.)
this was causing a mysterious compilation failure on Windows.  (it may
not have been a sufficient cause in itself -- which is why I say
"mysterious" -- but in any case, adding the newline made the failure
go away. and besides, the newline should be there. so here it is.)

(it's tempting to make a big commit that fixes this in every
source file. resisting for now)
@scala-jenkins scala-jenkins added this to the 2.11.8 milestone Sep 25, 2015
@SethTisue
Copy link
Member Author

oh, I should have mentioned, if anyone is tempted to actually run this on Windows themselves, I wouldn't currently suggest that you bother. from Cygwin (we're not worrying about from cmd.exe anymore) some parts of the ant build require set -o igncr, others require you not have that... it's messy. I'll need to straighten that out before scala/scala-jenkins-infra#36 can be closed.

// 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()))
Copy link
Contributor

Choose a reason for hiding this comment

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

As a matter of fact, I recall that the fix to slurp was because I ran tests on windows and hit the same issue.

https://github.com/scala/scala/blob/v2.11.7/src/reflect/scala/reflect/io/Streamable.scala#L112

Li Haoyi just complained about the behavior of the other methods (he was using Source I think) and I checked that indeed there are leakages, which is too bad.

OTOH, at the Java office, I just had to verify that when using try-with-res, you have to close wrapped resources or be very sure about the behavior. End of this article points out that not all close methods guarantee to close decorated resources.

http://www.oracle.com/technetwork/articles/java/trywithresources-401775.html

So basically, Damn you all to hell! [PAN to reveal STATUE OF LIBERTY half-buried in the sand.]

Copy link
Contributor

Choose a reason for hiding this comment

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

require(icodeFiles forall (_.delete)). Or try ff flatMap (f => f.slurp.lines.toList.ensuring(f.delete)) except exceptions. Could use a macro enforcing that wrapped (some) tree in the try.

@lrytz
Copy link
Member

lrytz commented Oct 5, 2015

LGTM \r\n

lrytz added a commit that referenced this pull request Oct 5, 2015
@lrytz lrytz merged commit bb3ded3 into scala:2.11.x Oct 5, 2015
@SethTisue SethTisue deleted the windows-testing-fixes branch October 5, 2015 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants