RFR: 8023113: tools/jar/ChangeDir.java fails if /tmp/a exists
Alan Bateman
Alan.Bateman at oracle.com
Wed Sep 18 10:31:11 UTC 2013
On 17/09/2013 22:55, Xueming Shen wrote:
> Hi,
>
> Please help the small update to the test case tools/jar/ChangeDir.java,
> which might fail if the "dedicated" test directory /tmp/a exists and the
> user does not have privilege to delete/clean it up.
>
> The proposed change here is to use a random file name (from
> File.getTempFile())
> for the top test directory (instead of the fixed /tmp/a), and really
> clean it up
> after testing (the old test leaves /tmp/a and those temp files
> undeleted).
>
> http://cr.openjdk.java.net/~sherman/8023113/webrev
I've run into this a few times so thanks for fixing it.
What you have is okay although some of the setup and cleanup could be
reduced, for example doTest could setup the test tree with:
Path topDir = Files.createTempDirectory("delete");
Path testDir = Files.createDirectories(topDir.resolve("a").resolve("b"));
It's not important for this fix of course, just an observation when
looking at an old test.
-Alan.
More information about the core-libs-dev
mailing list