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

8273774: CDSPluginTest should only expect classes_nocoops.jsa exists on supported 64-bit platforms #5519

Closed
wants to merge 1 commit into from

Conversation

1996scarlet
Copy link
Contributor

@1996scarlet 1996scarlet commented Sep 15, 2021

The test assumes that it always runs on 64-bit platform and classes_nocoops.jsa is always created.
It's a test bug. The test should only expect classes_nocoops.jsa exists if it's running on a supported 64-bit platform.
However, for unknown target platform, it's unknown if it's 64-bit or not.

This patch fix the test to check if classes_nocoops.jsa exists only on one of the JDK supported platforms (x64 or aarch64) via the sun.arch.data.model system property.

Please review this change. Thanks!


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8273774: CDSPluginTest should only expect classes_nocoops.jsa exists on supported 64-bit platforms

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5519/head:pull/5519
$ git checkout pull/5519

Update a local copy of the PR:
$ git checkout pull/5519
$ git pull https://git.openjdk.java.net/jdk pull/5519/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5519

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5519.diff

@bridgekeeper bridgekeeper bot added the oca label Sep 15, 2021
@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 15, 2021

Hi @1996scarlet, welcome to this OpenJDK project and thanks for contributing!

We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing /signed in a comment in this pull request.

If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user 1996scarlet" as summary for the issue.

If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing /covered in a comment in this pull request.

@openjdk openjdk bot changed the title 8273774: jdk.tools.jlink.internal.Platform::is64Bit() should not hard… 8273774: jdk.tools.jlink.internal.Platform::is64Bit() should not hard code for x64 and AARCH64 Sep 15, 2021
@1996scarlet
Copy link
Contributor Author

@1996scarlet 1996scarlet commented Sep 15, 2021

/covered
Loongson

@bridgekeeper bridgekeeper bot added the oca-verify label Sep 15, 2021
@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 15, 2021

Thank you! Please allow for a few business days to verify that your employer has signed the OCA. Also, please note that pull requests that are pending an OCA check will not usually be evaluated, so your patience is appreciated!

@openjdk
Copy link

@openjdk openjdk bot commented Sep 15, 2021

@1996scarlet 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 label Sep 15, 2021
@bridgekeeper bridgekeeper bot removed oca oca-verify labels Sep 15, 2021
@openjdk openjdk bot added the rfr label Sep 15, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 15, 2021

Webrevs

@mlchung
Copy link
Member

@mlchung mlchung commented Sep 15, 2021

The test assumes that it always runs on 64-bit platform and classes_nocoops.jsa is always created. It's a test bug. The test should only expect classes_nocoops.jsa exists if it's running on a supported 64-bit platform.

Platform::is64Bit can do better for runtime platform (i.e. Platform::runtime) that can determine if it's 64-bit from the sun.arch.data.model system property. However, for unknown target platform, it's unknown if it's 64-bit or not. So I think fixing the test to check if classes_nocoops.jsa exists only on one of the JDK supported platforms (x64 or aarch64) is a better way to resolve your issue.

@1996scarlet 1996scarlet changed the title 8273774: jdk.tools.jlink.internal.Platform::is64Bit() should not hard code for x64 and AARCH64 8273774: CDSPluginTest should only expect classes_nocoops.jsa exists on supported 64-bit platforms Sep 16, 2021
@mlchung
Copy link
Member

@mlchung mlchung commented Sep 16, 2021

Thanks for making the change, Remilia. @calvinccheung is the author of CDSPlugin and this test, who should review this fix.

My suggestion checking on x64 or aarch64 works for the issue you run into but it would fail again when running on a JDK where CDSPlugin does not support for example lib/classlist is not present.

Having a second thought, it would be a better fix for CDSPluginTest to simply skip running if default CDS archive is not supported. There is a method jdk.test.lib.Platform::isDefaultCDSArchiveSupported to test if CDS default archive is supported but it returns false for aarch64. The fix can be like this:

    public static void main(String[] args) throws Throwable {
           // run this test only on the supported platforms
           // explicit test if it's aarch64 platform until Platform::isDefaultCDSArchiveSupported is fixed
           if (!Platform.isDefaultCDSArchiveSupported() && !Platform.isAArch64())) return;
           :
    }

