Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8344854: Modernize test/jdk/java/net/URLClassLoader/RemoveJar.java #22319

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eirbjo
Copy link
Contributor

@eirbjo eirbjo commented Nov 22, 2024

Can I get a review of this test-only cleanup/speedup PR which modernizes the test RemoveJar.java.

This test attempts a variety of class loading scenarios on a URLClassLoader and verifies that when the loader is closed, it has released its JAR file (such that it may be deleted on Windows).

Changes in this PR include:

  • Converting the test to JUnit 5
  • Making it @Parameterized instead of using multiple jtreg runs
  • Producing the sample class file using the ClassFile API instead calling out to javac via ToolProvider
  • Packaging the JAR using JarOutputStream instead of calling out to the jar tool.
  • Adding some code and method comments to support understading of what this test does and why

A nice benefit of this change is that it speeds up the runtime from ~15 seconds to ~1 second on my laptop.

Unfortunately, this test relies on Windows to fail, that is something I plan to look into separately.

Verification: GHA tests pending. (No local Windows dev environment)


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-8344854: Modernize test/jdk/java/net/URLClassLoader/RemoveJar.java (Enhancement - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22319

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 22, 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 Nov 22, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Nov 22, 2024

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

  • net

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.

@eirbjo eirbjo marked this pull request as ready for review November 22, 2024 11:06
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 22, 2024
@mlbridge
Copy link

mlbridge bot commented Nov 22, 2024

Webrevs

@dfuch
Copy link
Member

dfuch commented Nov 22, 2024

Hi Eirik, IIRC the cache is global - so I don't think running the test in the same VM will work. I mean, I don't think we will be testing the same thing.

@eirbjo
Copy link
Contributor Author

eirbjo commented Nov 22, 2024

Hi Eirik, IIRC the cache is global - so I don't think running the test in the same VM will work. I mean, I don't think we will be testing the same thing.

If the test should fail because of a regression, then yes, the next parameterized run of the test may start with a non-empty cache. I could add an assertEmptyJarFileCaches method to the start of the test execution, this will verify that all test runs starting with a non-empty cache fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
net [email protected] rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants