RFR: 8321616: Retire binary test vectors ZipFile/input.jar and ZipFile/input.zip

Eirik Bjorsnos duke at openjdk.org
Thu Dec 14 10:18:04 UTC 2023


On Fri, 8 Dec 2023 20:28:20 GMT, Eirik Bjorsnos <duke at openjdk.org> wrote:

> This PR suggests we retire the binary test vectors `ZipFile/input.zip` and `ZipFile/input.jar`.
> 
> Binary test vectors are harder to analyze,  and sharing test vectors across unrelated tests increases maintenance burden. It would be better to have each test produce its own test vectors independently.
> 
> While visiting these dusty tests, we should take the opportunity to convert them to JUnit, add more comments and perform some mild modernization and cleanups where appropriate. We should also consider whether any test are duplicated and can be retired, see comments below.
> 
> To help reviewers, here are some comments on the updated tests:
> 
> `Available.java`
> This test currently has no jtreg `@test` header, so isn't currently active. I added a jtreg header with  `@bug 4401122`. I added some checks to verify that reading from the stream reduces the number of available bytes accordingly, also checking the behavior when the stream is closed. An alternative action would be to remove this test. It seems to validate the current implementation more than the specification.
> 
> `CopyJar.java`
> The 1999 bug description JDK-4239446 is short and somewhat confusing. It seems at some point that the CRC of `ZipEntry` read by `ZipFile.getEntry` would be read from a LOC header instead of the CEN header, which means it could be zero for streaming entries with data descriptors. (However, the bug description also mentions calling `getNextEntry`, which is a `ZipInputStream` method?) In any case, this concern seems to now have better coverage in the test `zip/CopyZipFile` from 2020, so it would perhaps be desirable to simply remove `CopyJar.java` to reduce duplication?
> 
> `EnumAfterClose.java`
> To prevent confusion with Java Enums, I suggest we rename this test to `EnumerateAfterClose`.
> 
> `FinalizeInflater.java`  
> The code verified by this test has been updated to use cleaners instead of finalizers. Still, this test code relies on finalizers. Not sure if this is an issue, but this test will need to be updated when finalizers are finally removed.
> 
> `GetDirEntry.java`
> This test seems to duplicate the test `ReadZip.readDirectoryEntry`. It would perhaps be better to remove `GetDirEntry.java` to reduce duplication?
> 
> `ReadZip.java`
> Nothing exciting here, the single main method was split into multiple JUnit methods, each focusing on a separate concern.
> 
> `ReleaseInflater.java`
> Nothing exciting, tried to add some comment to help understanding of what is tested.
> 
> `StreamZipEntriesTest.java`
> This test was us...

The scope of this PR has now expanded to removing uses of the `input.zip` and `input.jar` files, updating any test using them to produce their own test vectors, and convert affected tests to JUnit.

I'm marking the PR ready for review again. Before looking too closely at the code, it would be useful to discuss the following tests:

- `Available.java`: This test has no jtreg header. I've added one and converted the test. Is this worthwhile, or should we rather remove it?
- `CopyJar.java`: The concern tested seems to have superior coverage in the test `zip/CopyZipFile.java`. Should we retire `CopyJar.java` instead of coverting it?
- `DirEntry.java`: There is duplication between this test and `ReadZip. readDirectoryEntry`. Should we retire one of these?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17038#issuecomment-1855560373


More information about the core-libs-dev mailing list