isDefaultCDSArchiveSupported needs to be fixed to include aarch64 but it should be fixed as a separate issue.

@calvinccheung
Copy link
Member

@calvinccheung calvinccheung commented Sep 16, 2021

The fix in the test case seems fine to me.
We'll file a follow-up bug to fix the jdk.test.lib.Platform::isDefaultCDSArchiveSupported method and may re-fix the test case then.

@openjdk
Copy link

@openjdk openjdk bot commented Sep 16, 2021

⚠️ @1996scarlet the full name on your profile does not match the author name in this pull requests' HEAD commit. If this pull request gets integrated then the author name from this pull requests' HEAD commit will be used for the resulting commit. If you wish to push a new commit with a different author name, then please run the following commands in a local repository of your personal fork:

$ git checkout JDK-8273774
$ git commit -c user.name='Preferred Full Name' --allow-empty -m 'Update full name'
$ git push

@openjdk
Copy link

@openjdk openjdk bot commented Sep 16, 2021

@1996scarlet 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:

8273774: CDSPluginTest should only expect classes_nocoops.jsa exists on supported 64-bit platforms

Reviewed-by: ccheung, mchung

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 24 new commits pushed to the master branch:

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@calvinccheung, @mlchung) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready label Sep 16, 2021
@mlchung
Copy link
Member

@mlchung mlchung commented Sep 16, 2021

The fix in the test case seems fine to me.

This test may fail in other cases. We should prepare for those cases in this fix:

if (!Platform.isDefaultCDSArchiveSupported() && !Platform.isAArch64()))
    throw new SkippedException("not a supported platform");

Calvin suggests to throw SkippedException in an offline chat.

@calvinccheung
Copy link
Member

@calvinccheung calvinccheung commented Sep 16, 2021

The fix in the test case seems fine to me.

This test may fail in other cases. We should prepare for those cases in this fix:

if (!Platform.isDefaultCDSArchiveSupported() && !Platform.isAArch64()))
    throw new SkippedException("not a supported platform");

I just noticed there was a bug fix JDK-8269840 (Update Platform.isDefaultCDSArchiveSupported() to return true for aarch64 platforms). So the second condition in the above is not necessary.

Calvin suggests to throw SkippedException in an offline chat.

@1996scarlet
Copy link
Contributor Author

@1996scarlet 1996scarlet commented Sep 17, 2021

Please reexamine the change.
Thanks all!

} else {
helper.checkImage(image, module, null, null,
new String[] { subDir + "classes.jsa" });
}
Copy link
Member

@mlchung mlchung Sep 17, 2021

Choose a reason for hiding this comment

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

The above change checking 64-bit platform should not be needed. On an unknown platform, isDefaultCDSArchiveSupported should return false. It only returns true on 64-bit supported platforms. Can you verfiy?

Copy link
Contributor Author

@1996scarlet 1996scarlet Sep 17, 2021

Choose a reason for hiding this comment

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

I just try it on LoongArch64 and mips64el.

The Platform.isDefaultCDSArchiveSupported() returns true.
So the above checking can not be removed.

Also, I just forgot add import jtreg.SkippedException.

Copy link
Member

@mlchung mlchung left a comment

Thanks for the change.

@1996scarlet
Copy link
Contributor Author

@1996scarlet 1996scarlet commented Sep 17, 2021

/integrate

@openjdk openjdk bot added the sponsor label Sep 17, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 17, 2021

@1996scarlet
Your change (at version 503406b) is now ready to be sponsored by a Committer.

Copy link
Member

@calvinccheung calvinccheung left a comment

Looks good and thanks for fixing this bug.

@calvinccheung
Copy link
Member

@calvinccheung calvinccheung commented Sep 17, 2021

/sponsor

@openjdk
Copy link

@openjdk openjdk bot commented Sep 17, 2021

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

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Sep 17, 2021
@openjdk openjdk bot added integrated and removed ready rfr sponsor labels Sep 17, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 17, 2021

@calvinccheung @1996scarlet Pushed as commit 8302061.

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

@1996scarlet 1996scarlet deleted the JDK-8273774 branch Sep 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs integrated
3 participants