Code Review - CR# 7030573 insufficient disk space for large file test
Gary Adams
gary.adams at oracle.com
Mon Jan 9 15:26:29 UTC 2012
On 01/ 6/12 03:32 PM, Alan Bateman wrote:
> On 06/01/2012 19:47, Gary Adams wrote:
>>
>> I've updated the webrev with the temp file created in the current directory.
>>
>> I'm not sure what to do about the case if there is only a little space available
>> only a small file will be used. Should the test fail and force the test operator
>> to create a new test environment where 7G space is available?
>>
>> I lean toward allowing the test to pass using the space that is available.
> I looked briefly at the updated webrev and I see it checks the usable space on
> the file system/volume where the current directory is but creates the file in
> the temporary directory, easily done :-)
>
> I think you're right that the best we can do when there is insufficient space
> is just to run with the small file. It doesn't test the original issue but we
> don't want this test failing when there isn't sufficient space.
>
> Rather than creating largefile, deleting it, and then creating it again
> (twice) then how about:
>
> File file = File.createTempFile("largefile", null, new File("."));
> long usableSpace = largefile.getUsableSpace();
> if (usuableSpace == 0L)
> throw new RuntimeException(...);
> long size = Math.min(usableSpace, 7405576182L);
> recreateAsLargeFile(file, size);
>
A fresh webrev is available :
http://cr.openjdk.java.net/~gadams/7030573/
Includes the following changes
- moved temp file create into main
- use Math.min for selecting 7G or space available
and for skip size
- added runtime exception if no space available
- reformatting to wrap >80 column lines
More information about the core-libs-dev
mailing list