Skip to content

Conversation

@eirbjo
Copy link
Contributor

@eirbjo eirbjo commented Aug 28, 2024

Please review this test-only PR which addresses several issues with the test/jdk/java/util/zip/Available.java test:

  • The test is converted to JUnit 5
  • The test now creates its own test vector programmatically instead of relying on a binary input.jar test vector
  • Coverage is added for calling available() after calling ZipInputStream.closeEntry, as expected by the API specification for ZipInputStream.available
  • Coverage is added for calling available() on a closed ZipInputStream
  • Coverage is added for the unspecified, but long-standing behavior of ZipFileInputStream.available() (The InputStream returned for STORED entries)

Additionally, the test is split into multiple methods, adding javadoc comments for each of them.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8339154: Cleanups and JUnit conversion of test/jdk/java/util/zip/Available.java (Enhancement - P5)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20744/head:pull/20744
$ git checkout pull/20744

Update a local copy of the PR:
$ git checkout pull/20744
$ git pull https://git.openjdk.org/jdk.git pull/20744/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20744

View PR using the GUI difftool:
$ git pr show -t 20744

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20744.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 28, 2024

👋 Welcome back eirbjo! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Aug 28, 2024

@eirbjo This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8339154: Cleanups and JUnit conversion of test/jdk/java/util/zip/Available.java

Reviewed-by: lancea

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 57 new commits pushed to the master branch:

  • 777ed2b: 8339132: Make DirectCodeBuilder write through without allocating instruction objects
  • e57b593: 8335062: NMT: Make StackIndex non-opaque
  • 8c8b580: 8338281: jshell does not run shutdown hooks
  • d35ffa4: 8339017: Make a couple of fields in DoubleByte static
  • 723588a: 8338569: HTTP/1.1 CleanupTrigger may be triggerred after the next exchange started
  • 362f9ce: 8339120: Use more fine-granular gcc unused warnings
  • f080b4b: 8333098: ubsan: bytecodeInfo.cpp:318:59: runtime error: division by zero
  • ff59532: 8338678: Erroneous parameterized type represented as
  • 0b4a7d5: 8324859: Improve error recovery
  • 1383fec: 8327381: Refactor type-improving transformations in BoolNode::Ideal to BoolNode::Value
  • ... and 47 more: https://git.openjdk.org/jdk/compare/5671f836039ef1683e3e9ce5b7cf0fa2f1860e2d...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Aug 28, 2024

@eirbjo The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Aug 28, 2024
@eirbjo eirbjo marked this pull request as ready for review August 28, 2024 11:43
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 28, 2024
@mlbridge
Copy link

mlbridge bot commented Aug 28, 2024

Webrevs

assertRemainingUncompressedBytes(zfile, "deflated.txt");
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we collapse the two above tests via

@ParameterizedTest
@ValueSource(strings = { "stored.txt", "delated.txt" })
void testAvailbleRemainingBytes(iString zipEntry) {
    try (ZipFile zfile = new ZipFile(zip.toFile())) {
            assertRemainingUncompressedBytes(zfile, zipEntry);
        }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it!

I collapsed ZipFile related tests into the method testZipFileStreamsRemainingBytes and inlined the assertRemainingUncompressedBytes method into that.

A few minor improvements to the inlined assertRemainingUncompressedBytes code body:

  • Added a comment saying that the InputStream could be ZipFileInputStream or ZipFileInflaterInputStream
  • Moved the "decrement by one" assertion logic into the loop, asserting decrement on each iteration
  • Cleaned up some spacing issues in the for loop

Copy link
Contributor

@LanceAndersen LanceAndersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the additional tweaks/improvements.

Test looks much better

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 29, 2024
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Aug 29, 2024
@eirbjo
Copy link
Contributor Author

eirbjo commented Aug 29, 2024

Turns out that naming a ZipEntry "stored.txt" does not actually make it stored! 🤦

@LanceAndersen I'll need a re-review for the following line in setup:

stored.setMethod(ZipEntry.STORED);

I have verified using the debugger that each invocation now sees the expected ZipFile InputStream implementation.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 29, 2024
@eirbjo
Copy link
Contributor Author

eirbjo commented Aug 30, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Aug 30, 2024

Going to push as commit f927c12.
Since your change was applied there have been 61 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Aug 30, 2024
@openjdk openjdk bot closed this Aug 30, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Aug 30, 2024
@openjdk
Copy link

openjdk bot commented Aug 30, 2024

@eirbjo Pushed as commit f927c12.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants