RFR: 8304013: Add a fast, non-manual alternative to test/jdk/java/util/zip/ZipFile/TestTooManyEntries
Martin Buchholz
martin at openjdk.org
Fri Mar 24 18:34:47 UTC 2023
On Thu, 26 Jan 2023 18:49:47 GMT, Eirik Bjorsnos <duke at openjdk.org> wrote:
> The TestTooManyEntries test was originally added to validate that ZIP64 files with CEN sizes exceeding what ZipFile supports are rejected with a ZipException. The test does this by creating a large ZIP file (several gigabytes) with many enties. Because this is resource intensive, the test is currently tagged as manual. (See #6927)
>
> It would be useful to have a test which asserts the CEN size enforcement, but without the CPU, disk, memory and run time requirements of TestTooManyEntries. Such a fast test can run non-manual, without the @requires and manual tags as found in TestTooManyEntries.
>
> This PR adds the EndOfCenValidation test which creates sparse test ZIPs where the CEN is "inflated" such that is matches the size declared in the "End of central directory" records.
>
> While thee sparse files look large, they consume very little disk space on file systems supporting sparse files:
>
>
> 16 -rw-r--r-- 1 2147483702 Feb 6 18:54 bad-cen-offset.zip
> 16 -rw-r--r-- 1 2147483703 Feb 6 18:54 cen-size-too-large.zip
> 8 -rw-r--r-- 1 132 Feb 6 18:54 invalid-zen-size.zip
> ```
>
> For good measure, two new test methods are added to excercise the remaining ZipExceptions which ZipFile may throw during validation of the END record .
Changes requested by martin (Reviewer).
test/jdk/java/util/zip/ZipFile/EndOfCenValidation.java line 52:
> 50:
> 51: /**
> 52: * This test augments {@link TestTooManyEntries}. It creates sparse ZIPs where the
remove the "the" stutter
test/jdk/java/util/zip/ZipFile/EndOfCenValidation.java line 120:
> 118: /**
> 119: * Validate that an end of central directory record with a
> 120: * CEN size which exceeds the position of the EOC record is rejected.
EOC is not a standard zip file technical term. Did you mean "END header" ?
test/jdk/java/util/zip/ZipFile/EndOfCenValidation.java line 139:
> 137: * Validate that an end of central directory record with a CEN offset which
> 138: * is larger than the EOC position minus the CEN size is rejected
> 139: * @throws IOException
I don't think `@throws` javadoc comments in tests are useful; especially checked ones
-------------
PR Review: https://git.openjdk.org/jdk/pull/12231#pullrequestreview-1357235702
PR Review Comment: https://git.openjdk.org/jdk/pull/12231#discussion_r1147929032
PR Review Comment: https://git.openjdk.org/jdk/pull/12231#discussion_r1147931418
PR Review Comment: https://git.openjdk.org/jdk/pull/12231#discussion_r1147932862
More information about the core-libs-dev
mailing list