RFR: 8279536: jdk/nio/zipfs/ZipFSOutputStreamTest.java timed out

Jaikiran Pai jpai at openjdk.java.net
Mon Jan 10 15:13:52 UTC 2022


Can I please get a review for this test only change which helps drastically improve the time taken by the `jdk/nio/zipfs/ZipFSOutputStreamTest.java` testcase?

This `jdk/nio/zipfs/ZipFSOutputStreamTest.java` testcase was initially introduced in https://github.com/openjdk/jdk/pull/4607 to reproduce and verify the bug fix for https://bugs.openjdk.java.net/browse/JDK-8190753. The test does the following:
- Using ZipFS creates a zip file with entries of varying size. Each of these entries use random byte content.
- One of the entry size is `Integer.MAX_SIZE + 1` byte to trigger/verify the issue noted in JDK-8190753.
- Finally the test verifies the contents of the generated entries in the zip file by matching it against the previously generated random content. The slowness resides in the way this testing/verification is done in this test case. Currently there's a loop which compares one byte at a time for each of these entries. This is unncessary and this adds up especially for the `Integer.MAX_SIZE + 1` sized entry.

The change in this PR, improves this verification logic by using a fixed data to write out the entries and then read/verify that (fixed) content. This allows for better/quicker comparison of the entries.

Without this change, the testcase used to consistently take around 3 minutes 30 seconds to 3 minutes 50 seconds on my local setup. With this change the test now consistently completes (successfully) in just around 40 to 42 seconds (i.e. within a minute).

The original configuration of this test case uses a timeout of 300 seconds (5 minutes). That timeout was used based on the numbers I was seeing for this test completion. With this change, I don't expect it to require that much amount of time to complete (even on slow setups). However, I decided not to change that value just yet in this PR (since it anyway is a "maximum" time).

Additionally this PR adds some diagnostic logs for any future use if/when this test times out.

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

Commit messages:
 - 8279536: jdk/nio/zipfs/ZipFSOutputStreamTest.java timed out

Changes: https://git.openjdk.java.net/jdk/pull/7010/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7010&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8279536
  Stats: 18 lines in 1 file changed: 9 ins; 4 del; 5 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7010.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7010/head:pull/7010

PR: https://git.openjdk.java.net/jdk/pull/7010


More information about the nio-dev mailing list