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);

-Alan.






Reply via email to